From 619a5a0e6302769f86c8e0c1cf48ef8f854a3111 Mon Sep 17 00:00:00 2001 From: Lukas Hanusovsky <61745358+lhanusov@users.noreply.github.com> Date: Tue, 24 Feb 2026 11:23:43 +0100 Subject: [PATCH] GH actions for ci.yaml workflow - testsuite deprecation check. (#46351) Signed-off-by: Lukas Hanusovsky --- .../testsuite-deprecation-check/action.yml | 17 ++++++++++++ .../deprecation-check.sh | 26 ++++++++++++++++++ .github/workflows/ci.yml | 13 +++++++++ testsuite/DEPRECATED.md | 27 +++++++++++++++++++ .../testsuite/AbstractKeycloakTest.java | 1 + .../testsuite/model/KeycloakModelTest.java | 1 + 6 files changed, 85 insertions(+) create mode 100644 .github/actions/testsuite-deprecation-check/action.yml create mode 100755 .github/actions/testsuite-deprecation-check/deprecation-check.sh create mode 100644 testsuite/DEPRECATED.md diff --git a/.github/actions/testsuite-deprecation-check/action.yml b/.github/actions/testsuite-deprecation-check/action.yml new file mode 100644 index 00000000000..4dd87467816 --- /dev/null +++ b/.github/actions/testsuite-deprecation-check/action.yml @@ -0,0 +1,17 @@ +name: Testsuite deprecation check +description: Check PR if there are changes in the old deprecated testsuite + +inputs: + token: + description: GitHub Token + required: true + +runs: + using: composite + steps: + - id: check-testsuite-changes + name: Check Old Testsuite changes in PR + shell: bash + run: .github/actions/testsuite-deprecation-check/deprecation-check.sh ${{ github.repository }} ${{ github.ref }} + env: + GITHUB_TOKEN: ${{ inputs.token }} diff --git a/.github/actions/testsuite-deprecation-check/deprecation-check.sh b/.github/actions/testsuite-deprecation-check/deprecation-check.sh new file mode 100755 index 00000000000..628f994d8f4 --- /dev/null +++ b/.github/actions/testsuite-deprecation-check/deprecation-check.sh @@ -0,0 +1,26 @@ +#!/bin/bash -e + +REPOSITORY="$1" +REF="$2" + +CHANGE_ID=$(echo $REF | cut -f 3 -d '/') + +echo "========================================================================================" +echo "Checking testsuite module additions/changes." +echo "----------------------------------------------------------------------------------------" + +ADDED_FILES=$(gh api -X GET --paginate repos/$REPOSITORY/pulls/$CHANGE_ID/files --jq 'map(select(.filename | contains("testsuite/")) | select (.status | contains("added")) | {filename}) | length') +CHANGED_FILES=$(gh api -X GET --paginate repos/$REPOSITORY/pulls/$CHANGE_ID/files --jq 'map(select(.filename | contains("testsuite/")) | select (.additions >= 50) | {filename}) | length') + +# Check if changed files matches regex +if [[ $ADDED_FILES > 0 || $CHANGED_FILES > 0 ]] ; then + echo "========================================================================================" + echo "Deprecated testsuite module: " + echo " * Adding new file(s) is forbidden." + echo " * Maximum 50 lines can be added to a single file." + echo "" + echo "Please, migrate the added/changed file(s) and use the new test framework instead." + echo "See: https://github.com/keycloak/keycloak/tree/main/testsuite/DEPRECATED.md for more details." + echo "----------------------------------------------------------------------------------------" + exit 1 +fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 44cfc097345..e8ec95b536d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -87,6 +87,18 @@ jobs: fi echo "run-additional-dbs-tests=$RUN_ADDITIONAL_DBS_TESTS" >> $GITHUB_OUTPUT + testsuite-deprecation-check: + name: Testsuite Deprecation Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 + + - id: conditional + uses: ./.github/actions/testsuite-deprecation-check + with: + token: ${{ secrets.GITHUB_TOKEN }} + + build: name: Build if: needs.conditional.outputs.ci == 'true' @@ -1252,6 +1264,7 @@ jobs: - base-new-integration-tests - mixed-cluster-compatibility-tests - admin-v2-tests + - testsuite-deprecation-check runs-on: ubuntu-latest steps: - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 diff --git a/testsuite/DEPRECATED.md b/testsuite/DEPRECATED.md new file mode 100644 index 00000000000..be12794bec3 --- /dev/null +++ b/testsuite/DEPRECATED.md @@ -0,0 +1,27 @@ +# Deprecating the Old Testsuite Module +If you find yourself reading this document, you are probably asked to migrate a test from your PR to use the new Test Framework. + +--- +With the release of the new Test Framework, this testsuite module, with all related dependents, is officially deprecated. + +Specifically speaking: +* **Arquillian** testsuite +* **Model** testsuite +* All related **utility** modules + +A limited amount of changes to existing tests are permitted, and should primarily be used to add test-cases when resolving bugs. Adding new files is not allowed. + +## Why Deprecated? +* The Arquillian framework is not a community maintained project anymore. +* It's using JUnit 4 +* The test configuration got messy over the years. +* Onboarding process has a steep learning curve. +* Adding new features is complex and non-trivial task. + +## How to Migrate Your Test? +The new Test Framework brings completely new test configuration and server lifecycle management. +It is tailored to quickly onboard and speed-up the feature development, or contributing a simple bug fix. + +Please, follow the new guidelines: +* [Test Framework](../test-framework/docs/README.md) +* [Migrating Tests](../tests/MANUAL_MIGRATION.md) \ No newline at end of file diff --git a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java index 17512d017f0..26c80744eba 100644 --- a/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java +++ b/testsuite/integration-arquillian/tests/base/src/test/java/org/keycloak/testsuite/AbstractKeycloakTest.java @@ -114,6 +114,7 @@ import static org.junit.Assert.assertEquals; * * @author tkyjovsk */ +@Deprecated(forRemoval = true) @RunWith(KcArquillian.class) @RunAsClient @FixMethodOrder(MethodSorters.NAME_ASCENDING) diff --git a/testsuite/model/src/test/java/org/keycloak/testsuite/model/KeycloakModelTest.java b/testsuite/model/src/test/java/org/keycloak/testsuite/model/KeycloakModelTest.java index cc83635e205..7f1dce683c7 100644 --- a/testsuite/model/src/test/java/org/keycloak/testsuite/model/KeycloakModelTest.java +++ b/testsuite/model/src/test/java/org/keycloak/testsuite/model/KeycloakModelTest.java @@ -127,6 +127,7 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; * If no parameters are set via this property, the tests derived from this class are skipped. * @author hmlnarik */ +@Deprecated(forRemoval = true) public abstract class KeycloakModelTest { private static final Logger LOG = Logger.getLogger(KeycloakModelParameters.class); private static final AtomicInteger FACTORY_COUNT = new AtomicInteger();