mirror of
https://github.com/coredns/coredns.git
synced 2025-10-31 18:23:13 -04:00
plugin/chaos: add default list of authors (#2737)
* plugin/chaos: add default list of authors Add a owners_generate.go that generates a Owners variables for use in the chaos plugin. Add a default list of authors in the authors.bind CH zone. When doing a query this now returns: ~~~ sh % dig authors.bind TXT CH ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5456 ;; flags: qr rd; QUERY: 1, ANSWER: 22, AUTHORITY: 0, ADDITIONAL: 1 ;; WARNING: recursion requested but not available ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 4096 ;; QUESTION SECTION: ;authors.bind. CH TXT ;; ANSWER SECTION: authors.bind. 0 CH TXT "bradbeam" authors.bind. 0 CH TXT "chrisohaver" authors.bind. 0 CH TXT "dilyevsky" authors.bind. 0 CH TXT "ekleiner" authors.bind. 0 CH TXT "fastest963" authors.bind. 0 CH TXT "fturib" authors.bind. 0 CH TXT "greenpau" authors.bind. 0 CH TXT "grobie" authors.bind. 0 CH TXT "inigohu" authors.bind. 0 CH TXT "isolus" authors.bind. 0 CH TXT "johnbelamaric" authors.bind. 0 CH TXT "miekg" authors.bind. 0 CH TXT "nchrisdk" authors.bind. 0 CH TXT "nitisht" authors.bind. 0 CH TXT "pmoroney" authors.bind. 0 CH TXT "rajansandeep" authors.bind. 0 CH TXT "rdrozhdzh" authors.bind. 0 CH TXT "rtreffer" authors.bind. 0 CH TXT "stp-ip" authors.bind. 0 CH TXT "superq" authors.bind. 0 CH TXT "varyoo" authors.bind. 0 CH TXT "yongtang" ~~~ This was hard to do previously as we didn't hardcode this in the source, but now with OWNERS files we can just generate this list. Privacy wise this isn't worse than being listed in OWNERS file in the first place. And it's a nice hat tip to the people making CoreDNS better. Signed-off-by: Miek Gieben <miek@miek.nl> * Sticklet bot comments Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -12,7 +12,7 @@ func TestSetupChaos(t *testing.T) {
|
||||
input string
|
||||
shouldErr bool
|
||||
expectedVersion string // expected version.
|
||||
expectedAuthor string // expected author (string, although we get a map).
|
||||
expectedAuthor string // expected author (string, although we get a slice).
|
||||
expectedErrContent string // substring from the expected error. Empty for positive cases.
|
||||
}{
|
||||
// positive
|
||||
@@ -26,7 +26,7 @@ func TestSetupChaos(t *testing.T) {
|
||||
|
||||
for i, test := range tests {
|
||||
c := caddy.NewTestController("dns", test.input)
|
||||
version, authors, err := chaosParse(c)
|
||||
version, authors, err := parse(c)
|
||||
|
||||
if test.shouldErr && err == nil {
|
||||
t.Errorf("Test %d: Expected error but found %s for input %s", i, err, test.input)
|
||||
@@ -43,11 +43,11 @@ func TestSetupChaos(t *testing.T) {
|
||||
}
|
||||
|
||||
if !test.shouldErr && version != test.expectedVersion {
|
||||
t.Errorf("Chaos not correctly set for input %s. Expected: %s, actual: %s", test.input, test.expectedVersion, version)
|
||||
t.Errorf("Test %d: Chaos not correctly set for input %s. Expected: %s, actual: %s", i, test.input, test.expectedVersion, version)
|
||||
}
|
||||
if !test.shouldErr && authors != nil {
|
||||
if _, ok := authors[test.expectedAuthor]; !ok {
|
||||
t.Errorf("Chaos not correctly set for input %s. Expected: '%s', actual: '%s'", test.input, test.expectedAuthor, "Miek Gieben")
|
||||
if !test.shouldErr && authors != nil && test.expectedAuthor != "" {
|
||||
if authors[0] != test.expectedAuthor {
|
||||
t.Errorf("Test %d: Chaos not correctly set for input %s. Expected: '%s', actual: '%s'", i, test.input, test.expectedAuthor, authors[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user