From 8a661fb8310f80c6560ba55193e5ebbbc0a843d4 Mon Sep 17 00:00:00 2001 From: Sergey Beryozkin Date: Mon, 18 Jan 2021 16:50:43 +0000 Subject: [PATCH] Fix and get OIDC client tests running in CI native builds --- .github/native-tests.json | 2 +- extensions/oidc-client-filter/deployment/pom.xml | 4 ++-- extensions/oidc-client/deployment/pom.xml | 4 ++-- .../java/io/quarkus/oidc/client/runtime/TokensHelper.java | 3 +++ integration-tests/oidc-client/pom.xml | 4 ++-- .../oidc-client/src/main/resources/application.properties | 3 ++- .../test/java/io/quarkus/it/keycloak/OidcClientTest.java | 7 ++++++- integration-tests/oidc-token-propagation/pom.xml | 4 ++-- 8 files changed, 20 insertions(+), 11 deletions(-) diff --git a/.github/native-tests.json b/.github/native-tests.json index 06e2018931d4b..4c622490d5d9e 100644 --- a/.github/native-tests.json +++ b/.github/native-tests.json @@ -75,7 +75,7 @@ { "category": "Security2", "timeout": 70, - "test-modules": "oidc oidc-code-flow oidc-tenancy keycloak-authorization oidc-client oidc-wiremock" + "test-modules": "oidc oidc-code-flow oidc-tenancy keycloak-authorization oidc-client oidc-token-propagation oidc-wiremock" }, { "category": "Security3", diff --git a/extensions/oidc-client-filter/deployment/pom.xml b/extensions/oidc-client-filter/deployment/pom.xml index d4fb149eff4e4..9c519d73d5399 100644 --- a/extensions/oidc-client-filter/deployment/pom.xml +++ b/extensions/oidc-client-filter/deployment/pom.xml @@ -96,7 +96,7 @@ test-keycloak - test-keycloak + test-containers @@ -118,7 +118,7 @@ docker-keycloak - docker + start-containers diff --git a/extensions/oidc-client/deployment/pom.xml b/extensions/oidc-client/deployment/pom.xml index 18891918d86f0..d4169813c2c46 100644 --- a/extensions/oidc-client/deployment/pom.xml +++ b/extensions/oidc-client/deployment/pom.xml @@ -120,7 +120,7 @@ test-keycloak - test-keycloak + test-containers @@ -142,7 +142,7 @@ docker-keycloak - docker + start-containers diff --git a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java index 013a50e01ae08..c1b7ac0e1791c 100644 --- a/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java +++ b/extensions/oidc-client/runtime/src/main/java/io/quarkus/oidc/client/runtime/TokensHelper.java @@ -9,6 +9,9 @@ public class TokensHelper { + @SuppressWarnings("unused") + private volatile TokenRequestState tokenRequestState; + private static final AtomicReferenceFieldUpdater tokenRequestStateUpdater = AtomicReferenceFieldUpdater .newUpdater(TokensHelper.class, TokenRequestState.class, "tokenRequestState"); diff --git a/integration-tests/oidc-client/pom.xml b/integration-tests/oidc-client/pom.xml index 2d5effbcd5fe9..7586a2e1b537c 100644 --- a/integration-tests/oidc-client/pom.xml +++ b/integration-tests/oidc-client/pom.xml @@ -136,7 +136,7 @@ test-keycloak - test-keycloak + test-containers @@ -236,7 +236,7 @@ docker-keycloak - docker + start-containers diff --git a/integration-tests/oidc-client/src/main/resources/application.properties b/integration-tests/oidc-client/src/main/resources/application.properties index fc5699c096d79..16b0fc90d9808 100644 --- a/integration-tests/oidc-client/src/main/resources/application.properties +++ b/integration-tests/oidc-client/src/main/resources/application.properties @@ -13,6 +13,7 @@ io.quarkus.it.keycloak.ProtectedResourceServiceRegisterProvider/mp-rest/url=http io.quarkus.it.keycloak.ProtectedResourceServiceOidcClient/mp-rest/url=http://localhost:8081/protected io.quarkus.it.keycloak.ProtectedResourceServiceNoOidcClient/mp-rest/url=http://localhost:8081/protected +quarkus.log.category."io.quarkus.oidc.client.runtime.OidcClientImpl".min-level=TRACE quarkus.log.category."io.quarkus.oidc.client.runtime.OidcClientImpl".level=TRACE quarkus.log.file.enable=true -quarkus.log.file.format=%C - %s%n \ No newline at end of file +quarkus.log.file.format=%C - %s%n diff --git a/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java b/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java index 1744ab84f43ac..8c3e20cd5f255 100644 --- a/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java +++ b/integration-tests/oidc-client/src/test/java/io/quarkus/it/keycloak/OidcClientTest.java @@ -85,7 +85,12 @@ private void checkLog() { .untilAsserted(new ThrowingRunnable() { @Override public void run() throws Throwable { - final Path accessLogFilePath = logDirectory.resolve("quarkus.log"); + Path accessLogFilePath = logDirectory.resolve("quarkus.log"); + boolean fileExists = Files.exists(accessLogFilePath); + if (!fileExists) { + accessLogFilePath = logDirectory.resolve("target/quarkus.log"); + fileExists = Files.exists(accessLogFilePath); + } Assertions.assertTrue(Files.exists(accessLogFilePath), "quarkus log file " + accessLogFilePath + " is missing"); diff --git a/integration-tests/oidc-token-propagation/pom.xml b/integration-tests/oidc-token-propagation/pom.xml index 316345eaa289b..ced77765a31d1 100644 --- a/integration-tests/oidc-token-propagation/pom.xml +++ b/integration-tests/oidc-token-propagation/pom.xml @@ -131,7 +131,7 @@ test-keycloak - test-keycloak + test-containers @@ -231,7 +231,7 @@ docker-keycloak - docker + start-containers