Move dynamic config into a dedicated package.

This commit is contained in:
Ludovic Fernandez 2019-07-10 09:26:04 +02:00 committed by Traefiker Bot
parent 09cc1161c9
commit c8bf8e896a
102 changed files with 3170 additions and 3166 deletions

View file

@ -5,7 +5,7 @@ import (
"net/http"
"testing"
"github.com/containous/traefik/pkg/config"
"github.com/containous/traefik/pkg/config/dynamic"
"github.com/containous/traefik/pkg/middlewares/replacepath"
"github.com/containous/traefik/pkg/testhelpers"
"github.com/stretchr/testify/assert"
@ -16,7 +16,7 @@ func TestReplacePathRegex(t *testing.T) {
testCases := []struct {
desc string
path string
config config.ReplacePathRegex
config dynamic.ReplacePathRegex
expectedPath string
expectedHeader string
expectsError bool
@ -24,7 +24,7 @@ func TestReplacePathRegex(t *testing.T) {
{
desc: "simple regex",
path: "/whoami/and/whoami",
config: config.ReplacePathRegex{
config: dynamic.ReplacePathRegex{
Replacement: "/who-am-i/$1",
Regex: `^/whoami/(.*)`,
},
@ -34,7 +34,7 @@ func TestReplacePathRegex(t *testing.T) {
{
desc: "simple replace (no regex)",
path: "/whoami/and/whoami",
config: config.ReplacePathRegex{
config: dynamic.ReplacePathRegex{
Replacement: "/who-am-i",
Regex: `/whoami`,
},
@ -44,7 +44,7 @@ func TestReplacePathRegex(t *testing.T) {
{
desc: "no match",
path: "/whoami/and/whoami",
config: config.ReplacePathRegex{
config: dynamic.ReplacePathRegex{
Replacement: "/whoami",
Regex: `/no-match`,
},
@ -53,7 +53,7 @@ func TestReplacePathRegex(t *testing.T) {
{
desc: "multiple replacement",
path: "/downloads/src/source.go",
config: config.ReplacePathRegex{
config: dynamic.ReplacePathRegex{
Replacement: "/downloads/$1-$2",
Regex: `^(?i)/downloads/([^/]+)/([^/]+)$`,
},
@ -63,7 +63,7 @@ func TestReplacePathRegex(t *testing.T) {
{
desc: "invalid regular expression",
path: "/invalid/regexp/test",
config: config.ReplacePathRegex{
config: dynamic.ReplacePathRegex{
Replacement: "/valid/regexp/$1",
Regex: `^(?err)/invalid/regexp/([^/]+)$`,
},