1
0
Fork 0

Use docker-compose labels for frontend and backend names

This commit is contained in:
tcoupin 2017-03-04 13:31:07 +01:00 committed by Emile Vauge
parent df685fa050
commit 0a7f9b5a71
No known key found for this signature in database
GPG key ID: D808B4C167352E59
3 changed files with 49 additions and 1 deletions

View file

@ -44,6 +44,20 @@ func TestDockerGetFrontendName(t *testing.T) {
},
expected: "Headers-User-Agent-bat-0-1-0",
},
{
container: docker.ContainerJSON{
ContainerJSONBase: &docker.ContainerJSONBase{
Name: "mycontainer",
},
Config: &container.Config{
Labels: map[string]string{
"com.docker.compose.project": "foo",
"com.docker.compose.service": "bar",
},
},
},
expected: "Host-foo-bar-docker-localhost",
},
{
container: docker.ContainerJSON{
ContainerJSONBase: &docker.ContainerJSONBase{
@ -133,6 +147,19 @@ func TestDockerGetFrontendRule(t *testing.T) {
},
},
expected: "Host:foo.bar",
}, {
container: docker.ContainerJSON{
ContainerJSONBase: &docker.ContainerJSONBase{
Name: "test",
},
Config: &container.Config{
Labels: map[string]string{
"com.docker.compose.project": "foo",
"com.docker.compose.service": "bar",
},
},
},
expected: "Host:foo-bar.docker.localhost",
},
{
container: docker.ContainerJSON{
@ -196,6 +223,20 @@ func TestDockerGetBackend(t *testing.T) {
},
expected: "foobar",
},
{
container: docker.ContainerJSON{
ContainerJSONBase: &docker.ContainerJSONBase{
Name: "test",
},
Config: &container.Config{
Labels: map[string]string{
"com.docker.compose.project": "foo",
"com.docker.compose.service": "bar",
},
},
},
expected: "foo-bar",
},
}
for _, e := range containers {