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

CouchbaseContainer: Fix java.net.SocketException exception in stop() #859

Merged
merged 1 commit into from
Sep 9, 2018

Conversation

dnault
Copy link
Contributor

@dnault dnault commented Sep 7, 2018

Motivation

When stop() was called without a prior call to createCouchbaseEnvironment(), it would throw a SocketException because stopCluster() would end up trying to initialize the cluster at the same time the container is being shut down.

Modifications

Call stopCluster() before stopping the container, instead of in parallel.

Result

stopCluster() might still call createCouchbaseEnvironment(), but the call succeeds and the environment is immediately cleaned up.

Motivation
==========
When stop() was called without a prior call to
createCouchbaseEnvironment(), it would throw a SocketException
because stopCluster() would end up trying to initialize the cluster
at the same time the container is being shut down.

Modifications
=============
Call stopCluster() before stopping the container, instead of in
parallel.

Result
======
stopCluster() might still call createCouchbaseEnvironment(),
but the call succeeds and the environment is immediately cleaned up.
@bsideup bsideup added this to the next milestone Sep 7, 2018
@bsideup bsideup changed the title Fix java.net.SocketException exception in CouchbaseContainer.stop() CouchbaseContainer: Fix java.net.SocketException exception in stop() Sep 7, 2018
@@ -12,4 +12,11 @@ public void shouldUseCorrectDockerImage() {
Assert.assertEquals(CouchbaseContainer.DOCKER_IMAGE_NAME + CouchbaseContainer.VERSION,
couchbaseContainer.getDockerImageName());
}

@Test
public void shouldStopWithoutThrowingException() {
Copy link
Member

Choose a reason for hiding this comment

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

since this test does not test anything automatically, I would remove it, just to not add time to the Testcontainers test suite

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm fine with removing it, as long as it's understood that this test fails prior the main code change in this PR.

Copy link
Member

Choose a reason for hiding this comment

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

ah, ok, I thought that it is only about the logging, but if it fails with current master - let's keep it 👍

@bsideup
Copy link
Member

bsideup commented Sep 7, 2018

@dnault nice catch 👍

@Kaidowei could you please take a look?

@bsideup bsideup merged commit f589e60 into testcontainers:master Sep 9, 2018
@bsideup
Copy link
Member

bsideup commented Sep 9, 2018

@dnault merged, thanks 👍

@rnorth
Copy link
Member

rnorth commented Sep 10, 2018

We have this out in a Release Candidate build (1.9.0-rc1) for anyone who is keen to try it!

Release notes

@dnault dnault deleted the fix-couchbase-container-stop branch September 10, 2018 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants