mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-05 18:47:20 +01:00
test: use a neutral server identity in shell checks
This commit is contained in:
1 parent
2e18bee74b
commit
e4458de5cd
1 file changed
+5
-5
@@ -70,7 +70,7 @@ type inspectionControlServer struct {
|
||||
func (s inspectionControlServer) GetClusterStatus(ctx context.Context, q *control.GetClusterStatusRequest) (*control.ClusterStatusResponse, error) {
|
||||
r, err := s.cmdFakeClusterEvidenceServer.GetClusterStatus(ctx, q)
|
||||
r.Volumes[0].ReplicationFactor = 1
|
||||
r.Volumes[0].Replicas = []*control.ReplicaEvidence{{ReplicaId: "r2", ServerId: "m02", Observed: true}}
|
||||
r.Volumes[0].Replicas = []*control.ReplicaEvidence{{ReplicaId: "r2", ServerId: "host-b", Observed: true}}
|
||||
return r, err
|
||||
}
|
||||
func (s inspectionControlServer) QueryWorkspace(_ context.Context, q *control.WorkspaceVolume) (*control.WorkspaceStatus, error) {
|
||||
@@ -181,7 +181,7 @@ func TestShellCheckUsesTypedLeaseReadinessCutAndVersionAnswers(t *testing.T) {
|
||||
}))
|
||||
defer h.Close()
|
||||
var out, errout bytes.Buffer
|
||||
code := run([]string{"shell", "-master", ln.Addr().String(), "-server-id", "m02", "-status-addr", h.URL, "-c", "cluster.check -o json"}, &out, &errout)
|
||||
code := run([]string{"shell", "-master", ln.Addr().String(), "-server-id", "host-b", "-status-addr", h.URL, "-c", "cluster.check -o json"}, &out, &errout)
|
||||
rows := requireInspectionOutput(t, out.Bytes())
|
||||
for _, r := range rows {
|
||||
if r.Status == "FAIL" && (r.See != "docs/troubleshooting.md#"+strings.ReplaceAll(r.ID, ".", "") || r.Cure == "") {
|
||||
@@ -264,7 +264,7 @@ func TestShellClockCannotCallAnOverflowingDifferenceOK(t *testing.T) {
|
||||
defer srv.Stop()
|
||||
defer ln.Close()
|
||||
var out, errout bytes.Buffer
|
||||
code := run([]string{"shell", "-master", ln.Addr().String(), "-server-id", "m02", "-c", "cluster.check -o json"}, &out, &errout)
|
||||
code := run([]string{"shell", "-master", ln.Addr().String(), "-server-id", "host-b", "-c", "cluster.check -o json"}, &out, &errout)
|
||||
rows := requireInspectionOutput(t, out.Bytes())
|
||||
if r := rows["clock.skew"]; r.Status != "FAIL" || code != 1 {
|
||||
t.Fatalf("impossible clock accepted: %+v exit%d", r, code)
|
||||
@@ -289,7 +289,7 @@ func TestShellCheckNeverCallsOffHostChecksOK(t *testing.T) {
|
||||
for _, r := range rows {
|
||||
switch r.ID {
|
||||
case "volume.frontend", "volume.chunkstore", "volume.cut", "volume.cleaning", "versions.equal", "clock.skew":
|
||||
if r.Status != "not checked here" || !strings.Contains(r.Finding, "m02") {
|
||||
if r.Status != "not checked here" || !strings.Contains(r.Finding, "host-b") {
|
||||
t.Fatalf("off-host claim: %+v", r)
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,7 @@ func TestShellCheckRefusesWrongHolderAndDoesNotFollowStatusRedirects(t *testing.
|
||||
statusAddr = ""
|
||||
}
|
||||
var out, errout bytes.Buffer
|
||||
code := run([]string{"shell", "-master", addr, "-server-id", "m02", "-status-addr", statusAddr, "-c", "cluster.check -o json"}, &out, &errout)
|
||||
code := run([]string{"shell", "-master", addr, "-server-id", "host-b", "-status-addr", statusAddr, "-c", "cluster.check -o json"}, &out, &errout)
|
||||
rows := requireInspectionOutput(t, out.Bytes())
|
||||
if r := rows["volume.frontend"]; r.Status != "FAIL" || code != 1 {
|
||||
t.Fatalf("wrong holder accepted %+v exit%d", r, code)
|
||||
|
||||
Reference in new issue
Block a user