Skip to content

Commit a5fc1eb

Browse files
fix(scyllaclient_test): skip TestClientActiveRepairsIntegration for tablets
When SM uses tablet repair API, Scylla registers a request to repair a tablet table. Later on, Scylla creates repair jobs for given tablets according to its own internal scheduler. Because of that, we have no guarantee that Scylla will start any repair jobs right after SM used tablet repair API. For example, they might be delayed due to a table migration/merge/split. The API for checking active repairs and killing repairs works on the repair job level, not the tablet repair API request level. Task manager API should be used for handling those requests. Fixes #4334
1 parent 1990592 commit a5fc1eb

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

Diff for: pkg/scyllaclient/client_scylla_integration_test.go

+20-25
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,7 @@ func TestClientActiveRepairsIntegration(t *testing.T) {
169169
if err != nil {
170170
t.Fatal(err)
171171
}
172-
ni, err := client.AnyNodeInfo(context.Background())
173-
if err != nil {
174-
t.Fatal(err)
175-
}
176-
tabletAPI, err := ni.SupportsTabletRepair()
172+
hosts, err := client.Hosts(context.Background())
177173
if err != nil {
178174
t.Fatal(err)
179175
}
@@ -184,46 +180,45 @@ func TestClientActiveRepairsIntegration(t *testing.T) {
184180
db.WriteData(t, s, ks, 1)
185181

186182
rd := scyllaclient.NewRingDescriber(context.Background(), client)
187-
asyncRepair := func(ctx context.Context, ks, tab, master string) {
188-
if _, err := client.RawRepair(ctx, ks, tab, master); err != nil {
189-
t.Error(err)
190-
}
191-
}
192-
if rd.IsTabletKeyspace(ks) && tabletAPI {
193-
asyncRepair = func(ctx context.Context, ks, tab, master string) {
194-
if _, err := client.TabletRepair(ctx, ks, tab, master, nil, nil); err != nil {
195-
t.Error(err)
196-
}
197-
}
183+
if rd.IsTabletKeyspace(ks) {
184+
// When SM uses tablet repair API, Scylla registers a request to repair
185+
// a tablet table. Later on, Scylla creates repair jobs for given tablets
186+
// according to its own internal scheduler. Because of that, we have no guarantee
187+
// that Scylla will start any repair jobs right after SM used tablet repair API.
188+
// For example, they might be delayed due to a table migration/merge/split.
189+
// The API for checking active repairs and killing repairs works on the repair job
190+
// level, not the tablet repair API request level. Task manager API should be used
191+
// for handling those requests.
192+
t.Skip("Checking active repairs and killing repairs is flaky with tablets")
198193
}
199194

200195
Print("When: cluster is idle")
201196
Print("Then: no repairs are running")
202-
active, err := client.ActiveRepairs(context.Background(), ManagedClusterHosts())
197+
active, err := client.ActiveRepairs(context.Background(), hosts)
203198
if err != nil {
204199
t.Fatal(err)
205200
}
206201
if len(active) != 0 {
207202
t.Fatal(active)
208203
}
209204

205+
Print("When: repair is running on host 0")
206+
go func() {
207+
ExecOnHost(hosts[0], "nodetool repair -pr")
208+
}()
210209
defer func() {
211-
// Make sure that repairs don't spill to other tests
212-
if err := client.KillAllRepairs(context.Background(), ManagedClusterHosts()...); err != nil {
210+
if err := client.KillAllRepairs(context.Background(), hosts[0]); err != nil {
213211
t.Fatal(err)
214212
}
215213
}()
216214

217-
Print("When: repairs are running")
218-
Print("Then: repairs are reported as active")
215+
Print("Then: active repairs reports host 0")
219216
WaitCond(t, func() bool {
220-
// Multiple repair requests in order to reduce flakiness
221-
asyncRepair(context.Background(), ks, db.BigTableName, ManagedClusterHost())
222-
active, err = client.ActiveRepairs(context.Background(), ManagedClusterHosts())
217+
active, err = client.ActiveRepairs(context.Background(), hosts)
223218
if err != nil {
224219
t.Fatal(err)
225220
}
226-
return len(active) > 0
221+
return cmp.Diff(active, hosts[0:1]) == ""
227222
}, 500*time.Millisecond, 4*time.Second)
228223
}
229224

0 commit comments

Comments
 (0)