use of com.spotify.docker.client.messages.ContainerUpdate in project docker-client by spotify.
the class DefaultDockerClientTest method testUpdateContainer.
@Test
public void testUpdateContainer() throws Exception {
requireDockerApiVersionAtLeast("1.22", "update container");
final String containerName = randomName();
final HostConfig hostConfig = HostConfig.builder().cpuShares(256L).build();
final ContainerConfig config = ContainerConfig.builder().hostConfig(hostConfig).image(BUSYBOX_LATEST).build();
sut.pull(BUSYBOX_LATEST);
final ContainerCreation container = sut.createContainer(config, containerName);
final ContainerInfo containerInfo = sut.inspectContainer(container.id());
assertThat(containerInfo.hostConfig().cpuShares(), is(256L));
final HostConfig newHostConfig = HostConfig.builder().cpuShares(512L).build();
final ContainerUpdate containerUpdate = sut.updateContainer(containerInfo.id(), newHostConfig);
assertThat(containerUpdate.warnings(), is(nullValue()));
final ContainerInfo newContainerInfo = sut.inspectContainer(container.id());
assertThat(newContainerInfo.hostConfig().cpuShares(), is(512L));
}
Aggregations