Fix docker-links-style env vars for services

This includes 3 changes:

1) Use the Service.Protocol field, rather than hardcoding TCP.
2) Use Service.Port rather than ContainerPort - ContainerPort can be a string
   and has absolutely no meaning to consumers.
3) Beef up tests for these env vars.
This commit is contained in:
Tim Hockin
2014-09-24 12:29:06 -07:00
parent 089c5602fd
commit b2472d8bec
3 changed files with 67 additions and 27 deletions

View File

@@ -107,19 +107,19 @@ func TestMakeManifestServices(t *testing.T) {
Value: "tcp://machine:8080",
},
{
Name: "TEST_PORT_900_TCP",
Name: "TEST_PORT_8080_TCP",
Value: "tcp://machine:8080",
},
{
Name: "TEST_PORT_900_TCP_PROTO",
Name: "TEST_PORT_8080_TCP_PROTO",
Value: "tcp",
},
{
Name: "TEST_PORT_900_TCP_PORT",
Name: "TEST_PORT_8080_TCP_PORT",
Value: "8080",
},
{
Name: "TEST_PORT_900_TCP_ADDR",
Name: "TEST_PORT_8080_TCP_ADDR",
Value: "machine",
},
{
@@ -197,19 +197,19 @@ func TestMakeManifestServicesExistingEnvVar(t *testing.T) {
Value: "tcp://machine:8080",
},
{
Name: "TEST_PORT_900_TCP",
Name: "TEST_PORT_8080_TCP",
Value: "tcp://machine:8080",
},
{
Name: "TEST_PORT_900_TCP_PROTO",
Name: "TEST_PORT_8080_TCP_PROTO",
Value: "tcp",
},
{
Name: "TEST_PORT_900_TCP_PORT",
Name: "TEST_PORT_8080_TCP_PORT",
Value: "8080",
},
{
Name: "TEST_PORT_900_TCP_ADDR",
Name: "TEST_PORT_8080_TCP_ADDR",
Value: "machine",
},
{