Update some docker provider test

- Split the file into smaller ones (docker, swarm and service tests)
- Use some builder to reduce a little bit the noise for creating containers

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2017-04-15 16:46:44 +02:00
parent 3f293ee25b
commit b04ba36682
7 changed files with 1797 additions and 2565 deletions

View file

@ -51,6 +51,7 @@ func (p *BaseProvider) MatchConstraints(tags []string) (bool, *types.Constraint)
return true, nil
}
// GetConfiguration return the provider configuration using templating
func (p *BaseProvider) GetConfiguration(defaultTemplateFile string, funcMap template.FuncMap, templateObjects interface{}) (*types.Configuration, error) {
var (
buf []byte
@ -60,7 +61,7 @@ func (p *BaseProvider) GetConfiguration(defaultTemplateFile string, funcMap temp
var defaultFuncMap = template.FuncMap{
"replace": replace,
"tolower": strings.ToLower,
"Normalize": Normalize,
"normalize": Normalize,
"split": split,
"contains": contains,
}
@ -112,6 +113,7 @@ func split(sep, s string) []string {
return strings.Split(s, sep)
}
// Normalize transform a string that work with the rest of traefik
func Normalize(name string) string {
fargs := func(c rune) bool {
return !unicode.IsLetter(c) && !unicode.IsNumber(c)