Skip to content

Commit b7df3ea

Browse files
committed
stopping ingester
Signed-off-by: alanprot <[email protected]>
1 parent 605381d commit b7df3ea

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

pkg/ingester/ingester_test.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"fmt"
88
"io"
99
"math"
10+
"math/rand"
1011
"net"
1112
"net/http"
1213
"net/http/httptest"
@@ -182,9 +183,9 @@ func TestIngesterDeletionRace(t *testing.T) {
182183
limits := defaultLimitsTestConfig()
183184
tenantLimits := newMockTenantLimits(map[string]*validation.Limits{userID: &limits})
184185
cfg := defaultIngesterTestConfig(t)
185-
cfg.BlocksStorageConfig.TSDB.CloseIdleTSDBInterval = 1 * time.Millisecond
186+
cfg.BlocksStorageConfig.TSDB.CloseIdleTSDBInterval = 5 * time.Millisecond
186187
cfg.BlocksStorageConfig.TSDB.CloseIdleTSDBTimeout = 10 * time.Second
187-
cfg.BlocksStorageConfig.TSDB.ExpandedCachingExpireInterval = 1 * time.Millisecond
188+
cfg.BlocksStorageConfig.TSDB.ExpandedCachingExpireInterval = 5 * time.Millisecond
188189
cfg.BlocksStorageConfig.TSDB.PostingsCache = cortex_tsdb.TSDBPostingsCacheConfig{
189190
SeedSize: 3, // lets make sure all metric names collide
190191
Head: cortex_tsdb.PostingsCacheConfig{
@@ -205,15 +206,16 @@ func TestIngesterDeletionRace(t *testing.T) {
205206
require.NoError(t, os.Mkdir(chunksDir, os.ModePerm))
206207
require.NoError(t, os.Mkdir(blocksDir, os.ModePerm))
207208

208-
ing, err := prepareIngesterWithBlocksStorageAndLimits(t, cfg, limits, tenantLimits, blocksDir, registry, true)
209+
ing, err := prepareIngesterWithBlocksStorageAndLimits(t, cfg, limits, tenantLimits, blocksDir, registry, false)
209210
require.NoError(t, err)
210211
require.NoError(t, services.StartAndAwaitRunning(context.Background(), ing))
212+
defer services.StopAndAwaitTerminated(context.Background(), ing) //nolint:errcheck
211213
// Wait until it's ACTIVE
212214
test.Poll(t, time.Second, ring.ACTIVE, func() interface{} {
213215
return ing.lifecycler.GetState()
214216
})
215217

216-
numberOfTenants := 500
218+
numberOfTenants := 150
217219
wg := sync.WaitGroup{}
218220
wg.Add(numberOfTenants)
219221

@@ -232,6 +234,7 @@ func TestIngesterDeletionRace(t *testing.T) {
232234
Matchers: []*client.LabelMatcher{{Type: client.REGEX_MATCH, Name: labels.MetricName, Value: ".*"}},
233235
}, s)
234236
require.NoError(t, err)
237+
time.Sleep(time.Duration(rand.Int63n(5)) * time.Millisecond)
235238
ing.getTSDB(u).deletionMarkFound.Store(true) // lets force close the tenant
236239
}()
237240
}

0 commit comments

Comments
 (0)