Skip to content
This repository has been archived by the owner on Mar 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #796 from fdonze/swarm-join
Browse files Browse the repository at this point in the history
Update SwarmJoin non/nullable fields
  • Loading branch information
davidxia authored Jun 27, 2017
2 parents 85d9cf0 + f1a9234 commit 3182712
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@ public abstract class SwarmJoin {
@JsonProperty("ListenAddr")
public abstract String listenAddr();

@Nullable
@JsonProperty("AdvertiseAddr")
public abstract String advertiseAddr();

@Nullable
@JsonProperty("RemoteAddrs")
public abstract List<String> remoteAddrs();

@Nullable
@JsonProperty("JoinToken")
public abstract String joinToken();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@
import com.spotify.docker.client.messages.swarm.NodeInfo;
import com.spotify.docker.client.messages.swarm.NodeSpec;
import com.spotify.docker.client.messages.swarm.ServiceSpec;
import com.spotify.docker.client.messages.swarm.SwarmJoin;
import com.spotify.docker.client.messages.swarm.TaskSpec;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -484,6 +486,22 @@ public void testUpdateNonSwarmNode() throws Exception {
dockerClient.updateNode("24ifsmvkjbyhk", 8L, nodeSpec);
}

@Test
public void testJoinSwarm() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);

enqueueServerApiVersion("1.24");
enqueueServerApiEmptyResponse(200);

SwarmJoin swarmJoin = SwarmJoin.builder()
.joinToken("token_foo")
.listenAddr("0.0.0.0:2377")
.remoteAddrs(Arrays.asList("10.0.0.10:2377"))
.build();

dockerClient.joinSwarm(swarmJoin);
}

private void enqueueServerApiError(final int statusCode, String message) throws IOException {
final ObjectNode errorMessage = createObjectNode()
.put("message", message);
Expand Down

0 comments on commit 3182712

Please sign in to comment.