Skip to content

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

Merged
rnorth merged 6 commits into
masterfrom
reduce-error-output
Nov 19, 2016
Merged

Combine DB container tests into single module, and improve error handling/display#243
rnorth merged 6 commits into
masterfrom
reduce-error-output

Conversation

@rnorth
Copy link
Copy Markdown
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.

@rnorth rnorth force-pushed the reduce-error-output branch from 184b690 to 1ce1d9f Compare November 17, 2016 22:46

}

if (!isRunning()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nice catch!

public void stopAndRemoveContainer(String containerId) {
stopContainer(containerId, registeredContainers.get(containerId));

registeredContainers.remove(containerId);
Copy link
Copy Markdown
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
Copy Markdown
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.


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

if (allContainers.stream().noneMatch(it -> it.getId().equals(containerId))) {
Copy link
Copy Markdown
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
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Nice 😁

}
}

try {
Copy link
Copy Markdown
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
Copy Markdown
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 force-pushed the reduce-error-output branch from a29d49e to 408e983 Compare November 19, 2016 20:25
@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