Add per-service env vars for *_SERVICE_HOST

As a replacement of a single SERVICE_HOST variable, offer a FOO_SERVICE_HOST
variable.  This will help ease the transition to ip-per-service, where there
is no longer a single service host.

# *** ERROR: *** Some files are missing the required boilerplate
# header from hooks/boilerplate.txt:
#   examples/guestbook/redis-slave/run.sh
#
# Your commit will be aborted unless you fix these.
#   COMMIT_BLOCKED_ON_BOILERPLATE
This commit is contained in:
Tim Hockin
2014-09-23 13:14:33 -07:00
parent 88fdb659bc
commit 089c5602fd
6 changed files with 29 additions and 15 deletions

View File

@@ -94,6 +94,10 @@ func TestMakeManifestServices(t *testing.T) {
container := manifest.Containers[0]
envs := []api.EnvVar{
{
Name: "TEST_SERVICE_HOST",
Value: "machine",
},
{
Name: "TEST_SERVICE_PORT",
Value: "8080",
@@ -123,8 +127,8 @@ func TestMakeManifestServices(t *testing.T) {
Value: "machine",
},
}
if len(container.Env) != 7 {
t.Errorf("Expected 7 env vars, got %d: %#v", len(container.Env), manifest)
if len(container.Env) != len(envs) {
t.Errorf("Expected %d env vars, got %d: %#v", len(envs), len(container.Env), manifest)
return
}
for ix := range container.Env {
@@ -180,6 +184,10 @@ func TestMakeManifestServicesExistingEnvVar(t *testing.T) {
Name: "foo",
Value: "bar",
},
{
Name: "TEST_SERVICE_HOST",
Value: "machine",
},
{
Name: "TEST_SERVICE_PORT",
Value: "8080",
@@ -209,8 +217,8 @@ func TestMakeManifestServicesExistingEnvVar(t *testing.T) {
Value: "machine",
},
}
if len(container.Env) != 8 {
t.Errorf("Expected 8 env vars, got: %#v", manifest)
if len(container.Env) != len(envs) {
t.Errorf("Expected %d env vars, got: %#v", len(envs), manifest)
return
}
for ix := range container.Env {