question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add KeycloakTestResourceLifecycleManager

See original GitHub issue

Description In many OIDC related tests we have to add QuarkusTestResourceLifecycleManager implementations which setup Keycloak - realm, client, users. @stuartwdouglas has proposed that we provide the one which can be reused in tests, which is a nice idea.

Implementation ideas Users who would like to test quarkus-oidc against Keycloak should be able to type something like this:

@QuarkusTest
@QuarkusTestResource(TestKeycloakRealmResourceManager.class)
public class CodeFlowTest {

    @Test
    public void testCodeFlow() throws IOException {
    }
}

where TestKeycloakRealmResourceManager.class would by default set up quarkus realm, quarkus-app client, users alice as admin and bob as user, something like that, and possibly be configurable

CC @stuartwdouglas @pedroigor

@cemnura let me know please if it can be of interest once the wiremock issues are complete 😃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
gsmetcommented, Dec 22, 2020

It should be called KeycloakTestResourceLifecycleManager btw.

0reactions
cemnuracommented, Mar 26, 2021

I figured out that the current integration-tests/oidc runs a test container via maven plugin.

I migrated the QuarkusTestResourceLifecycleManager to a separate test-framework module and enabled the test container to run programmatically rather then a maven plugin.

All previous test seems to be working.

Also, I did not change the maven profile configurations so that it wont be a problem during CI pipeline.

To run the test

./mvnw -Dquickly
./mvnw package -f integration-tests/oidc -Ptest-keycloak             
Read more comments on GitHub >

github_iconTop Results From Across the Web

Server Developer Guide - Keycloak
To deploy a theme as an archive, create a JAR archive with the theme resources. Add a file META-INF/keycloak-themes.json to the archive that ......
Read more >
Mixed up Test configuration when using @ResourceArg
The lifecycle manager is working as expected; it appropriately starts/ doesn't start keycloak when configured either way.
Read more >
Integration Tests with Keycloak & Testcontainers (& Quarkus)
How to do proper unit and integration testing (and NOT integrated tests ) of your Keycloak based application with the help of Testcontainers ......
Read more >
quarkus/KeycloakTestResourceLifecycleManager.java at main
Go to file T · Go to line L · Copy path · Copy permalink.
Read more >
Testing Your Application - Quarkus
We also set the java.util.logging.manager system property to make sure ... the resource before Quarkus starts (e.g. configure a KeyCloak instance, add data ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found