mirror of https://github.com/docker/cli.git
Allow publishing same port as UDP and TCP using docker stack deploy(Trying tests)
Signed-off-by: adeniyistephen <adeniyistadz@gmail.com>
This commit is contained in:
parent
c20be83d6b
commit
b1b56b80c2
|
@ -111,7 +111,7 @@ func toServicePortConfigsMap(s interface{}) (map[interface{}]interface{}, error)
|
||||||
}
|
}
|
||||||
m := map[interface{}]interface{}{}
|
m := map[interface{}]interface{}{}
|
||||||
for _, p := range ports {
|
for _, p := range ports {
|
||||||
m[p.Published] = p
|
m[p] = p
|
||||||
}
|
}
|
||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,10 @@ func TestLoadMultipleServicePorts(t *testing.T) {
|
||||||
name: "no_override",
|
name: "no_override",
|
||||||
portBase: map[string]interface{}{
|
portBase: map[string]interface{}{
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8080:80",
|
Mode: "ingress",
|
||||||
|
Published: 8080,
|
||||||
|
Target: 80,
|
||||||
|
Protocol: "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
portOverride: map[string]interface{}{},
|
portOverride: map[string]interface{}{},
|
||||||
|
@ -254,12 +257,18 @@ func TestLoadMultipleServicePorts(t *testing.T) {
|
||||||
name: "override_different_published",
|
name: "override_different_published",
|
||||||
portBase: map[string]interface{}{
|
portBase: map[string]interface{}{
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8080:80",
|
Mode: "ingress",
|
||||||
|
Published: 8080,
|
||||||
|
Target: 80,
|
||||||
|
Protocol: "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
portOverride: map[string]interface{}{
|
portOverride: map[string]interface{}{
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8081:80",
|
Mode: "ingress",
|
||||||
|
Published: 8081,
|
||||||
|
Target: 80,
|
||||||
|
Protocol: "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: []types.ServicePortConfig{
|
expected: []types.ServicePortConfig{
|
||||||
|
@ -281,12 +290,18 @@ func TestLoadMultipleServicePorts(t *testing.T) {
|
||||||
name: "override_same_published",
|
name: "override_same_published",
|
||||||
portBase: map[string]interface{}{
|
portBase: map[string]interface{}{
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8080:80",
|
Mode: "ingress",
|
||||||
|
Published: 8080,
|
||||||
|
Target: 80,
|
||||||
|
Protocol: "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
portOverride: map[string]interface{}{
|
portOverride: map[string]interface{}{
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8080:81",
|
Mode: "ingress",
|
||||||
|
Published: 8080,
|
||||||
|
Target: 81,
|
||||||
|
Protocol: "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
expected: []types.ServicePortConfig{
|
expected: []types.ServicePortConfig{
|
||||||
|
@ -843,8 +858,18 @@ func TestLoadMultipleConfigs(t *testing.T) {
|
||||||
"dockerfile": "bar.Dockerfile",
|
"dockerfile": "bar.Dockerfile",
|
||||||
},
|
},
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
"8080:80",
|
{
|
||||||
"9090:90",
|
Mode: "ingress",
|
||||||
|
Published: 8080,
|
||||||
|
Target: 80,
|
||||||
|
Protocol: "tcp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
Mode: "ingress",
|
||||||
|
Published: 9090,
|
||||||
|
Target: 90,
|
||||||
|
Protocol: "tcp",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"labels": []interface{}{
|
"labels": []interface{}{
|
||||||
"foo=bar",
|
"foo=bar",
|
||||||
|
@ -873,8 +898,10 @@ func TestLoadMultipleConfigs(t *testing.T) {
|
||||||
},
|
},
|
||||||
"ports": []interface{}{
|
"ports": []interface{}{
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
|
"Mode": "ingress",
|
||||||
"target": 81,
|
"target": 81,
|
||||||
"published": 8080,
|
"published": 8080,
|
||||||
|
"Protocol": "tcp",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"labels": map[string]interface{}{
|
"labels": map[string]interface{}{
|
||||||
|
|
Loading…
Reference in New Issue