(t *testing.T)
| 211 | } |
| 212 | |
| 213 | func Test_CookieJarHostEvictionIsDeterministic(t *testing.T) { |
| 214 | t.Parallel() |
| 215 | |
| 216 | cj := &CookieJar{hostCookies: make(map[string][]storedCookie, maxCookieJarHosts)} |
| 217 | for i := range maxCookieJarHosts { |
| 218 | host := fmt.Sprintf("host-%04d.example.com", i+1) |
| 219 | cookie := fasthttp.AcquireCookie() |
| 220 | cookie.SetKey("k") |
| 221 | cookie.SetValue("v") |
| 222 | cj.hostCookies[host] = []storedCookie{{cookie: cookie, isHostOnly: true}} |
| 223 | } |
| 224 | |
| 225 | cj.ensureHostCapacityLocked("zzz.example.com", time.Now()) |
| 226 | |
| 227 | _, ok := cj.hostCookies["host-0001.example.com"] |
| 228 | require.False(t, ok) |
| 229 | require.Len(t, cj.hostCookies, maxCookieJarHosts-1) |
| 230 | } |
| 231 | |
| 232 | func Test_CookieJarHostCapacityPrefersExpiredEntries(t *testing.T) { |
| 233 | t.Parallel() |
nothing calls this directly
no test coverage detected