Pull request 2067: 6399-fix-domain-specific-upstreams-check
Closes #6399.
Co-authored-by: Eugene Burkov <E.Burkov@AdGuard.COM>
Squashed commit of the following:
commit 7af223caf83565e8dab34636dcda810a8a7732c7
Merge: b5dd3903f 4b9947da8
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Fri Nov 10 18:14:54 2023 +0300
Merge branch 'master' into 6399-fix-domain-specific-upstreams-check
commit b5dd3903fe7f86d9dba217acabdc66dd39834a85
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Fri Nov 10 18:06:25 2023 +0300
dnsforward: imp docs
commit 02b00d2630b2d6d1585c8716d3fd7c785ae19169
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Fri Nov 10 17:35:00 2023 +0300
dnsforward: add todo
commit 7c542905607ade22b32481ad58b646267aa1787d
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Fri Nov 10 16:42:50 2023 +0300
dnsforward: fix typo
commit 86259571293aa789836b6b7b2ed8935505ae3734
Author: Stanislav Chzhen <s.chzhen@adguard.com>
Date: Fri Nov 10 16:35:35 2023 +0300
dnsforward: fix domain specific upstreams check
This commit is contained in:
@@ -479,6 +479,8 @@ func TestServer_HandleTestUpstreamDNS(t *testing.T) {
|
||||
Host: newLocalUpstreamListener(t, 0, badHandler).String(),
|
||||
}).String()
|
||||
|
||||
goodAndBadUps := strings.Join([]string{goodUps, badUps}, " ")
|
||||
|
||||
const (
|
||||
upsTimeout = 100 * time.Millisecond
|
||||
|
||||
@@ -605,6 +607,29 @@ func TestServer_HandleTestUpstreamDNS(t *testing.T) {
|
||||
`dns: id mismatch`,
|
||||
},
|
||||
name: "multiple_domain_specific_upstreams",
|
||||
}, {
|
||||
body: map[string]any{
|
||||
"upstream_dns": []string{"[/domain.example/]/]1.2.3.4"},
|
||||
},
|
||||
wantResp: map[string]any{
|
||||
"[/domain.example/]/]1.2.3.4": `wrong upstream format: ` +
|
||||
`bad upstream for domain "[/domain.example/]/]1.2.3.4": ` +
|
||||
`duplicated separator`,
|
||||
},
|
||||
name: "bad_specification",
|
||||
}, {
|
||||
body: map[string]any{
|
||||
"upstream_dns": []string{"[/domain.example/]" + goodAndBadUps},
|
||||
"fallback_dns": []string{"[/domain.example/]" + goodAndBadUps},
|
||||
"private_upstream": []string{"[/domain.example/]" + goodAndBadUps},
|
||||
},
|
||||
wantResp: map[string]any{
|
||||
goodUps: "OK",
|
||||
badUps: `WARNING: couldn't communicate ` +
|
||||
`with upstream: exchanging with ` + badUps + ` over tcp: ` +
|
||||
`dns: id mismatch`,
|
||||
},
|
||||
name: "all_different",
|
||||
}}
|
||||
|
||||
for _, tc := range testCases {
|
||||
|
||||
Reference in New Issue
Block a user