Restrict traefik.toml to static configuration.

This commit is contained in:
Ludovic Fernandez 2019-07-15 10:22:03 +02:00 committed by Traefiker Bot
parent f49800e56a
commit 093658836e
78 changed files with 274 additions and 440 deletions

View file

@ -20,7 +20,6 @@ type ProvideTestCase struct {
desc string
directoryPaths []string
filePath string
traefikFilePath string
expectedNumRouter int
expectedNumService int
expectedNumTLSConf int
@ -131,11 +130,6 @@ func TestProvideWithWatch(t *testing.T) {
require.NoError(t, err)
}
if len(test.traefikFilePath) > 0 {
err := copyFile(test.traefikFilePath, provider.TraefikFile)
require.NoError(t, err)
}
if len(test.directoryPaths) > 0 {
for i, filePath := range test.directoryPaths {
err := copyFile(filePath, filepath.Join(provider.Directory, strconv.Itoa(i)+filepath.Ext(filePath)))
@ -181,36 +175,6 @@ func getTestCases() []ProvideTestCase {
expectedNumService: 6,
expectedNumTLSConf: 5,
},
{
desc: "simple file and a traefik file",
filePath: "./fixtures/toml/simple_file_02.toml",
traefikFilePath: "./fixtures/toml/simple_traefik_file_01.toml",
expectedNumRouter: 4,
expectedNumService: 8,
expectedNumTLSConf: 4,
},
{
desc: "simple file and a traefik file yaml",
filePath: "./fixtures/yaml/simple_file_02.yml",
traefikFilePath: "./fixtures/yaml/simple_traefik_file_01.yml",
expectedNumRouter: 4,
expectedNumService: 8,
expectedNumTLSConf: 4,
},
{
desc: "simple traefik file",
traefikFilePath: "./fixtures/toml/simple_traefik_file_02.toml",
expectedNumRouter: 2,
expectedNumService: 3,
expectedNumTLSConf: 4,
},
{
desc: "simple traefik file yaml",
traefikFilePath: "./fixtures/yaml/simple_traefik_file_02.yml",
expectedNumRouter: 2,
expectedNumService: 3,
expectedNumTLSConf: 4,
},
{
desc: "template file",
filePath: "./fixtures/toml/template_file.toml",
@ -221,13 +185,6 @@ func getTestCases() []ProvideTestCase {
filePath: "./fixtures/yaml/template_file.yml",
expectedNumRouter: 20,
},
{
desc: "simple traefik file with templating",
traefikFilePath: "./fixtures/toml/simple_traefik_file_with_templating.toml",
expectedNumRouter: 2,
expectedNumService: 3,
expectedNumTLSConf: 4,
},
{
desc: "simple directory",
directoryPaths: []string{
@ -304,21 +261,6 @@ func createProvider(t *testing.T, test ProvideTestCase, watch bool) (*Provider,
provider.Filename = file.Name()
}
if len(test.traefikFilePath) > 0 {
var file *os.File
if watch {
var err error
file, err = ioutil.TempFile(tempDir, "temp*"+filepath.Ext(test.traefikFilePath))
require.NoError(t, err)
} else {
var err error
file, err = createTempFile(test.traefikFilePath, tempDir)
require.NoError(t, err)
}
provider.TraefikFile = file.Name()
}
return provider, func() {
os.RemoveAll(tempDir)
}