diff options
author | 2017-04-24 20:37:43 +0100 | |
---|---|---|
committer | 2017-04-24 20:37:43 +0100 | |
commit | 003b1bf678f6fc1d551fed5184adccde2137e86f (patch) | |
tree | f8d3af6f48ef9d73c841095cf3c04649b11a1fac /middleware/proxy/upstream_test.go | |
parent | bfa18470e53c5058237e02b56c97c5d0a2cb47be (diff) | |
download | coredns-003b1bf678f6fc1d551fed5184adccde2137e86f.tar.gz coredns-003b1bf678f6fc1d551fed5184adccde2137e86f.tar.zst coredns-003b1bf678f6fc1d551fed5184adccde2137e86f.zip |
Fix health race (#645)
* Revert "middleware/proxy: Make Unhealthy a pointer (#615)"
This reverts commit acbf522cebdcd53c26d153c1d9267d709ba75f64.
* middleware/proxy: add proper locking
This add the proper locking around `Unhealthy`.
Diffstat (limited to 'middleware/proxy/upstream_test.go')
-rw-r--r-- | middleware/proxy/upstream_test.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/middleware/proxy/upstream_test.go b/middleware/proxy/upstream_test.go index fbdb0ce4a..587d96994 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") } |