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

"CAMEL-13454:camel-testcontainers - Should build if no docker" #3063

Closed
wants to merge 1 commit into from
Closed

"CAMEL-13454:camel-testcontainers - Should build if no docker" #3063

wants to merge 1 commit into from

Conversation

ramu11
Copy link
Contributor

@ramu11 ramu11 commented Jul 25, 2019

"CAMEL-13454:camel-testcontainers - Should build if no docker"

Copy link
Contributor

@oscerd oscerd left a comment

Choose a reason for hiding this comment

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

Not sure this resolves the situation

@ramu11
Copy link
Contributor Author

ramu11 commented Jul 25, 2019

Not sure this resolves the situation

[kkakarla@kkakarla camel]$ systemctl status docker Unit docker.service could not be found.
`[kkakarla@kkakarla camel-consul]$ mvn clean install
[INFO] BuildTimeEventSpy is registered.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Camel :: Consul 3.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------


INFO] Running org.apache.camel.component.consul.cluster.ConsulClusteredRoutePolicyFactoryTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.consul.cluster.ConsulClusteredRoutePolicyFactoryTest
[INFO] Running org.apache.camel.component.consul.cluster.ConsulClusteredRoutePolicyTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.consul.cluster.ConsulClusteredRoutePolicyTest
[INFO] Running org.apache.camel.component.consul.cluster.ConsulMasterTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.consul.cluster.ConsulMasterTest
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ camel-consul ---
[INFO] Installing /home/kkakarla/development/git/camel/components/camel-consul/target/camel-consul-3.0.0-SNAPSHOT.jar to /home/kkakarla/.m2/repository/org/apache/camel/camel-consul/3.0.0-SNAPSHOT/camel-consul-3.0.0-SNAPSHOT.jar
[INFO] Installing /home/kkakarla/development/git/camel/components/camel-consul/.flattened-pom.xml to /home/kkakarla/.m2/repository/org/apache/camel/camel-consul/3.0.0-SNAPSHOT/camel-consul-3.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.725 s
[INFO] Finished at: 2019-07-25T18:55:51+05:30
[INFO] Final Memory: 46M/155M
[INFO] ------------------------------------------------------------------------

`

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

I need to test this locally.

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

@davsclaus can you double check on your Mac?

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

This doesn't work without docker-machine

[INFO] ------------------------------------------------------------------------
oscerd@ghost:~/workspace/apache-camel/camel/components/camel-nats$ sudo service docker start
[sudo] password for oscerd: 
Redirecting to /bin/systemctl start docker.service
oscerd@ghost:~/workspace/apache-camel/camel/components/camel-nats$ mvn clean install
[INFO] BuildTimeEventSpy is registered.
[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------< org.apache.camel:camel-nats >---------------------
[INFO] Building Camel :: Nats 3.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) @ camel-nats ---
[INFO] Deleting /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target
[INFO] 
[INFO] --- maven-bundle-plugin:4.2.0:cleanVersions (versions) @ camel-nats ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) @ camel-nats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /home/oscerd/workspace/apache-camel/camel/components/camel-nats/src/main/resources
[INFO] 
[INFO] --- flatten-maven-plugin:1.1.0:flatten (default-cli) @ camel-nats ---
[INFO] Generating flattened POM of project org.apache.camel:camel-nats:jar:3.0.0-SNAPSHOT...
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) @ camel-nats ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 6 source files to /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/classes
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:prepare-components (generate) @ camel-nats ---
[INFO] Generated /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/generated/camel/components/META-INF/services/org/apache/camel/component.properties containing 1 Camel component: nats
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:generate-components-list (generate) @ camel-nats ---
[INFO] Generated /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/generated/camel/components/META-INF/services/org/apache/camel/component.properties containing 1 Camel component: nats
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:resources (copy-generated-resources) @ camel-nats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] skip non existing resourceDirectory /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/generated/camel/dataformats
[INFO] skip non existing resourceDirectory /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/generated/camel/languages
[INFO] skip non existing resourceDirectory /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/generated/camel/others
[INFO] 
[INFO] --- jandex-maven-plugin:1.0.6:jandex (make-index) @ camel-nats ---
[INFO] 
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) @ camel-nats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) @ camel-nats ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 15 source files to /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) @ camel-nats ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.apache.camel.component.nats.NatsAuthConsumerLoadTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.511 s - in org.apache.camel.component.nats.NatsAuthConsumerLoadTest
[INFO] Running org.apache.camel.component.nats.NatsAuthProducerTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 s - in org.apache.camel.component.nats.NatsAuthProducerTest
[INFO] Running org.apache.camel.component.nats.NatsAuthTokenConsumerLoadTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsAuthTokenConsumerLoadTest
[INFO] Running org.apache.camel.component.nats.NatsAuthTokenProducerTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsAuthTokenProducerTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerLoadTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 s - in org.apache.camel.component.nats.NatsConsumerLoadTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerMaxMessagesQueueTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 s - in org.apache.camel.component.nats.NatsConsumerMaxMessagesQueueTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerMaxMessagesTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsConsumerMaxMessagesTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsConsumerTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerWithConnectionLoadTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsConsumerWithConnectionLoadTest
[INFO] Running org.apache.camel.component.nats.NatsConsumerWithRedeliveryTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0 s - in org.apache.camel.component.nats.NatsConsumerWithRedeliveryTest
[INFO] Running org.apache.camel.component.nats.NatsProducerTLSTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 s - in org.apache.camel.component.nats.NatsProducerTLSTest
[INFO] Running org.apache.camel.component.nats.NatsProducerTest
[WARNING] Tests run: 1, Failures: 0, Errors: 0, Skipped: 1, Time elapsed: 0.001 s - in org.apache.camel.component.nats.NatsProducerTest
[INFO] 
[INFO] Results:
[INFO] 
[WARNING] Tests run: 12, Failures: 0, Errors: 0, Skipped: 12
[INFO] 
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:validate-components (validate) @ camel-nats ---
[INFO] Validation complete
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:prepare-spring-boot-starter (validate) @ camel-nats ---
[INFO] Spring-Boot-Starter: starter dir for the component is: /home/oscerd/workspace/apache-camel/camel/platforms/spring-boot/components-starter/camel-nats-starter
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:prepare-spring-boot-auto-configuration (validate) @ camel-nats ---
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:generate-legal (validate) @ camel-nats ---
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:generate-endpoint-dsl (validate) @ camel-nats ---
[INFO] 
[INFO] --- maven-bundle-plugin:4.2.0:manifest (bundle-manifest) @ camel-nats ---
[INFO] No previous run data found, generating manifest.
[INFO] 
[INFO] --- maven-jar-plugin:3.1.2:jar (default-jar) @ camel-nats ---
[INFO] Building jar: /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/camel-nats-3.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- camel-package-maven-plugin:3.0.0-SNAPSHOT:update-readme (readme) @ camel-nats ---
[INFO] 
[INFO] --- maven-install-plugin:2.5.2:install (default-install) @ camel-nats ---
[INFO] Installing /home/oscerd/workspace/apache-camel/camel/components/camel-nats/target/camel-nats-3.0.0-SNAPSHOT.jar to /home/oscerd/.m2/repository/org/apache/camel/camel-nats/3.0.0-SNAPSHOT/camel-nats-3.0.0-SNAPSHOT.jar
[INFO] Installing /home/oscerd/workspace/apache-camel/camel/components/camel-nats/.flattened-pom.xml to /home/oscerd/.m2/repository/org/apache/camel/camel-nats/3.0.0-SNAPSHOT/camel-nats-3.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.744 s
[INFO] Finished at: 2019-07-25T15:38:36+02:00
[INFO] ------------------------------------------------------------------------

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

Tests will be skipped even with docker.service running. My proposal is to drop this PR, revert to the original situation and find a different way.

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

-1 for me.

@bedlaj
Copy link
Contributor

bedlaj commented Jul 25, 2019

Yeah I have suggested the validation using DockerMachineClient and this check really works only for Windows and Mac, where docker-machine is installed with toolbox. Sorry about that.

I was looking into code of testcontainers and havent found a nice way to detect this. The problem is that testcontainers does environment validation in constructor, and not later in start phase. The relevant stale issue is there: testcontainers/testcontainers-java#343 , but there is no conclusion. To do this validation reliably requires a lot of changes in testcontainers.

The simple approach could be just wrap it into try-catch, but this is ugly and totally unsafe, because it throws IllegalStateException which can be thrown for many reasons during validation.

@oscerd
Copy link
Contributor

oscerd commented Jul 25, 2019

Yeah I have suggested the validation using DockerMachineClient and this check really works only for Windows and Mac, where docker-machine is installed with toolbox. Sorry about that.

I was looking into code of testcontainers and havent found a nice way to detect this. The problem is that testcontainers does environment validation in constructor, and not later in start phase. The relevant stale issue is there: testcontainers/testcontainers-java#343 , but there is no conclusion. To do this validation reliably requires a lot of changes in testcontainers.

The simple approach could be just wrap it into try-catch, but this is ugly and totally unsafe, because it throws IllegalStateException which can be thrown for many reasons during validation.

If this could work on all the OS I would be more than happy to merge, but in this way, this will work only on Windows and Mac and we are in a chicken-and-egg situation again :-D

@lburgazzoli
Copy link
Contributor

Maybe we could have an activation based on a property/env and win/mac people can add it to maven settings or env var and we should push testcontainers guys to provide a cross platform solution

@lburgazzoli
Copy link
Contributor

btw, does not work for me too

@dmvolod
Copy link
Member

dmvolod commented Jul 25, 2019

We can also use maven os plugin, as we did for grpc tests enabling only on supported platforms, however the platforms list was slightly wide.

@ramu11
Copy link
Contributor Author

ramu11 commented Jul 25, 2019

ok Thanks for all reviewing this. i am closing this PR and revert back to old implementation having maven profiles to skip tests

@ramu11 ramu11 closed this Jul 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants