aboutsummaryrefslogtreecommitdiff
path: root/plugin/forward/persistent_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-10-01 20:45:52 +0100
committerGravatar GitHub <noreply@github.com> 2019-10-01 20:45:52 +0100
commit575cea4496fd8556ec198ea43c99a5c6cfc603b2 (patch)
tree915f54198408aa947ecd5edaddb71afa6aee0c7e /plugin/forward/persistent_test.go
parent2d98d520b5c75d31e37dfe72a67b39707a56dc69 (diff)
downloadcoredns-575cea4496fd8556ec198ea43c99a5c6cfc603b2.tar.gz
coredns-575cea4496fd8556ec198ea43c99a5c6cfc603b2.tar.zst
coredns-575cea4496fd8556ec198ea43c99a5c6cfc603b2.zip
Move map to array (#3339)
* Move map to array The map was not needed move to an array, see #1941 for the original idea. That of course didn't apply anymore; make a super minimal change to implements the idea from #1941 Signed-off-by: Miek Gieben <miek@miek.nl> * Add total count Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/forward/persistent_test.go')
-rw-r--r--plugin/forward/persistent_test.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/plugin/forward/persistent_test.go b/plugin/forward/persistent_test.go
index 1fb239ca7..9ea0cdc10 100644
--- a/plugin/forward/persistent_test.go
+++ b/plugin/forward/persistent_test.go
@@ -96,18 +96,14 @@ func TestCleanupAll(t *testing.T) {
c2, _ := dns.DialTimeout("udp", tr.addr, maxDialTimeout)
c3, _ := dns.DialTimeout("udp", tr.addr, maxDialTimeout)
- tr.conns["udp"] = []*persistConn{
- {c1, time.Now()},
- {c2, time.Now()},
- {c3, time.Now()},
- }
+ tr.conns[typeUdp] = []*persistConn{{c1, time.Now()}, {c2, time.Now()}, {c3, time.Now()}}
- if len(tr.conns["udp"]) != 3 {
+ if len(tr.conns[typeUdp]) != 3 {
t.Error("Expected 3 connections")
}
tr.cleanup(true)
- if len(tr.conns["udp"]) > 0 {
+ if len(tr.conns[typeUdp]) > 0 {
t.Error("Expected no cached connections")
}
}