|
5 | 5 | "reflect"
|
6 | 6 | "sync"
|
7 | 7 | "testing"
|
8 |
| - "time" |
9 | 8 |
|
10 | 9 | "github.com/harness/ff-golang-server-sdk/evaluation"
|
11 | 10 | )
|
@@ -85,7 +84,7 @@ func TestSafeTargetAnalytics(t *testing.T) {
|
85 | 84 | func TestSafeSeenTargets(t *testing.T) {
|
86 | 85 | // Initialize with a small maxSize for testing
|
87 | 86 | maxSize := 3
|
88 |
| - s := newSafeSeenTargets(maxSize, 0).(SafeSeenTargetsCache[string, bool]) |
| 87 | + s := newSafeSeenTargets(maxSize).(SafeSeenTargetsCache[string, bool]) |
89 | 88 |
|
90 | 89 | testData := map[string]bool{
|
91 | 90 | "target1": true,
|
@@ -135,7 +134,7 @@ func TestSafeSeenTargets(t *testing.T) {
|
135 | 134 | concurrencyLevel := 100
|
136 | 135 |
|
137 | 136 | // Re-initialize the map for concurrency testing
|
138 |
| - s = newSafeSeenTargets(100, 0).(SafeSeenTargetsCache[string, bool]) |
| 137 | + s = newSafeSeenTargets(100).(SafeSeenTargetsCache[string, bool]) |
139 | 138 |
|
140 | 139 | // Concurrently set keys
|
141 | 140 | for i := 0; i < concurrencyLevel; i++ {
|
@@ -173,32 +172,5 @@ func TestSafeSeenTargets(t *testing.T) {
|
173 | 172 | t.Errorf("Map size should be 0 after clearing, got %d", s.size())
|
174 | 173 | }
|
175 | 174 | })
|
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 | + |
204 | 176 | }
|
0 commit comments