plugin/metadata: finish documentation (#1951)

* plugin/metadata: finish documentation

Finish the README.md, add corner case in the IsLabel test and reword
some code comments slightly.

Generate the man-pages and add man/coredns-metadata.7 as well.

Signed-off-by: Miek Gieben <miek@miek.nl>

* Fix test

Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
Miek Gieben
2018-07-09 07:58:14 +01:00
committed by GitHub
parent b3a92f1622
commit b27a59c160
5 changed files with 86 additions and 15 deletions

View File

@@ -68,20 +68,23 @@ func TestLabelFormat(t *testing.T) {
label string
isValid bool
}{
// ok
{"plugin/LABEL", true},
{"p/LABEL", true},
{"plugin/L", true},
// fails
{"LABEL", false},
{"plugin.LABEL", false},
{"/NO-PLUGIN-NOT-ACCEPTED", false},
{"ONLY-PLUGIN-NOT-ACCEPTED/", false},
{"PLUGIN/LABEL/SUB-LABEL", false},
{"/", false},
{"//", false},
}
for _, test := range labels {
if IsLabel(test.label) != test.isValid {
t.Errorf("Label %v is expected to have this validaty : %v - and has the opposite", test.label, test.isValid)
if x := IsLabel(test.label); x != test.isValid {
t.Errorf("Label %v expected %v, got: %v", test.label, test.isValid, x)
}
}
}