Skip to content

Commit 45337df

Browse files
chore: update tests to cater to imcache syntax
1 parent 6f550a1 commit 45337df

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

infrastructure/featureflag/featureflag_test.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ func TestFlushCache(t *testing.T) {
255255

256256
service.FlushCache()
257257

258-
assert.Empty(t, service.orgToFlag)
258+
assert.Len(t, service.orgToFlag.GetAll(), 0)
259259
})
260260

261261
t.Run("clears SAST settings", func(t *testing.T) {
@@ -268,7 +268,7 @@ func TestFlushCache(t *testing.T) {
268268

269269
service.FlushCache()
270270

271-
assert.Empty(t, service.orgToSastSettings)
271+
assert.Len(t, service.orgToSastSettings.GetAll(), 0)
272272
})
273273

274274
t.Run("concurrent flush during fetch is thread-safe", func(t *testing.T) {
@@ -505,7 +505,8 @@ func TestFetchSastSettings(t *testing.T) {
505505
assert.Equal(t, settings1, settings2)
506506

507507
// Cache should contain the org
508-
assert.Contains(t, service.orgToSastSettings, org)
508+
_, b := service.orgToSastSettings.Get(org)
509+
assert.True(t, b)
509510
})
510511

511512
t.Run("different orgs have separate caches", func(t *testing.T) {
@@ -539,10 +540,6 @@ func TestFetchSastSettings(t *testing.T) {
539540
assert.NotNil(t, settings2)
540541

541542
// Cache should have both orgs
542-
assert.Contains(t, service.orgToSastSettings, org1)
543-
assert.Contains(t, service.orgToSastSettings, org2)
544-
assert.Len(t, service.orgToSastSettings, 2)
545-
546543
actualOrg1, b := service.orgToSastSettings.Get(org1)
547544
assert.True(t, b)
548545
actualOrg2, b := service.orgToSastSettings.Get(org2)
@@ -580,7 +577,8 @@ func TestFetchSastSettings(t *testing.T) {
580577
wg.Wait()
581578

582579
// Should only have one cache entry
583-
assert.Contains(t, service.orgToSastSettings, org)
584-
assert.Len(t, service.orgToSastSettings, 1)
580+
_, b := service.orgToSastSettings.Get(org)
581+
assert.True(t, b)
582+
assert.Len(t, service.orgToSastSettings.GetAll(), 1)
585583
})
586584
}

0 commit comments

Comments
 (0)