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

Twitter itest doesn't work in native mode #2090

Closed
llowinge opened this issue Dec 22, 2020 · 10 comments · Fixed by #2096
Closed

Twitter itest doesn't work in native mode #2090

llowinge opened this issue Dec 22, 2020 · 10 comments · Fixed by #2096
Milestone

Comments

@llowinge
Copy link
Contributor

I can see

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in org.apache.camel.quarkus.component.twitter.CamelTwitterTest that uses java.lang.String was not fulfilled within 15 seconds.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:165)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:26)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:895)
	at org.awaitility.core.ConditionFactory.until(ConditionFactory.java:864)
	at org.apache.camel.quarkus.component.twitter.CamelTwitterTest.direct(CamelTwitterTest.java:53)

when running
mvn -U -B -e -fae -V -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn verify -f pom.xml -Dformatter.skip -Dimpsort.skip -Denforcer.skip -Pnative -pl twitter in integration-tests directory on master branch. The JVM variant works.

Log from Native

2020-12-22 15:12:51,812 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Sending direct message to user '@jbossfuseqa': Direct message from camel-quarkus-twitter 509fb6a33ca0404c9d4e1628200766a1
2020-12-22 15:12:52,262 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Sent direct message to user '@jbossfuseqa': Direct message from camel-quarkus-twitter 509fb6a33ca0404c9d4e1628200766a1
2020-12-22 15:12:52,370 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:12:53,529 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Tue Dec 22 15:08:57 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter e8a5945a5e6a485982cdcdb46a480679
2020-12-22 15:12:56,554 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:12:56,554 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Sun Dec 20 14:18:04 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter 6cedd3b21f3d4218aa097e3fdc3ce59b
2020-12-22 15:12:59,565 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:12:59,565 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Fri Dec 18 20:45:45 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter 71a0d85b2d1b4a8ab7b5adcb29eb1f2a
2020-12-22 15:13:02,577 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:13:02,577 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Fri Dec 18 20:28:17 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter 4e31c9b088674c0dbf164d9c9a443994
2020-12-22 15:13:05,589 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:13:05,589 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Fri Dec 18 20:10:20 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter 0a09f704e1414d04b1ea25a5b3337715
2020-12-22 15:13:08,933 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Posted a tweet Hello from camel-quarkus-twitter 7cf342875805483c8353b0102ec5e2bc
2020-12-22 15:13:10,300 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received tweets from user's timeline: Tue Dec 22 15:13:08 CET 2020 (jbossfuseqa) Hello from camel-quarkus-twitter 7cf342875805483c8353b0102ec5e2bc
2020-12-22 15:13:20,314 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Searching for keywords on twitter: camel-quarkus-twitter 7cf342875805483c8353b0102ec5e2bc
2020-12-22 15:13:21,582 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received tweets from twitter search: Tue Dec 22 15:13:08 CET 2020 (jbossfuseqa) Hello from camel-quarkus-twitter 7cf342875805483c8353b0102ec5e2bc
[ERROR] Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 31.654 s <<< FAILURE! - in org.apache.camel.quarkus.component.twitter.CamelTwitterIT

and log from JVM

2020-12-22 15:24:10,433 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Sending direct message to user '@jbossfuseqa': Direct message from camel-quarkus-twitter 4f7d1c0fb02546ef85490a9b9511e2e3
2020-12-22 15:24:11,267 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Sent direct message to user '@jbossfuseqa': Direct message from camel-quarkus-twitter 4f7d1c0fb02546ef85490a9b9511e2e3
2020-12-22 15:25:11,416 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Polling direct messages of user '@jbossfuseqa'
2020-12-22 15:25:12,865 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received direct messages: Tue Dec 22 15:24:11 CET 2020 (879253174347071489) Direct message from camel-quarkus-twitter 4f7d1c0fb02546ef85490a9b9511e2e3
2020-12-22 15:25:13,168 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Posted a tweet Hello from camel-quarkus-twitter 0f3a19e0f7fb448bb9fbb8c77fda7deb
2020-12-22 15:26:14,846 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received tweets from user's timeline: Tue Dec 22 15:25:13 CET 2020 (jbossfuseqa) Hello from camel-quarkus-twitter 0f3a19e0f7fb448bb9fbb8c77fda7deb
2020-12-22 15:26:24,860 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Searching for keywords on twitter: camel-quarkus-twitter 0f3a19e0f7fb448bb9fbb8c77fda7deb
2020-12-22 15:26:26,228 INFO  [org.apa.cam.qua.com.twi.CamelResource] (executor-thread-1) Received tweets from twitter search: Tue Dec 22 15:25:13 CET 2020 (jbossfuseqa) Hello from camel-quarkus-twitter 0f3a19e0f7fb448bb9fbb8c77fda7deb
@llowinge
Copy link
Contributor Author

@ppalaga
Copy link
Contributor

ppalaga commented Dec 23, 2020

Injection does not work in native mode. We need to find a different way of passing the initial delay value. How about

-    @ConfigProperty(name = "test.twitter.delay.initial", defaultValue = "60")
-    int testTwitterDelayInitial;
+    int testTwitterDelayInitial = 60;

@lburgazzoli
Copy link
Contributor

is this a known issue ?

@ppalaga
Copy link
Contributor

ppalaga commented Dec 23, 2020

It is not an issue, it is by design, AFAIK.

@ppalaga
Copy link
Contributor

ppalaga commented Dec 23, 2020

Another workaround could be to add a rest endpoint to the test app that would return the ConfigProperty value. @ConfigProperty works in the app of course, it only does not work in the test.

@ppalaga
Copy link
Contributor

ppalaga commented Dec 23, 2020

Or even org.eclipse.microprofile.config.ConfigProvider.getConfig().getValue("test.twitter.delay.initial", Integer.class) should work in the test.

@llowinge
Copy link
Contributor Author

@ppalaga Thanks. I will try the ConfigProvider.getConfig().getValue, i remember i've already used it once before because i wanted to assign the value to static variable.

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Dec 23, 2020

It is not an issue, it is by design, AFAIK.

but is CamelTwitterTest compiled to native ? I thought it were execute as any other test so by the jvm. And I honestly do not see why it should not work

@llowinge
Copy link
Contributor Author

Just for a record, it works with ConfigProvider.getConfig().getValue.

@ppalaga
Copy link
Contributor

ppalaga commented Dec 23, 2020

but is CamelTwitterTest compiled to native ? I thought it were execute as any other test so by the jvm. And I honestly do not see why it should not work

Yes, it could be made to work, for some injection values at least. @ConfigProperty could work indeed, but @Inject CamelContext could not work at all, because in the native mode, the tests run in a process distinct from the one running the application under test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants