Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine DB container tests into single module, and improve error handling/display #243

Merged
merged 6 commits into from
Nov 19, 2016

Conversation

rnorth
Copy link
Member

@rnorth rnorth commented Nov 17, 2016

This PR was created on top of #242, and should be merged after that.

This change includes what was previously covered by #242: Refactoring of all DB container tests into a single separate module. The idea is that this will make it easier to reduce duplication between tests in the future. Along the way, some reliability issues with DB containers have been worked on:

This also goes through a few places where unnecessary stack traces or errors were indicated during tests. It emerged that some behaviour (container reaper and exec-based liveness checks) were running against stopped or deleted containers, causing loud error logging from docker-java.

@@ -815,6 +815,10 @@ public ExecResult execInContainer(Charset outputCharset, String... command)

}

if (!isRunning()) {
Copy link
Member

Choose a reason for hiding this comment

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

nice catch!

@@ -67,6 +68,8 @@ public void registerContainerForCleanup(String containerId, String imageName) {
*/
public void stopAndRemoveContainer(String containerId) {
stopContainer(containerId, registeredContainers.get(containerId));

registeredContainers.remove(containerId);
Copy link
Member

Choose a reason for hiding this comment

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

maybe we should do it in finally {} block?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually even though it's a little brittle I'd prefer to keep it that way. If stopContainer fails for some reason, my feeling is that it's slightly better to potentially try again by leaving the containerId in the registered set.

@@ -83,6 +86,13 @@ public void stopAndRemoveContainer(String containerId, String imageName) {

private void stopContainer(String containerId, String imageName) {

List<Container> allContainers = dockerClient.listContainersCmd().withShowAll(true).exec();

if (allContainers.stream().noneMatch(it -> it.getId().equals(containerId))) {
Copy link
Member

Choose a reason for hiding this comment

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

just FYI:

allContainers.stream().map(Container::getId).noneMatch(containerId::equals)

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice 😁

@@ -106,6 +116,13 @@ private void stopContainer(String containerId, String imageName) {
}

try {
InspectContainerResponse containerInfo = dockerClient.inspectContainerCmd(containerId).exec();
Copy link
Member

Choose a reason for hiding this comment

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

we don't use containerInfo anywhere

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, will remove

@rnorth rnorth force-pushed the reduce-error-output branch 5 times, most recently from 4164e57 to 381d9c7 Compare November 19, 2016 09:35
@rnorth rnorth mentioned this pull request Nov 19, 2016
…r refactoring of common elements.

Adopt MySQL and MariaDB default configuration with lighter resource requirements
…o enable them to be volume mounted into containers.
…path resources that have been extracted from JAR files.
* ensure that liveness `exec` calls don't fire when a container is not running
* check that containers exist before trying to clean up in ResourceReaper
* filter out common ANSI control code in stderr output
* amend frame consumer result callback to suppress errors
@rnorth rnorth changed the title Reduce error output Combine DB container tests into single module, and improve error handling/display Nov 19, 2016
@rnorth rnorth merged commit e0cfbae into master Nov 19, 2016
@rnorth rnorth deleted the reduce-error-output branch November 19, 2016 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants