From 1f940192f5c0bae38e5862780702b17ed7204b04 Mon Sep 17 00:00:00 2001 From: markiian Date: Fri, 21 Nov 2025 17:14:40 +0200 Subject: [PATCH 1/3] Make functional test compilation optional --- .github/workflows/pr-functional-tests.yml | 6 +- .../workflows/pr-module-functional-tests.yml | 10 +- docs/developers/functional-tests.md | 23 +-- extra/pom.xml | 2 - pom.xml | 185 ++++++++++-------- 5 files changed, 123 insertions(+), 103 deletions(-) diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index e3ac3ffcd10..51622c53f77 100644 --- a/.github/workflows/pr-functional-tests.yml +++ b/.github/workflows/pr-functional-tests.yml @@ -30,4 +30,8 @@ jobs: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn -B verify -DskipUnitTests=true -DskipModuleFunctionalTests=true -Dtests.max-container-count=5 -DdockerfileName=Dockerfile --file extra/pom.xml + run: mvn -B verify \ + -DskipUnitTests=true \ + -Drun-functional-tests=true \ + -DdockerfileName=Dockerfile \ + --file extra/pom.xml diff --git a/.github/workflows/pr-module-functional-tests.yml b/.github/workflows/pr-module-functional-tests.yml index d87fbe4857a..1753cbba4e1 100644 --- a/.github/workflows/pr-module-functional-tests.yml +++ b/.github/workflows/pr-module-functional-tests.yml @@ -30,7 +30,13 @@ jobs: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn package -DskipUnitTests=true --file extra/pom.xml + run: mvn package \ + -DskipUnitTests=true \ + --file extra/pom.xml - name: Run module tests - run: mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -Dtests.max-container-count=5 -DdockerfileName=Dockerfile-modules --file extra/pom.xml + run: mvn -B verify \ + -DskipUnitTests=true \ + -Drun-module-functional-tests=true + -DdockerfileName=Dockerfile-modules \ + --file extra/pom.xml diff --git a/docs/developers/functional-tests.md b/docs/developers/functional-tests.md index 523466fb0b0..0df7447be3a 100644 --- a/docs/developers/functional-tests.md +++ b/docs/developers/functional-tests.md @@ -32,21 +32,15 @@ To prepare the PBS image, follow these steps from the root directory: ## Running Functional Tests -You have two options for running functional tests: +To run functional tests without modules (extra/modules), use: -1. Use `mvn verify` to include all previous steps (including Java tests and modular tests) because Groovy runs in the `failsafe:integration-test` phase. -2. For functional tests only, use a more granular command: - -`mvn -B verify -DskipModuleFunctionalTests=true` +`mvn verify -Drun-functional-tests=true` ## Running Module Functional Tests -You have two options for running modular tests: - -1. Use `mvn verify -DdockerfileName=Dockerfile-modules` to include all previous steps (including Java tests and functional tests) because Groovy runs in the `failsafe:integration-test` phase. -2. For modular tests only, use a more granular command: +To run module-only functional tests, use: -`mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -DdockerfileName=Dockerfile-modules` +`mvn verify -Drun-module-functional-tests=true -DdockerfileName=Dockerfile-modules` ## Developing @@ -58,20 +52,17 @@ Functional tests need to have name template **.\*Spec.groovy** Primary Key will be inserted after saving instance into DB. - `/functional/service/PrebidServerService` - responsible for all PBS http calls. - `/functional/testcontainers/Dependencies` - stores dependencies and manages mySql and NetworkServiceContainer containers. -- `/functional/testcontainers/ErrorListener` - logs request and response in case of falling test. - `/functional/testcontainers/PbsConfig` - collects PBS properties. - `/functional/testcontainers/PbsServiceFactory` - manage PBS containers according to container limit. -- `/functional/testcontainers/PBSTestExtension` - allows to hook into a spec’s lifecycle to add ErrorListener using annotation `PBSTest`. - `/functional/testcontainers/TestcontainersExtension` - allow to hook into a spec’s lifecycle to start and stop support service containers using global extension. -- `/functional/testcontainers/container` - responsible for creating and configuring containers. -- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer. +- `/functional/testcontainers/container/*` - responsible for creating and configuring containers. +- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer. **Properties:** -`launchContainers` - responsible for starting the MockServer and the MySQLContainer container. Default value is false to not launch containers for unit tests. +`launchContainers` - responsible for starting the MockServer and MySQLContainer container. Default value is false to not launch containers for functional tests. `tests.max-container-count` - maximum number of simultaneously running PBS containers. Default value is 5. -`skipFunctionalTests` - allow to skip funtional tests. Default value is false. `skipUnitTests` - allow to skip unit tests. Default value is false. **Debug:** diff --git a/extra/pom.xml b/extra/pom.xml index cbf3012ff8d..712d9b879bb 100644 --- a/extra/pom.xml +++ b/extra/pom.xml @@ -66,8 +66,6 @@ false - false - true diff --git a/pom.xml b/pom.xml index 1c198a3df57..2b85742e298 100644 --- a/pom.xml +++ b/pom.xml @@ -375,6 +375,7 @@ false ${skipUnitTests} + spock @@ -384,22 +385,13 @@ true + ${mockserver.version} + ${project.version} + 5 + + false - - - functional-tests - - ${skipFunctionalTests} - - - - module-functional-tests - - ${skipModuleFunctionalTests} - - - org.codehaus.gmavenplus @@ -585,69 +577,6 @@ - - org.codehaus.gmavenplus - gmavenplus-plugin - - true - - - ${project.basedir}/src/test/groovy - - **/*.groovy - - - - - - - - compileTests - - - - - - org.apache.maven.plugins - maven-failsafe-plugin - - - ${mockserver.version} - ${project.version} - 5 - false - - - - - functional-tests - - integration-test - verify - - - - **/tests/module/**/*Spec - - - **/*Spec - - - - - module-functional-tests - - integration-test - verify - - - - **/tests/module/**/*Spec - - - - - org.apache.maven.plugins maven-compiler-plugin @@ -661,18 +590,110 @@ - - Container debugging + Run general functional tests without modules + + + run-functional-tests + true + + + + org.codehaus.gmavenplus + gmavenplus-plugin + + true + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + + + + + compileTests + + + + org.apache.maven.plugins maven-failsafe-plugin + + + general-functional-tests + + integration-test + verify + + + + **/tests/module/**/*Spec + + + **/*Spec + + + + + + + + + + Run only module functional tests + + + run-module-functional-tests + true + + + + + + org.codehaus.gmavenplus + gmavenplus-plugin - - true - + true + + + ${project.basedir}/src/test/groovy + + **/*.groovy + + + + + + + compileTests + + + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + module-functional-tests + + integration-test + verify + + + + **/tests/module/**/*Spec + + + + From a85bdd5207e73724705622fa2771d0b12c581a10 Mon Sep 17 00:00:00 2001 From: markiian Date: Mon, 24 Nov 2025 15:47:58 +0200 Subject: [PATCH 2/3] Revert "Container debugging profile" and update pr-*-functional-tests.yml files --- .github/workflows/pr-functional-tests.yml | 6 +-- .../workflows/pr-module-functional-tests.yml | 10 +---- pom.xml | 45 ++++++++++++++++--- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.github/workflows/pr-functional-tests.yml b/.github/workflows/pr-functional-tests.yml index 51622c53f77..cefe5d9db4e 100644 --- a/.github/workflows/pr-functional-tests.yml +++ b/.github/workflows/pr-functional-tests.yml @@ -30,8 +30,4 @@ jobs: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn -B verify \ - -DskipUnitTests=true \ - -Drun-functional-tests=true \ - -DdockerfileName=Dockerfile \ - --file extra/pom.xml + run: mvn -B verify -DskipUnitTests=true -Drun-functional-tests=true -DdockerfileName=Dockerfile --file extra/pom.xml diff --git a/.github/workflows/pr-module-functional-tests.yml b/.github/workflows/pr-module-functional-tests.yml index 1753cbba4e1..a731ed35247 100644 --- a/.github/workflows/pr-module-functional-tests.yml +++ b/.github/workflows/pr-module-functional-tests.yml @@ -30,13 +30,7 @@ jobs: java-version: ${{ matrix.java }} - name: Build with Maven - run: mvn package \ - -DskipUnitTests=true \ - --file extra/pom.xml + run: mvn package -DskipUnitTests=true --file extra/pom.xml - name: Run module tests - run: mvn -B verify \ - -DskipUnitTests=true \ - -Drun-module-functional-tests=true - -DdockerfileName=Dockerfile-modules \ - --file extra/pom.xml + run: mvn -B verify -DskipUnitTests=true -Drun-module-functional-tests=true -DdockerfileName=Dockerfile-modules --file extra/pom.xml diff --git a/pom.xml b/pom.xml index 2b85742e298..dfc30a1b737 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -372,7 +373,7 @@ ${maven-surefire-plugin.version} - false + true ${skipUnitTests} spock @@ -385,11 +386,6 @@ true - ${mockserver.version} - ${project.version} - 5 - - false @@ -589,6 +585,23 @@ + + + Container debugging + + + + org.apache.maven.plugins + maven-failsafe-plugin + + + true + + + + + + Run general functional tests without modules @@ -624,6 +637,15 @@ org.apache.maven.plugins maven-failsafe-plugin + + + ${mockserver.version} + ${project.version} + 5 + + false + + general-functional-tests @@ -680,6 +702,15 @@ org.apache.maven.plugins maven-failsafe-plugin + + + ${mockserver.version} + ${project.version} + 5 + + false + + module-functional-tests From 8393c427802b6e59b804e33eaf581761266a0b6a Mon Sep 17 00:00:00 2001 From: markiian Date: Thu, 27 Nov 2025 20:29:37 +0200 Subject: [PATCH 3/3] Add ability to enabling perform local run groovy tests with "Enabling functional tests" profiles --- pom.xml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index dfc30a1b737..c4dde28ea4b 100644 --- a/pom.xml +++ b/pom.xml @@ -373,7 +373,7 @@ ${maven-surefire-plugin.version} - true + false ${skipUnitTests} spock @@ -585,6 +585,25 @@ + + Enabling function tests + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + true + + ${skipUnitTests} + spock + + + + + Container debugging