mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 18:05:42 +03:00
Fixed the client tests
This commit is contained in:
10
client/driver/env/env.go
vendored
10
client/driver/env/env.go
vendored
@@ -136,11 +136,13 @@ func (t *TaskEnvironment) Build() *TaskEnvironment {
|
||||
for label, value := range network.MapLabelToValues(nil) {
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", IpPrefix, label)] = network.IP
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", HostPortPrefix, label)] = strconv.Itoa(value)
|
||||
if value, ok := t.PortMap[label]; ok {
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", PortPrefix, label)] = fmt.Sprintf("%d", value)
|
||||
IPPort := fmt.Sprintf("%s:%d", network.IP, value)
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", AddrPrefix, label)] = IPPort
|
||||
if forwardedPort, ok := t.PortMap[label]; ok {
|
||||
value = forwardedPort
|
||||
}
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", PortPrefix, label)] = fmt.Sprintf("%d", value)
|
||||
IPPort := fmt.Sprintf("%s:%d", network.IP, value)
|
||||
t.TaskEnv[fmt.Sprintf("%s%s", AddrPrefix, label)] = IPPort
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
client/driver/env/env_test.go
vendored
9
client/driver/env/env_test.go
vendored
@@ -151,7 +151,8 @@ func TestEnvironment_AsList(t *testing.T) {
|
||||
"NOMAD_ADDR_https=127.0.0.1:443",
|
||||
"NOMAD_PORT_https=443",
|
||||
"NOMAD_IP_https=127.0.0.1",
|
||||
"NOMAD_HOST_PORT_https=443",
|
||||
"NOMAD_HOST_PORT_http=80",
|
||||
"NOMAD_HOST_PORT_https=8080",
|
||||
"NOMAD_META_FOO=baz",
|
||||
"NOMAD_META_BAZ=bam",
|
||||
}
|
||||
@@ -177,7 +178,8 @@ func TestEnvironment_ClearEnvvars(t *testing.T) {
|
||||
"NOMAD_ADDR_https=127.0.0.1:443",
|
||||
"NOMAD_PORT_https=443",
|
||||
"NOMAD_IP_https=127.0.0.1",
|
||||
"NOMAD_HOST_PORT_https=443",
|
||||
"NOMAD_HOST_PORT_http=80",
|
||||
"NOMAD_HOST_PORT_https=8080",
|
||||
"bar=bang",
|
||||
"foo=baz",
|
||||
}
|
||||
@@ -198,7 +200,8 @@ func TestEnvironment_ClearEnvvars(t *testing.T) {
|
||||
"NOMAD_ADDR_https=127.0.0.1:443",
|
||||
"NOMAD_PORT_https=443",
|
||||
"NOMAD_IP_https=127.0.0.1",
|
||||
"NOMAD_HOST_PORT_https=443",
|
||||
"NOMAD_HOST_PORT_https=8080",
|
||||
"NOMAD_HOST_PORT_http=80",
|
||||
}
|
||||
sort.Strings(act)
|
||||
sort.Strings(exp)
|
||||
|
||||
Reference in New Issue
Block a user