use of com.spotify.docker.client.messages.swarm.ConfigSpec in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testCreateConfig_NonSwarmNode.
@Test(expected = NonSwarmNodeException.class)
public void testCreateConfig_NonSwarmNode() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(503).addHeader("Content-Type", "application/json"));
final ConfigSpec configSpec = ConfigSpec.builder().data(Base64.encodeAsString("foobar")).name("foo.yaml").build();
dockerClient.createConfig(configSpec);
}
use of com.spotify.docker.client.messages.swarm.ConfigSpec in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testListConfigs.
@Test
public void testListConfigs() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(200).addHeader("Content-Type", "application/json").setBody(fixture("fixtures/1.30/listConfigs.json")));
final List<Config> configs = dockerClient.listConfigs();
assertThat(configs.size(), equalTo(1));
final Config config = configs.get(0);
assertThat(config, notNullValue());
assertThat(config.id(), equalTo("ktnbjxoalbkvbvedmg1urrz8h"));
assertThat(config.version().index(), equalTo(11L));
final ConfigSpec configSpec = config.configSpec();
assertThat(configSpec.name(), equalTo("server.conf"));
}
use of com.spotify.docker.client.messages.swarm.ConfigSpec in project docker-client by spotify.
the class DefaultDockerClientUnitTest method testCreateConfig.
@Test
public void testCreateConfig() throws Exception {
final DefaultDockerClient dockerClient = new DefaultDockerClient(builder);
enqueueServerApiVersion("1.30");
server.enqueue(new MockResponse().setResponseCode(201).addHeader("Content-Type", "application/json").setBody(fixture("fixtures/1.30/inspectConfig.json")));
final ConfigSpec configSpec = ConfigSpec.builder().data(Base64.encodeAsString("foobar")).name("foo.yaml").build();
final ConfigCreateResponse configCreateResponse = dockerClient.createConfig(configSpec);
assertThat(configCreateResponse.id(), equalTo("ktnbjxoalbkvbvedmg1urrz8h"));
}
Aggregations