The TestAPIServiceUpdatePort test performs exactly
the same steps.
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -11,41 +11,6 @@ import ( |
| 11 | 11 |
"github.com/go-check/check" |
| 12 | 12 |
) |
| 13 | 13 |
|
| 14 |
-func (s *DockerSwarmSuite) TestServiceUpdatePort(c *check.C) {
|
|
| 15 |
- d := s.AddDaemon(c, true, true) |
|
| 16 |
- |
|
| 17 |
- serviceName := "TestServiceUpdatePort" |
|
| 18 |
- serviceArgs := append([]string{"service", "create", "--detach", "--no-resolve-image", "--name", serviceName, "-p", "8080:8081", defaultSleepImage}, sleepCommandForDaemonPlatform()...)
|
|
| 19 |
- |
|
| 20 |
- // Create a service with a port mapping of 8080:8081. |
|
| 21 |
- out, err := d.Cmd(serviceArgs...) |
|
| 22 |
- c.Assert(err, checker.IsNil) |
|
| 23 |
- waitAndAssert(c, defaultReconciliationTimeout, d.CheckActiveContainerCount, checker.Equals, 1) |
|
| 24 |
- |
|
| 25 |
- // Update the service: changed the port mapping from 8080:8081 to 8082:8083. |
|
| 26 |
- _, err = d.Cmd("service", "update", "--detach", "--publish-add", "8082:8083", "--publish-rm", "8081", serviceName)
|
|
| 27 |
- c.Assert(err, checker.IsNil) |
|
| 28 |
- |
|
| 29 |
- // Inspect the service and verify port mapping |
|
| 30 |
- expected := []swarm.PortConfig{
|
|
| 31 |
- {
|
|
| 32 |
- Protocol: "tcp", |
|
| 33 |
- PublishedPort: 8082, |
|
| 34 |
- TargetPort: 8083, |
|
| 35 |
- PublishMode: "ingress", |
|
| 36 |
- }, |
|
| 37 |
- } |
|
| 38 |
- |
|
| 39 |
- out, err = d.Cmd("service", "inspect", "--format", "{{ json .Spec.EndpointSpec.Ports }}", serviceName)
|
|
| 40 |
- c.Assert(err, checker.IsNil) |
|
| 41 |
- |
|
| 42 |
- var portConfig []swarm.PortConfig |
|
| 43 |
- if err := json.Unmarshal([]byte(out), &portConfig); err != nil {
|
|
| 44 |
- c.Fatalf("invalid JSON in inspect result: %v (%s)", err, out)
|
|
| 45 |
- } |
|
| 46 |
- c.Assert(portConfig, checker.DeepEquals, expected) |
|
| 47 |
-} |
|
| 48 |
- |
|
| 49 | 14 |
func (s *DockerSwarmSuite) TestServiceUpdateLabel(c *check.C) {
|
| 50 | 15 |
d := s.AddDaemon(c, true, true) |
| 51 | 16 |
out, err := d.Cmd("service", "create", "--detach", "--no-resolve-image", "--name=test", "busybox", "top")
|