--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/0c95a6cf-f22f-4ce0-8d1d-1d4c798283ecn%40googlegroups.com.
The QuarkusMainTest approach is for the “run and done” case. Continuous testing will work, it will discover your main, but it assumes that @Launch will run a command to completion and exit. It is quite possible that this may not apply to your use case, as you do expect something to start and keep running.
You might consider a custom Junit 5 Test extension.. they aren’t hard to write, and would give you better control over what is run (and how).
On Tue, Oct 26, 2021 at 2:09 AM Dominik Guhr <dg...@redhat.com> wrote:
Hey all,
I have some questions around the QuarkusMainTest and Quarkus(Main)IntegrationTest concepts, trying to create such tests for our Keycloak.X Distribution.
Context:
In our quarkus based Keycloak distribution, we're using the mutable-jar approach right now. We have a picocli wrapped with a /kc.[sh|bat] script, which could be used like this:
./kc.sh build -> runs reaugmentation with provided commands / applies new config (needs server restart when config is buildtime property).
./kc.sh start -> starts the actual Keycloak.X quarkus application in prod mode
./kc.sh start-dev -> starts the same in devmode.
./kc.sh show-config -> Print out the current configuration.
./kc.sh import -> Import data from a directory or a file.
...
Goals:
I want to provide the ability to create integrationtests for keycloak.x, which:
- have good IDE / debugging experience (Run everything in one jvm, no remote debugging needed if avoidable)
- rely on the great features of the Quarkus testing framework (e.g. using profiles, CDI, Mocking etc.)
What we tried so far:
- Using @QuarkusMainTest together with @Launch, to test command mode commands. But also, to test commands such as show-config or --help itself. So, in general: commands which are using plain picocli without starting the actual quarkus application.
- Using an extension to run ./kc.sh start / start-dev non-blocking in the same jvm, and have a LaunchResult.
Challenges:
1. Start of short-lived CLI-Commands:
For the @Launch command, it seems the KeycloakMainTestExtension.java class expects a quarkus instance to start/stop. For short-runnning commands, we just execute the picocli command and then do a system.exit(0). This atm leads to the test running, the IDE showing the logs, the tests being debuggable, but the actual test never getting executed, due to no startup/stop event.
2. Application startup using command mode:
We thought about writing an integration test which starts the application in prodmode (no http allowed, no ssl/tls setup given via config) and checks if the logs contain the respective error message as a starting point.
like so:
```
@Test
@Launch({ "start" })
public void testFailStartNoTls(LaunchResult result) {
Assertions.assertTrue(result.getOutput()
.contains("Key material not provided to setup HTTPS"));
}
```
This leads to Quarkus starting up, but "running forever" (until the timeout reached) and the actual test also never gets executed, because we have no launchresult with exit status. I think this is due to QuarkusMainTestExtension using BlockingStart when I understand correctly. So essentially, the challenge here would be to have a non-blocking start, and then some way to trigger the shutdown.
In general, I think about having integration tests like this:
1. run e.g. "./kc.sh build --http-enabled=true" via @Launch. (does the reaug under the hood). Check if new config is applied.
2. Run e.g. "./kc.sh show-config" or simply a "./kc.sh <command> --help" command (pure cli)
3. run "kc.sh start" via @Launch and try to make requests via restassured in the actual test.
So, to ask actual questions after wrapping up the challenges I face atm:
1. Are we doing something conceptually wrong here? It feels a bit like working against the framework. If so, please suggest a better way to do this.
2. Any Hint, codewise or else, is greatly appreciated to come over this challenges. I'd also be happy to contribute, but am lacking the understanding of all the quarkus test extensions atm.--
I know this is a bit vague, sorry for that. Will try to come back with more precise questions later when I had more time to investigate. I still wanted to post it here in hope of any feedback.
Regards,
Dominik
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/0c95a6cf-f22f-4ce0-8d1d-1d4c798283ecn%40googlegroups.com.
Thanks,Erin ------Erin Schnabel <ebul...@redhat.com>@ebullientworks --
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/CAJwjk9wb-XVonvFmHSrYDZxGHch%3DEBkds57fw7aDCNdEWxSbpA%40mail.gmail.com.
Hey all,I have some questions around the QuarkusMainTest and Quarkus(Main)IntegrationTest concepts, trying to create such tests for our Keycloak.X Distribution.Context:In our quarkus based Keycloak distribution, we're using the mutable-jar approach right now. We have a picocli wrapped with a /kc.[sh|bat] script, which could be used like this:./kc.sh build -> runs reaugmentation with provided commands / applies new config (needs server restart when config is buildtime property)../kc.sh start -> starts the actual Keycloak.X quarkus application in prod mode./kc.sh start-dev -> starts the same in devmode../kc.sh show-config -> Print out the current configuration../kc.sh import -> Import data from a directory or a file....Goals:I want to provide the ability to create integrationtests for keycloak.x, which:- have good IDE / debugging experience (Run everything in one jvm, no remote debugging needed if avoidable)- rely on the great features of the Quarkus testing framework (e.g. using profiles, CDI, Mocking etc.)What we tried so far:- Using @QuarkusMainTest together with @Launch, to test command mode commands. But also, to test commands such as show-config or --help itself. So, in general: commands which are using plain picocli without starting the actual quarkus application.- Using an extension to run ./kc.sh start / start-dev non-blocking in the same jvm, and have a LaunchResult.Challenges:1. Start of short-lived CLI-Commands:For the @Launch command, it seems the KeycloakMainTestExtension.java class expects a quarkus instance to start/stop. For short-runnning commands, we just execute the picocli command and then do a system.exit(0). This atm leads to the test running, the IDE showing the logs, the tests being debuggable, but the actual test never getting executed, due to no startup/stop event.
2. Application startup using command mode:We thought about writing an integration test which starts the application in prodmode (no http allowed, no ssl/tls setup given via config) and checks if the logs contain the respective error message as a starting point.like so:```@Test@Launch({ "start" })public void testFailStartNoTls(LaunchResult result) {Assertions.assertTrue(result.getOutput().contains("Key material not provided to setup HTTPS"));}```This leads to Quarkus starting up, but "running forever" (until the timeout reached) and the actual test also never gets executed, because we have no launchresult with exit status. I think this is due to QuarkusMainTestExtension using BlockingStart when I understand correctly. So essentially, the challenge here would be to have a non-blocking start, and then some way to trigger the shutdown.
In general, I think about having integration tests like this:
1. run e.g. "./kc.sh build --http-enabled=true" via @Launch. (does the reaug under the hood). Check if new config is applied.
2. Run e.g. "./kc.sh show-config" or simply a "./kc.sh <command> --help" command (pure cli)
3. run "kc.sh start" via @Launch and try to make requests via restassured in the actual test.
So, to ask actual questions after wrapping up the challenges I face atm:1. Are we doing something conceptually wrong here? It feels a bit like working against the framework. If so, please suggest a better way to do this.2. Any Hint, codewise or else, is greatly appreciated to come over this challenges. I'd also be happy to contribute, but am lacking the understanding of all the quarkus test extensions atm.I know this is a bit vague, sorry for that. Will try to come back with more precise questions later when I had more time to investigate. I still wanted to post it here in hope of any feedback.Regards,Dominik
--
This sounds like you just want a normal @QuarkusTest, but with the ability to pass parameters, basically something like: github.com/quarkusio/quarkus/compare/main...stuartwdouglas:startup-params?expand=1
If this is what you need I can add a test and get this in.
--
You received this message because you are subscribed to the Google Groups "Quarkus Development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to quarkus-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/567a614d-1406-4b06-b4dc-2531cd9b8ba8n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/c9678769-3e34-4be9-b27b-c899cf12c18fn%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/quarkus-dev/70291280-e061-47db-a71c-130cc6aa74a2n%40googlegroups.com.