1
0
Fork 0

feat(kv): add more tests.

This commit is contained in:
Fernandez Ludovic 2018-01-03 16:49:53 +01:00 committed by Traefiker
parent 944008661f
commit b9f1f7752d
2 changed files with 157 additions and 9 deletions

View file

@ -121,6 +121,26 @@ func TestFiller(t *testing.T) {
{Key: "traefik/backends/backend.with.dot.too/servers/server.with.dot/weight", Value: []byte("0")},
{Key: "traefik/frontends/frontend.with.dot", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/backend", Value: []byte("backend.with.dot.too")},
{Key: "traefik/frontends/frontend.with.dot/errors", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/errors/bar", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/errors/bar/backend", Value: []byte("error")},
{Key: "traefik/frontends/frontend.with.dot/errors/bar/query", Value: []byte("/test2")},
{Key: "traefik/frontends/frontend.with.dot/errors/bar/status", Value: []byte("400-405")},
{Key: "traefik/frontends/frontend.with.dot/errors/foo", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/errors/foo/backend", Value: []byte("error")},
{Key: "traefik/frontends/frontend.with.dot/errors/foo/query", Value: []byte("/test1")},
{Key: "traefik/frontends/frontend.with.dot/errors/foo/status", Value: []byte("500-501, 503-599")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/extractorfunc", Value: []byte("client.ip")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/bar", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/bar/average", Value: []byte("3")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/bar/burst", Value: []byte("6")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/bar/period", Value: []byte("9")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/foo", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/foo/average", Value: []byte("6")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/foo/burst", Value: []byte("12")},
{Key: "traefik/frontends/frontend.with.dot/ratelimit/rateset/foo/period", Value: []byte("18")},
{Key: "traefik/frontends/frontend.with.dot/routes", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/routes/route.with.dot", Value: []byte("")},
{Key: "traefik/frontends/frontend.with.dot/routes/route.with.dot/rule", Value: []byte("Host:test.localhost")},
@ -129,7 +149,12 @@ func TestFiller(t *testing.T) {
pairs1 := filler("traefik",
frontend("frontend.with.dot",
withPair("backend", "backend.with.dot.too"),
withPair("routes/route.with.dot/rule", "Host:test.localhost")),
withPair("routes/route.with.dot/rule", "Host:test.localhost"),
withErrorPage("foo", "error", "/test1", "500-501, 503-599"),
withErrorPage("bar", "error", "/test2", "400-405"),
withRateLimit("client.ip",
withLimit("foo", "6", "12", "18"),
withLimit("bar", "3", "6", "9"))),
backend("backend.with.dot.too",
withPair("servers/server.with.dot/url", "http://172.17.0.2:80"),
withPair("servers/server.with.dot/weight", "0"),
@ -140,7 +165,20 @@ func TestFiller(t *testing.T) {
pairs2 := filler("traefik",
entry("frontends/frontend.with.dot",
withPair("backend", "backend.with.dot.too"),
withPair("routes/route.with.dot/rule", "Host:test.localhost")),
withPair("routes/route.with.dot/rule", "Host:test.localhost"),
withPair("errors/foo/backend", "error"),
withPair("errors/foo/query", "/test1"),
withPair("errors/foo/status", "500-501, 503-599"),
withPair("errors/bar/backend", "error"),
withPair("errors/bar/query", "/test2"),
withPair("errors/bar/status", "400-405"),
withPair("ratelimit/extractorfunc", "client.ip"),
withPair("ratelimit/rateset/foo/average", "6"),
withPair("ratelimit/rateset/foo/burst", "12"),
withPair("ratelimit/rateset/foo/period", "18"),
withPair("ratelimit/rateset/bar/average", "3"),
withPair("ratelimit/rateset/bar/burst", "6"),
withPair("ratelimit/rateset/bar/period", "9")),
entry("backends/backend.with.dot.too",
withPair("servers/server.with.dot/url", "http://172.17.0.2:80"),
withPair("servers/server.with.dot/weight", "0"),