1
0
Fork 0

Use index-based syntax in KV tests.

This commit is contained in:
Ludovic Fernandez 2018-05-22 12:30:03 +02:00 committed by Traefiker Bot
parent e2bac47a0a
commit 3c8c5ebb96
2 changed files with 31 additions and 19 deletions

View file

@ -93,15 +93,15 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair(pathFrontendPriority, "6"),
withPair(pathFrontendPassHostHeader, "false"),
withPair(pathFrontendPassTLSCert, "true"),
withPair(pathFrontendEntryPoints, "http,https"),
withPair(pathFrontendWhiteListSourceRange, "1.1.1.1/24, 1234:abcd::42/32"),
withList(pathFrontendEntryPoints, "http", "https"),
withList(pathFrontendWhiteListSourceRange, "1.1.1.1/24", "1234:abcd::42/32"),
withPair(pathFrontendWhiteListUseXForwardedFor, "true"),
withPair(pathFrontendBasicAuth, "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/, test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"),
withList(pathFrontendBasicAuth, "test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"),
withPair(pathFrontendRedirectEntryPoint, "https"),
withPair(pathFrontendRedirectRegex, "nope"),
withPair(pathFrontendRedirectReplacement, "nope"),
withPair(pathFrontendRedirectPermanent, "true"),
withErrorPage("foo", "error", "/test1", "500-501, 503-599"),
withErrorPage("foo", "error", "/test1", "500-501", "503-599"),
withErrorPage("bar", "error", "/test2", "400-405"),
withRateLimit("client.ip",
withLimit("foo", "6", "12", "18"),
@ -117,7 +117,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair(pathFrontendSSLProxyHeaders+"Content-Type", "application/json; charset=utf-8"),
withPair(pathFrontendSSLProxyHeaders+"X-Custom-Header", "test"),
withPair(pathFrontendAllowedHosts, "example.com, ssl.example.com"),
withPair(pathFrontendHostsProxyHeaders, "foo, bar, goo, hor"),
withList(pathFrontendHostsProxyHeaders, "foo", "bar", "goo", "hor"),
withPair(pathFrontendSTSSeconds, "666"),
withPair(pathFrontendSSLHost, "foo"),
withPair(pathFrontendCustomFrameOptionsValue, "foo"),
@ -139,11 +139,11 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair("routes/route1/rule", "Host:test.localhost"),
withPair("routes/route2/rule", "Path:/foo")),
entry("tls/foo",
withPair("entrypoints", "http,https"),
withList("entrypoints", "http", "https"),
withPair("certificate/certfile", "certfile1"),
withPair("certificate/keyfile", "keyfile1")),
entry("tls/bar",
withPair("entrypoints", "http,https"),
withList("entrypoints", "http", "https"),
withPair("certificate/certfile", "certfile2"),
withPair("certificate/keyfile", "keyfile2")),
),
@ -682,10 +682,7 @@ func TestProviderGetSlice(t *testing.T) {
desc: "multiple entries",
kvPairs: filler("traefik",
frontend("foo",
withPair("entrypoints/0", "courgette"),
withPair("entrypoints/1", "carotte"),
withPair("entrypoints/2", "tomate"),
withPair("entrypoints/3", "aubergine"),
withList("entrypoints", "courgette", "carotte", "tomate", "aubergine"),
),
),
keyParts: []string{"traefik/frontends/foo/entrypoints"},
@ -1210,7 +1207,7 @@ func TestProviderGetErrorPages(t *testing.T) {
rootPath: "traefik/frontends/foo",
kvPairs: filler("traefik",
frontend("foo",
withErrorPage("foo", "error", "/test1", "500-501, 503-599"),
withErrorPage("foo", "error", "/test1", "500-501", "503-599"),
withErrorPage("bar", "error", "/test2", "400-405"))),
expected: map[string]*types.ErrorPage{
"foo": {