testcontainers / testcontainers-java

Testcontainers is a Java library that supports JUnit tests, providing lightweight, throwaway instances of common databases, Selenium web browsers, or anything else that can run in a Docker container.
https://testcontainers.org
MIT License
8.03k stars 1.65k forks source link

Couchbase module not compatible with Docker Hub `_/couchbase` image #3419

Open hantsy opened 4 years ago

hantsy commented 4 years ago

For the latest Couchbase 6.6, we can use couchbase:communtiy and couchbase:enterprise to get the latest Couchbase, but I tried to use this as DockerImageName, it will complain the docker name is not compatible with couchbase/server.

Check: https://hub.docker.com/_/couchbase

rnorth commented 4 years ago

This should be easy to resolve - will create a PR.

rnorth commented 4 years ago

Actually, while testing, I'm finding that couchbase:community-6.5.1 is not a drop-in replacement for couchbase/server:6.5.1 - startup fails with an error which I don't have the couchbase knowledge to diagnose: The value must be one of the following: [forestdb]".

Because of this, I'd say that the compatibility check is working correctly: it's designed to prevent the wrong image being used, but give the user a chance to override.

If you really do want to use the couchbase:community images, please follow the instructions in the error message and use DockerImageName.parse("couchbase:community-YOURVERSION").asCompatibleSubstituteFor("couchbase/server") as the image. This tells Testcontainers that you're declaring compatibility between the image you're using and the image that the CouchbaseContainer class was designed/tested with.

I'm not sure this community image will work though, due to the error I mentioned.

The good news is that couchbase:enterprise-* does seem to function as a drop-in replacement for couchbase/server:*. Unfortunately our compatibility checks only look at the image name, not at the tag part, so for now it will still be necessary to use `asCompatibleSubstituteFor I'm afraid.

@daschl is it expected that the Couchbase module is not compatible with the couchbase:community-* images from Docker Hub's official library?

hantsy commented 4 years ago

@rnorth there is no 6.6 under naming couchbase/server

daschl commented 4 years ago

@rnorth I'll come up with a PR to make sure community edition also works. Right now we did not test with community, and community only allows for a different index engine (forestdb). The fix shouldn't be hard, working on it.

daschl commented 4 years ago

@rnorth @hantsy provided a PR in #3428

Note that this helps to work around the issue and provides more flexibility in general, but I still wonder if we should do two more things:

hantsy commented 4 years ago

@daschl I think the default couchbase(couchbase:latest) should be the enterprise.

daschl commented 4 years ago

@hantsy I'm not sure I would want that personally, since I'd rather want the server version to be the same I currently use in prod (so it stays at one version and not automatically advances, until I manually bump it to something else)

hantsy commented 4 years ago

I would like to use the latest product when starting a new project, but the versions used in testcontainers are not up to date requently.

daschl commented 4 years ago

Let's leave that final call to @rnorth, since I assume there is a established best practice with other modules and couchbase should just follow that.

hantsy commented 4 years ago

After updated to couchbase:community as you suggested, got the store error, which could be resolved in your prs. I will test it again when it is merged.

7nolikov commented 3 years ago

I faced the described problem The value must be one of the following: [forestdb]. As I understand, fix is ready. Could you finish review please? @daschl @rnorth @aaronjwhiteside

daschl commented 3 years ago

I think this is good to go now?

daschl commented 3 years ago

@rnorth @bsideup trying again :) I think this is good to be merged.