Skip to content

Commit 11425fa

Browse files
authored
chore(v2): lighten metadata query test suite (#4073)
1 parent 3686960 commit 11425fa

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pkg/experiment/metastore/index/query_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ func TestIndex_Query(t *testing.T) {
273273
}
274274

275275
func Test_QueryConcurrency(t *testing.T) {
276-
for i := 0; i < 3 && !t.Failed(); i++ {
276+
const N = 1
277+
for i := 0; i < N && !t.Failed(); i++ {
277278
q := new(queryTestSuite)
278279
q.run(t)
279280
}
@@ -356,23 +357,23 @@ func (s *queryTestSuite) run(t *testing.T) {
356357

357358
s.runQuery(t, s.queryBlocks)
358359
s.runQuery(t, s.queryLabels)
359-
s.runQuery(t, s.findCompactedBlocks)
360+
s.runQuery(t, s.getBlocks)
360361

361-
// Stop the test after 5 seconds,
362-
// if the test is still running.
363362
go func() {
364363
select {
365364
case <-s.stop:
366-
case <-time.After(5 * time.Second):
365+
case <-time.After(30 * time.Second):
367366
t.Error("test time out: query consistency not confirmed")
368367
s.doStop()
369368
}
370369
}()
371370

372371
s.wg.Wait()
372+
373373
// If we haven't failed the test, we can conclude that
374374
// no races, no deadlocks, no inconsistencies were found.
375375
s.doStop()
376+
376377
// Wait for the write goroutine to finish, so we can
377378
// safely tear down the test.
378379
<-done
@@ -579,7 +580,7 @@ func (s *queryTestSuite) queryLabels(t *testing.T) (ret int32) {
579580
return sourceBlocks | compactedBlocks
580581
}
581582

582-
func (s *queryTestSuite) findCompactedBlocks(t *testing.T) (ret int32) {
583+
func (s *queryTestSuite) getBlocks(t *testing.T) (ret int32) {
583584
var x []*metastorev1.BlockMeta
584585
var err error
585586
require.NoError(t, s.db.View(func(tx *bbolt.Tx) error {

0 commit comments

Comments
 (0)