Use docker-compose labels for frontend and backend names
This commit is contained in:
parent
df685fa050
commit
0a7f9b5a71
3 changed files with 49 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue