79264128

Date: 2024-12-09 07:22:51
Score: 0.5
Natty:
Report link

The reason why there are 2 postgres instances spinned up is, because Quarkus also does that for you automatically when you’re running in the test and dev profiles.

You don’t need to explicitly create a QuarkusTestResourceLifecycleManager. As a matter of fact, you don’t need to specify your db url and do anything with Testcontainers.

Just write your test and a db is automatically spinned up for you. You don’t have to configure anything, this is all handled.

So you can remove all your code, except your test class and then it should look something like this:

quarkus:
  http:
    test-port: 9300

  datasource:
    db-kind: postgresql

  hibernate-orm:
    database:
      generation: none <--> drop-and-create is going to conflict with liquibase

  liquibase:
    enabled: true
    migrate-at-start: true
    change-log: classpath:db/dbChangelog-test.yaml
    default-schema-name: x
    validate-on-migrate: true

// quarkus will spin up postgres automatically from here
@QuarkusTest
@TestHTTPEndpoint(YourRestController.class) ---> this will automatically add the rootpath to RestAssured
class MyTest {

   ...
}

For more info check these links:

Reasons:
  • Blacklisted phrase (1): these links
  • RegEx Blacklisted phrase (1): check these links
  • Long answer (-1):
  • Has code block (-0.5):
Posted by: Serkan