Skip to content

Commit

Permalink
fix(repair_test): properly wait for node startup
Browse files Browse the repository at this point in the history
Repair ignore hosts test stops and starts Scylla service on a node, and it could happen that this node is not fully responsive when the next test is already running.
  • Loading branch information
Michal-Leszczynski committed Jun 4, 2024
1 parent 4cf6c0b commit aabbcb7
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions pkg/service/repair/service_repair_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"github.com/scylladb/go-set/strset"
"github.com/scylladb/gocqlx/v2"
"github.com/scylladb/scylla-manager/v3/pkg/dht"
"github.com/scylladb/scylla-manager/v3/pkg/ping/cqlping"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/testconfig"
. "github.com/scylladb/scylla-manager/v3/pkg/testutils/testhelper"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -1186,7 +1187,12 @@ func TestServiceRepairIntegration(t *testing.T) {
defer cancel()

var ignored = IPFromTestNet("12")
_, _, err := ExecOnHost(ignored, "sudo supervisorctl stop scylla")
ni, err := h.Client.NodeInfo(ctx, ignored)
if err != nil {
t.Fatal(err)
}

_, _, err = ExecOnHost(ignored, "sudo supervisorctl stop scylla")
if err != nil {
t.Fatal(err)
}
Expand All @@ -1195,7 +1201,24 @@ func TestServiceRepairIntegration(t *testing.T) {
if err != nil {
t.Fatal(err)
}
time.Sleep(5 * time.Second)

cfg := cqlping.Config{
Addr: ni.CQLAddr(ignored),
Timeout: time.Minute,
}

cond := func() bool {
if _, err = cqlping.QueryPing(ctx, cfg, TestDBUsername(), TestDBPassword()); err != nil {
return false
}
status, err := h.Client.Status(ctx)
if err != nil {
return false
}
return len(status.Live()) == len(ManagedClusterHosts())
}

WaitCond(t, cond, time.Second, shortWait)
}()

Print("When: run repair")
Expand Down

0 comments on commit aabbcb7

Please sign in to comment.