79202818

Date: 2024-11-19 09:29:40
Score: 2.5
Natty:
Report link

I encountered the same issue, so I implemented the following solution to pass my tests. All my endpoints are annotated with @IfBuildProfile. For my tests, I used the @QuarkusTest annotation (I’m not sure if this would work with @QuarkusIntegrationTest).

To handle different profiles, I created two utility classes for my profiles, which look like this:

class ReadTestProfile : QuarkusTestProfile { override fun getConfigProfile(): String { return "read" // Activate the "read" profile } }

Then, for my tests, I annotated them with @TestProfile(ReadTestProfile::class). When the test runs, the build profile, which is set by default to test, changes, and I see the following log message:

INFO [io.quarkus] (main) Profile read activated. This confirms that the read profile is being used during the test.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • User mentioned (1): @IfBuildProfile
  • User mentioned (0): @QuarkusTest
  • User mentioned (0): @QuarkusIntegrationTest
  • Low reputation (1):
Posted by: Yacine