MCPcopy
hub / github.com/karol-broda/snitch / TestClearCache

Function TestClearCache

internal/resolver/resolver_test.go:149–164  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestClearCache(t *testing.T) {
150 r := New(100 * time.Millisecond)
151
152 r.ResolveAddr("127.0.0.1")
153 r.ResolvePort(80, "tcp")
154
155 if r.GetCacheSize() == 0 {
156 t.Error("expected non-empty cache before clear")
157 }
158
159 r.ClearCache()
160
161 if r.GetCacheSize() != 0 {
162 t.Errorf("expected empty cache after clear, got %d", r.GetCacheSize())
163 }
164}
165
166func TestGetCacheSize(t *testing.T) {
167 r := New(100 * time.Millisecond)

Callers

nothing calls this directly

Calls 5

ResolveAddrMethod · 0.80
ResolvePortMethod · 0.80
GetCacheSizeMethod · 0.80
ClearCacheMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected