Fix #170 - lookup backend for marathon plugin so we can specify traefik.backend via labels on the container
This commit is contained in:
parent
d3598021b7
commit
2d79c500df
3 changed files with 36 additions and 2 deletions
|
@ -800,3 +800,29 @@ func TestMarathonGetFrontendRule(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMarathonGetBackend(t *testing.T) {
|
||||
provider := &Marathon{}
|
||||
|
||||
applications := []struct {
|
||||
application marathon.Application
|
||||
expected string
|
||||
}{
|
||||
{
|
||||
application: marathon.Application{
|
||||
ID: "foo",
|
||||
Labels: map[string]string{
|
||||
"traefik.backend": "bar",
|
||||
},
|
||||
},
|
||||
expected: "bar",
|
||||
},
|
||||
}
|
||||
|
||||
for _, a := range applications {
|
||||
actual := provider.getBackend(a.application)
|
||||
if actual != a.expected {
|
||||
t.Fatalf("expected %q, got %q", a.expected, actual)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue