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 start before DevContainer startup #45134

Open
DFMichelangelo opened this issue Dec 15, 2024 · 3 comments
Open

Tests start before DevContainer startup #45134

DFMichelangelo opened this issue Dec 15, 2024 · 3 comments
Labels
area/hibernate-reactive Hibernate Reactive area/testing kind/bug Something isn't working

Comments

@DFMichelangelo
Copy link

DFMichelangelo commented Dec 15, 2024

Describe the bug

Hi Quarkus fans,
I'm experiencing an issue which I don't understand whether it's a bug or a wrong usage of quarkus.

In my MRE I am using quarkus with reactive & non-blocking IO features.
When I run the tests, I use a postgres devcontainer that runs an import.sql on startup.

Running the import.SQL programmatically using a startup listener does not solve the issue.

Thank you for your help in advance

Expected behavior

I would expect that when running the tests, the database should be ready with the import.sql already run.

Actual behavior

When tests are run, one of the tests fail randomly as the data of import.sql is not loaded in the database. Apparently tests run before the import.sql is run, but I could be wrong.

In my tests, one user retrieved at the beginning of a test is NULL(line 280 of the github action linked above), it shouldn't be. If I run the tests multiple times, other tests fail in the same way

How to Reproduce?

The MRE is available at this Github link, whereas the issue can be viewed here: Github Action.
You can download the repository and run ./gradlew clean test to reproduce the issue.
Tests appear to be flaky since sometimes the database table Users is empty.

Output of uname -a or ver

Linux fedora 6.11.10-300.fc41.x86_64 #1 SMP PREEMPT_DYNAMIC Sat Nov 23 00:51:20 UTC 2024 x86_64 GNU/Linux

Output of java -version

openjdk version "22.0.2" 2024-07-16 OpenJDK Runtime Environment (build 22.0.2+9-70) OpenJDK 64-Bit Server VM (build 22.0.2+9-70, mixed mode, sharing)

Quarkus version or git rev

3.17.4

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


Gradle 8.9

Build time: 2024-07-11 14:37:41 UTC
Revision: d536ef36a19186ccc596d8817123e5445f30fef8

Kotlin: 1.9.23
Groovy: 3.0.21
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
Launcher JVM: 22.0.2 (Oracle Corporation 22.0.2+9-70)
Daemon JVM: /home/dfmic/.jdks/openjdk-22.0.2 (no JDK specified, using current Java home)
OS: Linux 6.11.10-300.fc41.x86_64 amd64

Additional information

Maybe it is supposed to use test/dev containers differently and this is just improper use.

@DFMichelangelo DFMichelangelo added the kind/bug Something isn't working label Dec 15, 2024
@geoand
Copy link
Contributor

geoand commented Dec 16, 2024

Thanks for reporting!

When tests are run, one of the tests fail randomly as the data of import.sql is not loaded in the database. Apparently tests run before the import.sql is run, but I could be wrong.

How do you come to this conclusion from running the tests? Asking because I ran the sample (which does indeed fail), but I don't see any obvious indication that import.sql was not executed in the proper time

@geoand geoand added the triage/needs-feedback We are waiting for feedback. label Dec 16, 2024
@DFMichelangelo
Copy link
Author

How do you come to this conclusion from running the tests? Asking because I ran the sample (which does indeed fail), but I don't see any obvious indication that import.sql was not executed in the proper time

Hi @geoand , thank you for having a look at my issue!
Mine is just a genuine guess, but it's more a perception rather than being based on facts: matter is that since the test is flaky, it's a challenge to "catch" the right steps that reproduce the issue by changing the test itself.

If it's not related to the import.sql (which means, we assume it's correctly loaded), what else could be?
Also, it's interesting to note that some tests pass, whereas some others don't

@yrodiere yrodiere removed the triage/needs-feedback We are waiting for feedback. label Dec 17, 2024
@gsmet
Copy link
Member

gsmet commented Dec 17, 2024

I dunno, I had a look at your log output and I can see the import.sql being executed there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hibernate-reactive Hibernate Reactive area/testing kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants