1
0
Fork 0

feat(rancher): added constraint management for rancher provider

This commit is contained in:
Youcef Yekhlef 2017-05-02 16:51:02 +02:00 committed by Fernandez Ludovic
parent b5283391dd
commit 8de107866f
4 changed files with 34 additions and 0 deletions

View file

@ -15,6 +15,9 @@ func TestRancherServiceFilter(t *testing.T) {
EnableServiceHealthFilter: true,
}
constraint, _ := types.NewConstraint("tag==ch*se")
provider.Constraints = types.Constraints{constraint}
services := []struct {
service rancherData
expected bool
@ -54,6 +57,7 @@ func TestRancherServiceFilter(t *testing.T) {
{
service: rancherData{
Labels: map[string]string{
"traefik.tags": "not-cheesy",
"traefik.port": "80",
"traefik.enable": "true",
},
@ -65,6 +69,7 @@ func TestRancherServiceFilter(t *testing.T) {
{
service: rancherData{
Labels: map[string]string{
"traefik.tags": "cheese",
"traefik.port": "80",
"traefik.enable": "true",
},
@ -76,6 +81,7 @@ func TestRancherServiceFilter(t *testing.T) {
{
service: rancherData{
Labels: map[string]string{
"traefik.tags": "cheeeeese",
"traefik.port": "80",
"traefik.enable": "true",
},
@ -84,6 +90,18 @@ func TestRancherServiceFilter(t *testing.T) {
},
expected: true,
},
{
service: rancherData{
Labels: map[string]string{
"traefik.tags": "chose",
"traefik.port": "80",
"traefik.enable": "true",
},
Health: "healthy",
State: "active",
},
expected: true,
},
}
for _, e := range services {