plugin/forward: Enable multiple forward declarations (#5127)

* enable multiple declarations of forward plugin

Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
Chris O'Haver 2022-07-20 10:35:04 -04:00 committed by GitHub
parent 11059dd855
commit 513f27b9a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 175 additions and 72 deletions

View file

@ -24,7 +24,7 @@ func TestSetupPolicy(t *testing.T) {
for i, test := range tests {
c := caddy.NewTestController("dns", test.input)
f, err := parseForward(c)
fs, err := parseForward(c)
if test.shouldErr && err == nil {
t.Errorf("Test %d: expected error but found %s for input %s", i, err, test.input)
@ -40,8 +40,8 @@ func TestSetupPolicy(t *testing.T) {
}
}
if !test.shouldErr && f.p.String() != test.expectedPolicy {
t.Errorf("Test %d: expected: %s, got: %s", i, test.expectedPolicy, f.p.String())
if !test.shouldErr && (len(fs) == 0 || fs[0].p.String() != test.expectedPolicy) {
t.Errorf("Test %d: expected: %s, got: %s", i, test.expectedPolicy, fs[0].p.String())
}
}
}