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 fail silently when Liquibase fails to initialize #231

Open
GeraldScott opened this issue Nov 1, 2021 · 0 comments
Open

Tests fail silently when Liquibase fails to initialize #231

GeraldScott opened this issue Nov 1, 2021 · 0 comments
Labels
bug Something isn't working

Comments

@GeraldScott
Copy link
Contributor

GeraldScott commented Nov 1, 2021

Describe the bug
If Liquibase fails to initialize when running ./mvnw test on a project, the tests that depend on the test database fail silently and do not log any errors.

The tests generate a Warning, but they run to completion and ./mvnw clean install will succeed even though multiple test suites have failed.

[INFO] Running com.mycompany.domain.AuthorityTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.153 s - in com.mycompany.domain.AuthorityTest
[INFO] Running com.mycompany.domain.UserTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.047 s - in com.mycompany.domain.UserTest
[INFO] Running com.mycompany.config.LocalDateProviderTest
[INFO] Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.034 s - in com.mycompany.config.LocalDateProviderTest
[INFO] Running com.mycompany.service.mapper.UserMapperTest
[INFO] Tests run: 8, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.046 s - in com.mycompany.service.mapper.UserMapperTest
[INFO] Running com.mycompany.ArchTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.711 s - in com.mycompany.ArchTest
[INFO] Running com.mycompany.web.rest.ManagementInfoResourceTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.86 s - in com.mycompany.web.rest.ManagementInfoResourceTest
[INFO] Running com.mycompany.web.rest.UserResourceTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 s - in com.mycompany.web.rest.UserResourceTest
[INFO] Running com.mycompany.web.rest.AccountResourceTest
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0 s - in com.mycompany.web.rest.AccountResourceTest
[INFO] Running com.mycompany.web.rest.UserJWTControllerTest
[WARNING] Tests run: 3, Failures: 0, Errors: 0, Skipped: 3, Time elapsed: 0.004 s - in com.mycompany.web.rest.UserJWTControllerTest
[INFO] 
[INFO] Results:
[INFO] 
[WARNING] Tests run: 17, Failures: 0, Errors: 0, Skipped: 3
[INFO] 
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.5:restore-instrumented-classes (restore-ut) @ jhipster ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jhipster ---
[INFO] Building jar: /tmp/gen-test/target/jhipster-1.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- quarkus-maven-plugin:1.12.1.Final:build (default) @ jhipster ---
[INFO] [org.jboss.threads] JBoss Threads version 3.2.0.Final
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.4.28.Final
[INFO] [io.quarkus.deployment.QuarkusAugmentor] Quarkus augmentation completed in 3903ms
[INFO] 
[INFO] --- maven-checkstyle-plugin:3.1.0:check (default) @ jhipster ---
[INFO] 
[INFO] --- jacoco-maven-plugin:0.8.5:report (report-ut) @ jhipster ---
[INFO] Loading execution data file /tmp/gen-test/target/jacoco/test/test.exec
[INFO] Analyzed bundle 'Jhipster' with 56 classes
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jhipster ---
[INFO] Installing /tmp/gen-test/target/jhipster-1.0.0-SNAPSHOT.jar to /home/geraldo/.m2/repository/com/mycompany/jhipster/1.0.0-SNAPSHOT/jhipster-1.0.0-SNAPSHOT.jar
[INFO] Installing /tmp/gen-test/pom.xml to /home/geraldo/.m2/repository/com/mycompany/jhipster/1.0.0-SNAPSHOT/jhipster-1.0.0-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  28.105 s
[INFO] Finished at: 2021-11-01T09:05:19+02:00
[INFO] ------------------------------------------------------------------------

To Reproduce
This issue was triggered by #230, but also occurs anytime that Liquibase fails to initialize. For example, if PostgreSQL is used for unit testing and the database is inconsistent, the same silent behaviour occurs.

If #230 has not been resolved, then you can reproduce the issue by running the generator in an empty folder and immediately running the tests with:

jhipster-quarkus
./mvnw test  

The tests will fail to run successfully because the H2 JDBC driver is missing, but they fail silently and just skip over the tests that depend on H2.

If #230 has been resolved, then the issue can also be reproduced when using PostgreSQL (or MySQL) instead of H2 under the following circumstances:

  • the test database is not running or is otherwise inaccessible
  • the checksums do not match
  • the database is in an inconsistent state
  • there are tables in the test database left-over from previous unsuccessful tests

Expected behaviour
Quarkus should report that the tests that depend on Liquibase have failed, instead of generating a Warning and just skipping them.

@vishal423 vishal423 added the bug Something isn't working label Apr 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants