mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
all: implement policy failover rcodes
While at it, ensure that config is validated, and fixing a bug related to reuse ctx between multiple upstreams resolving.
This commit is contained in:
committed by
Cuong Manh Le
parent
fe0faac8c4
commit
ccada70e31
@@ -69,6 +69,7 @@ func TestConfigValidation(t *testing.T) {
|
||||
{"invalid listener port", invalidListenerPort(t), true},
|
||||
{"os upstream", configWithOsUpstream(t), false},
|
||||
{"invalid rules", configWithInvalidRules(t), true},
|
||||
{"invalid dns rcodes", configWithInvalidRcodes(t), true},
|
||||
}
|
||||
|
||||
for _, tc := range tests {
|
||||
@@ -155,6 +156,16 @@ func configWithInvalidRules(t *testing.T) *ctrld.Config {
|
||||
return cfg
|
||||
}
|
||||
|
||||
func configWithInvalidRcodes(t *testing.T) *ctrld.Config {
|
||||
cfg := defaultConfig(t)
|
||||
cfg.Listener["0"].Policy = &ctrld.ListenerPolicyConfig{
|
||||
Name: "Policy with invalid Rcodes",
|
||||
Networks: []ctrld.Rule{{"*.com": []string{"upstream.0"}}},
|
||||
FailoverRcodes: []string{"foo"},
|
||||
}
|
||||
return cfg
|
||||
}
|
||||
|
||||
func TestUpstreamConfig_Init(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
Reference in New Issue
Block a user