aboutsummaryrefslogtreecommitdiff
path: root/middleware/proxy/upstream_test.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2017-04-13 16:26:05 +0100
committerGravatar GitHub <noreply@github.com> 2017-04-13 16:26:05 +0100
commitacbf522cebdcd53c26d153c1d9267d709ba75f64 (patch)
tree9c2e3e31041a1ef2a49bd7118a0b1c56813a82d5 /middleware/proxy/upstream_test.go
parentef4fa66e670fabe5c4dcfecc319c0f99d02bfd07 (diff)
downloadcoredns-acbf522cebdcd53c26d153c1d9267d709ba75f64.tar.gz
coredns-acbf522cebdcd53c26d153c1d9267d709ba75f64.tar.zst
coredns-acbf522cebdcd53c26d153c1d9267d709ba75f64.zip
middleware/proxy: Make Unhealthy a pointer (#615)
Pointer updates are atomic so drop the sync.RWMutex as it is not needed anymore. This also fixes the race introduced with dfc71df (although I believe this is the first time we properly tested that code path).
Diffstat (limited to 'middleware/proxy/upstream_test.go')
-rw-r--r--middleware/proxy/upstream_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/middleware/proxy/upstream_test.go b/middleware/proxy/upstream_test.go
index 587d96994..fbdb0ce4a 100644
--- a/middleware/proxy/upstream_test.go
+++ b/middleware/proxy/upstream_test.go
@@ -42,13 +42,13 @@ func TestSelect(t *testing.T) {
FailTimeout: 10 * time.Second,
MaxFails: 1,
}
- upstream.Hosts[0].Unhealthy = true
- upstream.Hosts[1].Unhealthy = true
- upstream.Hosts[2].Unhealthy = true
+ *upstream.Hosts[0].Unhealthy = true
+ *upstream.Hosts[1].Unhealthy = true
+ *upstream.Hosts[2].Unhealthy = true
if h := upstream.Select(); h != nil {
t.Error("Expected select to return nil as all host are down")
}
- upstream.Hosts[2].Unhealthy = false
+ *upstream.Hosts[2].Unhealthy = false
if h := upstream.Select(); h == nil {
t.Error("Expected select to not return nil")
}