Skip to content

Commit 751afa3

Browse files
committed
FFM-11660 Fix tests
1 parent 368d978 commit 751afa3

File tree

1 file changed

+3
-31
lines changed

1 file changed

+3
-31
lines changed

analyticsservice/safe_maps_test.go

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"reflect"
66
"sync"
77
"testing"
8-
"time"
98

109
"github.com/harness/ff-golang-server-sdk/evaluation"
1110
)
@@ -85,7 +84,7 @@ func TestSafeTargetAnalytics(t *testing.T) {
8584
func TestSafeSeenTargets(t *testing.T) {
8685
// Initialize with a small maxSize for testing
8786
maxSize := 3
88-
s := newSafeSeenTargets(maxSize, 0).(SafeSeenTargetsCache[string, bool])
87+
s := newSafeSeenTargets(maxSize).(SafeSeenTargetsCache[string, bool])
8988

9089
testData := map[string]bool{
9190
"target1": true,
@@ -135,7 +134,7 @@ func TestSafeSeenTargets(t *testing.T) {
135134
concurrencyLevel := 100
136135

137136
// Re-initialize the map for concurrency testing
138-
s = newSafeSeenTargets(100, 0).(SafeSeenTargetsCache[string, bool])
137+
s = newSafeSeenTargets(100).(SafeSeenTargetsCache[string, bool])
139138

140139
// Concurrently set keys
141140
for i := 0; i < concurrencyLevel; i++ {
@@ -173,32 +172,5 @@ func TestSafeSeenTargets(t *testing.T) {
173172
t.Errorf("Map size should be 0 after clearing, got %d", s.size())
174173
}
175174
})
176-
177-
// Add test for clearing based on interval
178-
t.Run("IntervalClearingTest", func(t *testing.T) {
179-
// Re-initialize the map with a clearing interval
180-
s = newSafeSeenTargets(10, 100*time.Millisecond)
181-
182-
for key, value := range testData {
183-
s.set(key, value)
184-
}
185-
186-
// Ensure the map has items initially
187-
if s.size() != len(testData) {
188-
t.Errorf("Expected map size to be %d, got %d", len(testData), s.size())
189-
}
190-
191-
// Wait for the clearing to clear the map
192-
time.Sleep(300 * time.Millisecond)
193-
194-
// Ensure the map is cleared after the interval
195-
if s.size() != 0 {
196-
t.Errorf("Expected map size to be 0 after clearing interval, got %d", s.size())
197-
}
198-
199-
// Ensure the limitExceeded flag is reset
200-
if s.isLimitExceeded() {
201-
t.Errorf("Expected limitExceeded to be reset after clearing")
202-
}
203-
})
175+
204176
}

0 commit comments

Comments
 (0)