Skip to content

Commit 1f94019

Browse files
committed
Make functional test compilation optional
1 parent c5d6611 commit 1f94019

5 files changed

Lines changed: 123 additions & 103 deletions

File tree

.github/workflows/pr-functional-tests.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,8 @@ jobs:
3030
java-version: ${{ matrix.java }}
3131

3232
- name: Build with Maven
33-
run: mvn -B verify -DskipUnitTests=true -DskipModuleFunctionalTests=true -Dtests.max-container-count=5 -DdockerfileName=Dockerfile --file extra/pom.xml
33+
run: mvn -B verify \
34+
-DskipUnitTests=true \
35+
-Drun-functional-tests=true \
36+
-DdockerfileName=Dockerfile \
37+
--file extra/pom.xml

.github/workflows/pr-module-functional-tests.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,13 @@ jobs:
3030
java-version: ${{ matrix.java }}
3131

3232
- name: Build with Maven
33-
run: mvn package -DskipUnitTests=true --file extra/pom.xml
33+
run: mvn package \
34+
-DskipUnitTests=true \
35+
--file extra/pom.xml
3436

3537
- name: Run module tests
36-
run: mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -Dtests.max-container-count=5 -DdockerfileName=Dockerfile-modules --file extra/pom.xml
38+
run: mvn -B verify \
39+
-DskipUnitTests=true \
40+
-Drun-module-functional-tests=true
41+
-DdockerfileName=Dockerfile-modules \
42+
--file extra/pom.xml

docs/developers/functional-tests.md

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,15 @@ To prepare the PBS image, follow these steps from the root directory:
3232

3333
## Running Functional Tests
3434

35-
You have two options for running functional tests:
35+
To run functional tests without modules (extra/modules), use:
3636

37-
1. Use `mvn verify` to include all previous steps (including Java tests and modular tests) because Groovy runs in the `failsafe:integration-test` phase.
38-
2. For functional tests only, use a more granular command:
39-
40-
`mvn -B verify -DskipModuleFunctionalTests=true`
37+
`mvn verify -Drun-functional-tests=true`
4138

4239
## Running Module Functional Tests
4340

44-
You have two options for running modular tests:
45-
46-
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.
47-
2. For modular tests only, use a more granular command:
41+
To run module-only functional tests, use:
4842

49-
`mvn -B verify -DskipUnitTests=true -DskipFunctionalTests=true -DskipModuleFunctionalTests=false -DdockerfileName=Dockerfile-modules`
43+
`mvn verify -Drun-module-functional-tests=true -DdockerfileName=Dockerfile-modules`
5044

5145
## Developing
5246

@@ -58,20 +52,17 @@ Functional tests need to have name template **.\*Spec.groovy**
5852
Primary Key will be inserted after saving instance into DB.
5953
- `/functional/service/PrebidServerService` - responsible for all PBS http calls.
6054
- `/functional/testcontainers/Dependencies` - stores dependencies and manages mySql and NetworkServiceContainer containers.
61-
- `/functional/testcontainers/ErrorListener` - logs request and response in case of falling test.
6255
- `/functional/testcontainers/PbsConfig` - collects PBS properties.
6356
- `/functional/testcontainers/PbsServiceFactory` - manage PBS containers according to container limit.
64-
- `/functional/testcontainers/PBSTestExtension` - allows to hook into a spec’s lifecycle to add ErrorListener using annotation `PBSTest`.
6557
- `/functional/testcontainers/TestcontainersExtension` - allow to hook into a spec’s lifecycle to start and stop support service containers using global extension.
66-
- `/functional/testcontainers/container` - responsible for creating and configuring containers.
67-
- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer.
58+
- `/functional/testcontainers/container/*` - responsible for creating and configuring containers.
59+
- `/functional/testcontainers/scaffolding/NetworkScaffolding` - makes HTTP requests to a MockServer.
6860

6961

7062
**Properties:**
7163

72-
`launchContainers` - responsible for starting the MockServer and the MySQLContainer container. Default value is false to not launch containers for unit tests.
64+
`launchContainers` - responsible for starting the MockServer and MySQLContainer container. Default value is false to not launch containers for functional tests.
7365
`tests.max-container-count` - maximum number of simultaneously running PBS containers. Default value is 5.
74-
`skipFunctionalTests` - allow to skip funtional tests. Default value is false.
7566
`skipUnitTests` - allow to skip unit tests. Default value is false.
7667

7768
**Debug:**

extra/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@
6666

6767
<!-- Test properties -->
6868
<skipUnitTests>false</skipUnitTests>
69-
<skipFunctionalTests>false</skipFunctionalTests>
70-
<skipModuleFunctionalTests>true</skipModuleFunctionalTests>
7169
</properties>
7270

7371
<modules>

pom.xml

Lines changed: 103 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@
375375
<launchContainers>false</launchContainers>
376376
</systemPropertyVariables>
377377
<skipTests>${skipUnitTests}</skipTests>
378+
<excludeJUnit5Engines>spock</excludeJUnit5Engines>
378379
</configuration>
379380
</plugin>
380381
<plugin>
@@ -384,22 +385,13 @@
384385
<configuration>
385386
<systemPropertyVariables>
386387
<launchContainers>true</launchContainers>
388+
<mockserver.version>${mockserver.version}</mockserver.version>
389+
<pbs.version>${project.version}</pbs.version>
390+
<tests.max-container-count>5</tests.max-container-count>
391+
<!-- Run only one application container instance on fixed ports for debugging purposes -->
392+
<tests.fixed-container-ports>false</tests.fixed-container-ports>
387393
</systemPropertyVariables>
388394
</configuration>
389-
<executions>
390-
<execution>
391-
<id>functional-tests</id>
392-
<configuration>
393-
<skip>${skipFunctionalTests}</skip>
394-
</configuration>
395-
</execution>
396-
<execution>
397-
<id>module-functional-tests</id>
398-
<configuration>
399-
<skip>${skipModuleFunctionalTests}</skip>
400-
</configuration>
401-
</execution>
402-
</executions>
403395
</plugin>
404396
<plugin>
405397
<groupId>org.codehaus.gmavenplus</groupId>
@@ -585,69 +577,6 @@
585577
</execution>
586578
</executions>
587579
</plugin>
588-
<plugin>
589-
<groupId>org.codehaus.gmavenplus</groupId>
590-
<artifactId>gmavenplus-plugin</artifactId>
591-
<configuration>
592-
<parallelParsing>true</parallelParsing>
593-
<testSources>
594-
<testSource>
595-
<directory>${project.basedir}/src/test/groovy</directory>
596-
<includes>
597-
<include>**/*.groovy</include>
598-
</includes>
599-
</testSource>
600-
</testSources>
601-
</configuration>
602-
<executions>
603-
<execution>
604-
<goals>
605-
<goal>compileTests</goal>
606-
</goals>
607-
</execution>
608-
</executions>
609-
</plugin>
610-
<plugin>
611-
<groupId>org.apache.maven.plugins</groupId>
612-
<artifactId>maven-failsafe-plugin</artifactId>
613-
<configuration>
614-
<systemPropertyVariables>
615-
<mockserver.version>${mockserver.version}</mockserver.version>
616-
<pbs.version>${project.version}</pbs.version>
617-
<tests.max-container-count>5</tests.max-container-count>
618-
<tests.fixed-container-ports>false</tests.fixed-container-ports>
619-
</systemPropertyVariables>
620-
</configuration>
621-
<executions>
622-
<execution>
623-
<id>functional-tests</id>
624-
<goals>
625-
<goal>integration-test</goal>
626-
<goal>verify</goal>
627-
</goals>
628-
<configuration>
629-
<excludes>
630-
<exclude>**/tests/module/**/*Spec</exclude>
631-
</excludes>
632-
<includes>
633-
<include>**/*Spec</include>
634-
</includes>
635-
</configuration>
636-
</execution>
637-
<execution>
638-
<id>module-functional-tests</id>
639-
<goals>
640-
<goal>integration-test</goal>
641-
<goal>verify</goal>
642-
</goals>
643-
<configuration>
644-
<includes>
645-
<include>**/tests/module/**/*Spec</include>
646-
</includes>
647-
</configuration>
648-
</execution>
649-
</executions>
650-
</plugin>
651580
<plugin>
652581
<groupId>org.apache.maven.plugins</groupId>
653582
<artifactId>maven-compiler-plugin</artifactId>
@@ -661,18 +590,110 @@
661590

662591
<profiles>
663592
<profile>
664-
<!-- Run only one application container instance on fixed ports for debugging purposes -->
665-
<id>Container debugging</id>
593+
<id>Run general functional tests without modules</id>
594+
<activation>
595+
<property>
596+
<name>run-functional-tests</name>
597+
<value>true</value>
598+
</property>
599+
</activation>
666600
<build>
667601
<plugins>
602+
<plugin>
603+
<groupId>org.codehaus.gmavenplus</groupId>
604+
<artifactId>gmavenplus-plugin</artifactId>
605+
<configuration>
606+
<parallelParsing>true</parallelParsing>
607+
<testSources>
608+
<testSource>
609+
<directory>${project.basedir}/src/test/groovy</directory>
610+
<includes>
611+
<include>**/*.groovy</include>
612+
</includes>
613+
</testSource>
614+
</testSources>
615+
</configuration>
616+
<executions>
617+
<execution>
618+
<goals>
619+
<goal>compileTests</goal>
620+
</goals>
621+
</execution>
622+
</executions>
623+
</plugin>
668624
<plugin>
669625
<groupId>org.apache.maven.plugins</groupId>
670626
<artifactId>maven-failsafe-plugin</artifactId>
627+
<executions>
628+
<execution>
629+
<id>general-functional-tests</id>
630+
<goals>
631+
<goal>integration-test</goal>
632+
<goal>verify</goal>
633+
</goals>
634+
<configuration>
635+
<excludes>
636+
<exclude>**/tests/module/**/*Spec</exclude>
637+
</excludes>
638+
<includes>
639+
<include>**/*Spec</include>
640+
</includes>
641+
</configuration>
642+
</execution>
643+
</executions>
644+
</plugin>
645+
</plugins>
646+
</build>
647+
</profile>
648+
<profile>
649+
<id>Run only module functional tests</id>
650+
<activation>
651+
<property>
652+
<name>run-module-functional-tests</name>
653+
<value>true</value>
654+
</property>
655+
</activation>
656+
<build>
657+
<plugins>
658+
<plugin>
659+
<groupId>org.codehaus.gmavenplus</groupId>
660+
<artifactId>gmavenplus-plugin</artifactId>
671661
<configuration>
672-
<systemPropertyVariables>
673-
<tests.fixed-container-ports>true</tests.fixed-container-ports>
674-
</systemPropertyVariables>
662+
<parallelParsing>true</parallelParsing>
663+
<testSources>
664+
<testSource>
665+
<directory>${project.basedir}/src/test/groovy</directory>
666+
<includes>
667+
<include>**/*.groovy</include>
668+
</includes>
669+
</testSource>
670+
</testSources>
675671
</configuration>
672+
<executions>
673+
<execution>
674+
<goals>
675+
<goal>compileTests</goal>
676+
</goals>
677+
</execution>
678+
</executions>
679+
</plugin>
680+
<plugin>
681+
<groupId>org.apache.maven.plugins</groupId>
682+
<artifactId>maven-failsafe-plugin</artifactId>
683+
<executions>
684+
<execution>
685+
<id>module-functional-tests</id>
686+
<goals>
687+
<goal>integration-test</goal>
688+
<goal>verify</goal>
689+
</goals>
690+
<configuration>
691+
<includes>
692+
<include>**/tests/module/**/*Spec</include>
693+
</includes>
694+
</configuration>
695+
</execution>
696+
</executions>
676697
</plugin>
677698
</plugins>
678699
</build>

0 commit comments

Comments
 (0)