FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix it2 by KostyaSha · Pull Request #621 · docker-java/docker-java · GitHub

Repository navigation

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (4) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItemInArray;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyString;
Expand Down Expand Up @@ -191,21 +192,24 @@ public void createContainerWithVolumesFrom() throws DockerException {

@Test
public void createContainerWithEnv() throws Exception {
final String testVariable = "VARIABLE=success";

CreateContainerResponse container = dockerClient.createContainerCmd(BUSYBOX_IMAGE).withEnv("VARIABLE=success")
.withCmd("env").exec();
CreateContainerResponse container = dockerClient.createContainerCmd(BUSYBOX_IMAGE)
.withEnv(testVariable)
.withCmd("env")
.exec();

LOG.info("Created container {}", container.toString());

assertThat(container.getId(), not(isEmptyString()));

InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec();

assertThat(Arrays.asList(inspectContainerResponse.getConfig().getEnv()), containsInAnyOrder("VARIABLE=success"));
assertThat(Arrays.asList(inspectContainerResponse.getConfig().getEnv()), hasItem(testVariable));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

arrays has two variables, so it should be hasItem


dockerClient.startContainerCmd(container.getId()).exec();

assertThat(containerLog(container.getId()), containsString("VARIABLE=success"));
assertThat(containerLog(container.getId()), containsString(testVariable));
}

@Test
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ public void updateContainer() throws DockerException, IOException {
// .withKernelMemory(52428800) Can not update kernel memory to a running container, please stop it first.
.exec();

// docker toolbox 1.10.1
assertThat(updateResponse.getWarnings(), hasSize(1));
assertThat(updateResponse.getWarnings().get(0),
is("Your kernel does not support Block I/O weight. Weight discarded."));
// true only on docker toolbox (1.10.1)
// assertThat(updateResponse.getWarnings(), hasSize(1));
// assertThat(updateResponse.getWarnings().get(0),
// is("Your kernel does not support Block I/O weight. Weight discarded."));

InspectContainerResponse inspectAfter = dockerClient.inspectContainerCmd(containerId).exec();
final HostConfig afterHostConfig = inspectAfter.getHostConfig();
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasItemInArray;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.isEmptyString;
Expand Down Expand Up @@ -189,21 +190,24 @@ public void createContainerWithVolumesFrom() throws DockerException {

@Test
public void createContainerWithEnv() throws Exception {
final String testVariable = "VARIABLE=success";

CreateContainerResponse container = dockerClient.createContainerCmd("busybox").withEnv("VARIABLE=success")
.withCmd("env").exec();
CreateContainerResponse container = dockerClient.createContainerCmd("busybox")
.withEnv(testVariable)
.withCmd("env")
.exec();

LOG.info("Created container {}", container.toString());

assertThat(container.getId(), not(isEmptyString()));

InspectContainerResponse inspectContainerResponse = dockerClient.inspectContainerCmd(container.getId()).exec();

assertThat(Arrays.asList(inspectContainerResponse.getConfig().getEnv()), containsInAnyOrder("VARIABLE=success"));
assertThat(Arrays.asList(inspectContainerResponse.getConfig().getEnv()), hasItem(testVariable));

dockerClient.startContainerCmd(container.getId()).exec();

assertThat(containerLog(container.getId()), containsString("VARIABLE=success"));
assertThat(containerLog(container.getId()), containsString(testVariable));
}

@Test
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,10 @@ public void updateContainer() throws DockerException, IOException {
// .withKernelMemory(52428800) Can not update kernel memory to a running container, please stop it first.
.exec();

// docker toolbox 1.10.1
assertThat(updateResponse.getWarnings(), hasSize(1));
assertThat(updateResponse.getWarnings().get(0),
is("Your kernel does not support Block I/O weight. Weight discarded."));
// found only on docker toolbox (1.10.1)
// assertThat(updateResponse.getWarnings(), hasSize(1));
// assertThat(updateResponse.getWarnings().get(0),
// is("Your kernel does not support Block I/O weight. Weight discarded."));

InspectContainerResponse inspectAfter = dockerClient.inspectContainerCmd(containerId).exec();
final HostConfig afterHostConfig = inspectAfter.getHostConfig();
Expand Down

Back | FazBrowse Home | New Git URL