Giter VIP home page Giter VIP logo

testcontainers-java-examples's People

Contributors

bsideup avatar peter-evans avatar rnorth avatar seanf avatar stefanhufschmidt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

testcontainers-java-examples's Issues

Tests fail on Windows 10

Environment: Windows 10 native client.

Checkout and run:

mvn verify

Error:

: failed with exception message: ping failed
08:54:18.892 [main] ERROR org.testcontainers.dockerclient.DockerConfigurationStrategy -     docker-machine: failed with exception message: Exception when executing docker-machine.exe status
08:54:18.892 [main] ERROR org.testcontainers.dockerclient.DockerConfigurationStrategy -     local Unix socket (unix:///var/run/docker.sock): failed with exception message: ping failed
08:54:18.892 [main] ERROR org.testcontainers.dockerclient.DockerConfigurationStrategy - As no valid configuration was found, execution cannot continue

Output docker version:

Client:
 Version:       17.12.0-ce
 API version:   1.35
 Go version:    go1.9.2
 Git commit:    c97c6d6
 Built: Wed Dec 27 20:05:22 2017
 OS/Arch:       windows/amd64

Server:
 Engine:
  Version:      17.12.0-ce
  API version:  1.35 (minimum version 1.12)
  Go version:   go1.9.2
  Git commit:   c97c6d6
  Built:        Wed Dec 27 20:12:29 2017
  OS/Arch:      linux/amd64
  Experimental: true

Couchbase Container defaults to standard alpine image when using non default credentials.

When building a couchbase container like this

        CouchbaseContainer couchbaseContainer = new CouchbaseContainer()
                .withClusterUsername("admin")
                .withClusterPassword("foobar")
        couchbaseContainer.start();

The the with methods (generated with @Wither) return a copy of the original CouchbaseContainer.
The problem now is, that the generated constructor for that does not call the this() constructor but instead implicitly the super() constructor, which then defaults to alpine:3.5.

I have two ideas how to fix that:

  1. My suggestion is to use the more common style used across the project.
    public SELF withClusterUsername(String clusterUsername) {
        this.clusterUsername = clusterUsername;
        return self();
    }
  1. Those with methods feel a lot like a chained setter from lombok. We could also use a lombok.config with
##
## Key : lombok.accessors.chain
## Type: boolean
##
## Generate setters that return 'this' instead of 'void' (default: false).
##
## Examples:
#
# clear lombok.accessors.chain
# lombok.accessors.chain = [false | true]
#
lombok.accessors.chain = true

and be done with it, but this unfortunately is an api change. For that we could write simple delegate methods.

What do you think?

Btw. @Wither is used 12 times in the CouchbaseContainer an one time in the OkHttpWebTarget. (this does not hurt as it does not have a superclass)

Switch to doing tests in integration-test phase?

It's a bit more of a personal taste thing, but I wonder if the examples should show how to use the maven integration-test phase to use the maven integration-test phase to run the tests, rather than binding to the normal test phase?

This does make the examples more verbose (eg using the failsafe plugin).

Build fails on Fedora 22 Linux

The build command mvn clean install fails dependency resolution with this message
[ERROR] Failed to execute goal on project redis-backed-cache: Could not resolve dependencies for project org.testcontainers.examples:redis-backed-cache:jar:NOVERSION: Failed to collect dependencies at org.rnorth.visible-assertions:visible-assertions:jar:1.0.2 -> org.fusesource.jansi:jansi:jar:[,1.11): No versions available for org.fusesource.jansi:jansi:jar:[,1.11) within specified range -> [Help 1]

If I apply the fix from #3 the code can be built, but the tests fail with these messages:

13:07:58.079 [main] INFO  org.testcontainers.dockerclient.DockerConfigurationStrategy - Looking for Docker environment. Trying Environment variables, system properties and defaults. Resolved: 
    uri=https://localhost:2376
    sslConfig='LocalDirectorySSLConfig{dockerCertPath=/home/sflaniga/.docker}'
    version='{UNKNOWN_VERSION}'
    username='sflaniga'
    password='null'
    email='null'
    serverAddress='https://index.docker.io/v1/'
    dockerCfgPath='/home/sflaniga/.dockercfg'

13:07:58.467 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - I/O exception (org.testcontainers.shaded.org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
13:07:58.467 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - Retrying request
13:07:58.468 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - I/O exception (org.testcontainers.shaded.org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
13:07:58.468 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - Retrying request
13:07:58.468 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - I/O exception (org.testcontainers.shaded.org.apache.http.conn.UnsupportedSchemeException) caught when processing request: https protocol is not supported
13:07:58.468 [main] INFO  org.testcontainers.shaded.org.apache.http.impl.execchain.RetryExec - Retrying request
13:07:58.469 [main] INFO  org.testcontainers.dockerclient.DockerConfigurationStrategy - Looking for Docker environment. Trying docker-machine
13:07:58.537 [main] INFO  org.testcontainers.dockerclient.DockerConfigurationStrategy - Found docker-machine, and will use machine named 
13:07:58.545 [main] INFO  org.testcontainers.dockerclient.DockerConfigurationStrategy - Looking for Docker environment. Trying local Unix socket (unix:///var/run/docker.sock)
13:07:58.588 [main] INFO  org.testcontainers.dockerclient.DockerConfigurationStrategy - Accessing docker with local Unix socket
13:08:02.419 [main] WARN  org.testcontainers.DockerClientFactory - Encountered and ignored error while checking disk space
org.testcontainers.shaded.com.github.dockerjava.api.DockerClientException: Could not pull image: null
        at org.testcontainers.shaded.com.github.dockerjava.core.command.PullImageResultCallback.awaitSuccess(PullImageResultCallback.java:49) ~[testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at org.testcontainers.DockerClientFactory.checkDiskSpace(DockerClientFactory.java:142) [testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at org.testcontainers.DockerClientFactory.checkDiskSpaceAndHandleExceptions(DockerClientFactory.java:125) [testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:89) [testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:70) [testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:101) [testcontainers--testcontainers-1.0.5-g75d09d4-2.jar:na]
        at RedisBackedCacheTest.<init>(RedisBackedCacheTest.java:18) [test-classes/:na]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) [na:1.8.0_91]
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) [na:1.8.0_91]
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) [na:1.8.0_91]
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423) [na:1.8.0_91]
        at org.junit.runners.BlockJUnit4ClassRunner.createTest(BlockJUnit4ClassRunner.java:217) [junit-4.12.jar:4.12]
        at org.junit.runners.BlockJUnit4ClassRunner$1.runReflectiveCall(BlockJUnit4ClassRunner.java:266) [junit-4.12.jar:4.12]
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) [junit-4.12.jar:4.12]
        at org.junit.runners.BlockJUnit4ClassRunner.methodBlock(BlockJUnit4ClassRunner.java:263) [junit-4.12.jar:4.12]
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) [junit-4.12.jar:4.12]
        at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) [junit-4.12.jar:4.12]
        at org.junit.runners.ParentRunner.run(ParentRunner.java:363) [junit-4.12.jar:4.12]
        at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252) [surefire-junit4-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141) [surefire-junit4-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112) [surefire-junit4-2.12.4.jar:2.12.4]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_91]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_91]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_91]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_91]
        at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189) [surefire-api-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165) [surefire-booter-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85) [surefire-booter-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115) [surefire-booter-2.12.4.jar:2.12.4]
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75) [surefire-booter-2.12.4.jar:2.12.4]
13:08:02.508 [main] INFO  ๐Ÿณ [redis:3.0.6] - Pulling docker image: redis:3.0.6. Please be patient; this may take some time but only needs to be done once.
13:08:13.691 [main] ERROR ๐Ÿณ [redis:3.0.6] - Retry limit reached while trying to pull image: redis:3.0.6. Please check output of `docker pull redis:3.0.6`

Despite the messages, I'm not out of disk space. If I try docker pull redis:3.0.6 as suggested, there is no error:

Trying to pull repository docker.io/library/redis ... 3.0.6: Pulling from library/redis

cb6fb082434e: Already exists 
d4b2ba78e3b4: Already exists 
96ee3f6ffa87: Already exists 
2feb6003bd2b: Already exists 
0ab2b63da119: Already exists 
049c59590de6: Already exists 
3c19570e002d: Already exists 
70f598fa4206: Already exists 
62c1a48300f5: Already exists 
0f997ba7600c: Already exists 
b97dabec1a3d: Already exists 
25ff6ad2020c: Already exists 
51dfd40e6465: Already exists 
30084b4aa8fb: Already exists 
e174820a222a: Already exists 
8b1a71a14171: Already exists 
ba4630529798: Already exists 
Digest: sha256:6a692a76c2081888b589e26e6ec835743119fe453d67ecf03df7de5b73d69842
Status: Image is up to date for docker.io/redis:3.0.6

Also, I have tried building with the latest release instead of "-SNAPSHOT":

mvn clean install -Dtestcontainers.group=org.testcontainers -Dtestcontainers.version=1.0.5

and the results are similar.

Build Fails with dependency error

mvn clean install fails with this error:

testNotFindingAValueThatWasNotInserted(RedisBackedCacheTest)  Time elapsed: 0.005 sec  <<< ERROR!
java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
	at com.github.dockerjava.core.AuthConfigFile.decodeAuth(AuthConfigFile.java:178)
	at com.github.dockerjava.core.AuthConfigFile.loadConfig(AuthConfigFile.java:140)
	at com.github.dockerjava.core.DefaultDockerClientConfig.effectiveAuthConfig(DefaultDockerClientConfig.java:266)
	at com.github.dockerjava.core.DockerClientImpl.pullImageCmd(DockerClientImpl.java:215)
	at org.testcontainers.dockerclient.AuditLoggingDockerClient.pullImageCmd(AuditLoggingDockerClient.java:22)
	at org.testcontainers.DockerClientFactory.checkAndPullImage(DockerClientFactory.java:183)
	at org.testcontainers.utility.ResourceReaper.start(ResourceReaper.java:65)
	at org.testcontainers.DockerClientFactory.client(DockerClientFactory.java:116)
	at org.testcontainers.containers.GenericContainer.<init>(GenericContainer.java:126)
	at RedisBackedCacheTest.<init>(RedisBackedCacheTest.java:18)

I was able to work around it by adding this dependency in the root pom.xml:

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.10</version>
        </dependency>

Would a PR help? Or maybe there is a better place to add this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.