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

Tests use test containers even if -Dtest-containers is not set #25141

Closed
holly-cummins opened this issue Apr 25, 2022 · 3 comments · Fixed by #25147
Closed

Tests use test containers even if -Dtest-containers is not set #25141

holly-cummins opened this issue Apr 25, 2022 · 3 comments · Fixed by #25147
Labels
area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working

Comments

@holly-cummins
Copy link
Contributor

Describe the bug

I think I've spotted a missing guard in extensions/elasticsearch-rest-client/deployment. It looks like docker is a prereq for the tests to run clean, even when -Dtest-containers is not set. This isn't consistent with CONTRIBUTING.md:

Docker is not strictly necessary: it is used to run the MariaDB and PostgreSQL tests which are not enabled by default.

Expected behavior

Docker shouldn't be necessary for a normal build with the default set of tests to run cleanly (according to the current docs).

Actual behavior

The build fails:

[ERROR] Failures: 
[ERROR]   DevServicesElasticsearchDevModeTestCase.testDatasource:30 1 expectation failed.
Expected status code <204> but was <500>.

[INFO] 
[ERROR] Tests run: 2, Failures: 1, Errors: 0, Skipped: 0
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  9.811 s
[INFO] Finished at: 2022-04-25T15:51:11+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M5:test (default-test) on project quarkus-elasticsearch-rest-client-deployment: There are test failures.
[ERROR] 
[ERROR] Please refer to /Users/holly/Code/quarkus/main/quarkus/extensions/elasticsearch-rest-client/deployment/target/surefire-reports for the individual test results.

The detailed failure is

[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running io.quarkus.elasticsearch.restclient.lowlevel.runtime.DevServicesElasticsearchDevModeTestCase
Tests paused
2022-04-25 15:51:07,846 WARN  [org.tes.uti.TestcontainersConfiguration] (build-18) Attempted to read Testcontainers configuration file at file:/Users/holly/.testcontainers.properties but the file was not found. Exception message: FileNotFoundException: /Users/holly/.testcontainers.properties (No such file or directory)
2022-04-25 15:51:07,855 INFO  [org.tes.doc.DockerMachineClientProviderStrategy] (build-18) docker-machine executable was not found on PATH ([/Users/holly/.jbang/bin, /Users/holly/.jbang/bin, /Users/holly/.nvm/versions/node/v12.22.11/bin, /opt/homebrew/bin, /opt/homebrew/sbin, /usr/local/bin, /usr/bin, /bin, /usr/sbin, /sbin, /usr/local/munki])
2022-04-25 15:51:07,855 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-18) Could not find a valid Docker environment. Please check configuration. Attempted configurations were:
2022-04-25 15:51:07,855 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-18)     UnixSocketClientProviderStrategy: failed with exception InvalidConfigurationException (Could not find unix domain socket). Root cause NoSuchFileException (/var/run/docker.sock)
2022-04-25 15:51:07,855 ERROR [org.tes.doc.DockerClientProviderStrategy] (build-18) As no valid configuration was found, execution cannot continue
2022-04-25 15:51:07,861 WARN  [io.qua.dep.IsDockerWorking] (build-18) No docker binary found or general error: java.lang.RuntimeException: Input/Output error while executing command.
2022-04-25 15:51:07,862 WARN  [io.qua.ela.res.com.dep.DevServicesElasticsearchProcessor] (build-18) Docker isn't working, please configure the Elasticsearch hosts property (quarkus.elasticsearch.hosts).
__  ____  __  _____   ___  __ ____  ______ 
 --/ __ \/ / / / _ | / _ \/ //_/ / / / __/ 
 -/ /_/ / /_/ / __ |/ , _/ ,< / /_/ /\ \   
--\___\_\____/_/ |_/_/|_/_/|_|\____/___/   
            Powered by Quarkus 999-SNAPSHOT
2022-04-25 15:51:08,524 INFO  [io.quarkus] (Quarkus Main Thread) quarkus-elasticsearch-rest-client-deployment 999-SNAPSHOT on JVM (powered by Quarkus 999-SNAPSHOT) started in 1.118s. Listening on: http://localhost:8080
2022-04-25 15:51:08,525 INFO  [io.quarkus] (Quarkus Main Thread) Profile dev activated. Live Coding activated.
2022-04-25 15:51:08,525 INFO  [io.quarkus] (Quarkus Main Thread) Installed features: [cdi, elasticsearch-rest-client, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
2022-04-25 15:51:09,277 ERROR [io.qua.ver.htt.run.QuarkusErrorHandler] (executor-thread-0) HTTP Request to /fruits failed, error id: ace14b5e-cf26-467d-814f-7e7a99a3d16c-1: org.jboss.resteasy.spi.UnhandledException: java.net.ConnectException: Connection refused
	at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:105)
	at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:359)
	at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:218)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:519)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$invoke$4(SynchronousDispatcher.java:261)
	at org.jboss.resteasy.core.SynchronousDispatcher.lambda$preprocess$0(SynchronousDispatcher.java:161)
	at org.jboss.resteasy.core.interception.jaxrs.PreMatchContainerRequestContext.filter(PreMatchContainerRequestContext.java:364)
	at org.jboss.resteasy.core.SynchronousDispatcher.preprocess(SynchronousDispatcher.java:164)
	at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:247)
	at io.quarkus.resteasy.runtime.standalone.RequestDispatcher.service(RequestDispatcher.java:73)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler.dispatch(VertxRequestHandler.java:151)
	at io.quarkus.resteasy.runtime.standalone.VertxRequestHandler$1.run(VertxRequestHandler.java:91)
	at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:548)
	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
	at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:29)
	at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:29)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.net.ConnectException: Connection refused
	at org.elasticsearch.client.RestClient.extractAndWrapCause(RestClient.java:918)

How to Reproduce?

  1. Uninstall docker and podman (or start on a fresh machine image)
  2. Run ./mvnw -Dquickly -DskipTests=false -f extensions/elasticsearch-rest-client/deployment

Output of uname -a or ver

Darwin hcummins-mac 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk version "17.0.2" 2022-01-18 OpenJDK Runtime Environment Temurin-17.0.2+8 (build 17.0.2+8) OpenJDK 64-Bit Server VM Temurin-17.0.2+8 (build 17.0.2+8, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

commit 3ec92db (HEAD -> main, origin/main, origin/HEAD)

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /Users/holly/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 18, vendor: Eclipse Adoptium, runtime: /Library/Java/JavaVirtualMachines/temurin-18.jdk/Contents/Home Default locale: en_GB, platform encoding: UTF-8 OS name: "mac os x", version: "12.3.1", arch: "aarch64", family: "mac"

Additional information

No response

@holly-cummins holly-cummins added the kind/bug Something isn't working label Apr 25, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Apr 25, 2022

/cc @maxandersen, @quarkusio/devtools

@quarkus-bot quarkus-bot bot added the area/jbang Issues related to when using jbang.dev with Quarkus label Apr 25, 2022
@holly-cummins
Copy link
Contributor Author

I'll submit a PR for this but want to investigate first to make sure testcontainers not being able to find Docker is the root cause.

@holly-cummins
Copy link
Contributor Author

#25147

I've confirmed that with my changes,

./mvnw -Dquickly -DskipTests=false -f extensions/elasticsearch-rest-client/deployment
passes, because it doesn't try and run any tests.

./mvnw -Dquickly -DskipTests=false -Dtest-containers -f extensions/elasticsearch-rest-client/deployment
does actually run the tests and passes, as long as I have a podman or docker socket active.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/jbang Issues related to when using jbang.dev with Quarkus kind/bug Something isn't working
Projects
None yet
1 participant