mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
test(chunkstore): the census test checks the unanswered master it names
TestCheckSingleFilerNeedsEveryMasterToAnswer now requires the refusal to name the master that did not answer, by its gRPC address or as given when it does not parse, among those named for the last round. The bound may also cut the favourable master's last call, so that master can be named too. Dropping a master from the named list fails every case it covers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4907c55f9b
commit
4604b30891
1 file changed
+17
-2
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"errors"
|
||||
"net"
|
||||
"slices"
|
||||
"strings"
|
||||
"sync"
|
||||
"testing"
|
||||
@@ -289,8 +290,22 @@ func TestCheckSingleFilerNeedsEveryMasterToAnswer(t *testing.T) {
|
||||
f.masters = masters
|
||||
f.mu.Unlock()
|
||||
err := cl.CheckSingleFiler(context.Background())
|
||||
if !errors.Is(err, ErrNotSingleFiler) || !strings.Contains(err.Error(), "every master must answer") || !strings.Contains(err.Error(), "rerun when they answer") {
|
||||
t.Errorf("%s (other first %v): %v; want a refusal naming the master that did not answer", c.name, otherFirst, err)
|
||||
// It names the master that did not answer (its gRPC address, or
|
||||
// the address as given when it does not parse) among those that
|
||||
// did not answer in the last round (the bound may also cut the
|
||||
// favourable master's last call).
|
||||
want := bad
|
||||
if g, gerr := grpcAddress(bad); gerr == nil {
|
||||
want = g
|
||||
}
|
||||
const lead = "every master must answer, these did not: "
|
||||
msg := ""
|
||||
if err != nil {
|
||||
msg = err.Error()
|
||||
}
|
||||
i, j := strings.Index(msg, lead), strings.Index(msg, " (rerun when they answer)")
|
||||
if !errors.Is(err, ErrNotSingleFiler) || i < 0 || j < i || !slices.Contains(strings.Split(msg[i+len(lead):j], ", "), want) {
|
||||
t.Errorf("%s (other first %v): %v; want a refusal naming %s among the masters that did not answer", c.name, otherFirst, err, want)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user