middleware/auto: add (#333)
Add auto-load middleware that automatically picks up zones. Every X seconds it will scan for new zones. Add tests and documentation. Make 'make test' use -race.
This commit is contained in:
parent
2eafe3ee94
commit
d536272201
19 changed files with 838 additions and 18 deletions
20
middleware/auto/regexp_test.go
Normal file
20
middleware/auto/regexp_test.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package auto
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestRewriteToExpand(t *testing.T) {
|
||||
tests := []struct {
|
||||
in string
|
||||
expected string
|
||||
}{
|
||||
{in: "", expected: ""},
|
||||
{in: "{1}", expected: "${1}"},
|
||||
{in: "{1", expected: "${1"},
|
||||
}
|
||||
for i, tc := range tests {
|
||||
got := rewriteToExpand(tc.in)
|
||||
if got != tc.expected {
|
||||
t.Errorf("Test %d: Expected error %v, but got %v", i, tc.expected, got)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue