mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
plugin/loadbalance: Improve weights update (#5906)
Don't lock weights for duration of parsing weight file. Add missing check to reject zero weight values. Signed-off-by: Gabor Dozsa <gabor.dozsa@ibm.com>
This commit is contained in:
@@ -79,6 +79,11 @@ w1,example.org
|
||||
192.168.1.14 300
|
||||
`
|
||||
|
||||
const zeroWeightWRR = `
|
||||
w1,example.org
|
||||
192.168.1.14 0
|
||||
`
|
||||
|
||||
func TestWeightFileUpdate(t *testing.T) {
|
||||
tests := []struct {
|
||||
weightFilContent string
|
||||
@@ -95,6 +100,7 @@ func TestWeightFileUpdate(t *testing.T) {
|
||||
{missingDomainWRR, true, nil, "Missing domain name"},
|
||||
{wrongIpWRR, true, nil, "Wrong IP address"},
|
||||
{wrongWeightWRR, true, nil, "Wrong weight value"},
|
||||
{zeroWeightWRR, true, nil, "Wrong weight value"},
|
||||
}
|
||||
|
||||
for i, test := range tests {
|
||||
|
||||
Reference in New Issue
Block a user