diff --git a/.github/workflows/pr-java-ci.yml b/.github/workflows/pr-java-ci.yml index 7e6e1dedb6a..611e84680e6 100644 --- a/.github/workflows/pr-java-ci.yml +++ b/.github/workflows/pr-java-ci.yml @@ -17,7 +17,7 @@ jobs: strategy: matrix: - java: [ 11 ] + java: [ 11, 17 ] steps: - uses: actions/checkout@v2 diff --git a/extra/bundle/pom.xml b/extra/bundle/pom.xml index a22e97f7758..175bb5a563a 100644 --- a/extra/bundle/pom.xml +++ b/extra/bundle/pom.xml @@ -21,8 +21,8 @@ 11 11 - 2.1.1.RELEASE - 2.10.0 + 2.5.6 + 2.13.0 4.5.13 diff --git a/extra/modules/pom.xml b/extra/modules/pom.xml index 93a084cf9e6..64e8dcdc748 100644 --- a/extra/modules/pom.xml +++ b/extra/modules/pom.xml @@ -28,7 +28,7 @@ 1.80.0-SNAPSHOT - 1.18.4 + 1.18.22 5.7.2 3.20.2 diff --git a/pom.xml b/pom.xml index 4f9ece75ebd..9601e11a464 100644 --- a/pom.xml +++ b/pom.xml @@ -1,5 +1,6 @@ - + 4.0.0 @@ -21,23 +22,23 @@ UTF-8 UTF-8 - 11 - 11 11 + ${java.version} + ${java.version} - 2.1.1.RELEASE + 2.5.6 1.3.1 2.0.1.Final 6.1.5.Final - 3.8.3 - 1.18.4 + 3.9.10 + 1.18.22 3.6 4.1 1.21 4.5.13 5.3.1 - 2.12.5 + 2.13.0 0.1.7 1.13 8.0.16 @@ -53,19 +54,20 @@ 4.13.2 + 5.8.1 4.0.0 + 4.0.0 3.21.0 - 2.27.2 + 2.31.0 4.1.0 9.4.43.v20210629 - 3.0.7 + 4.4.0 1.4.200 - 1.3-groovy-2.5 - 1.15.3 + 2.0-groovy-3.0 + 1.16.2 5.11.2 - 2.14.0 + 2.16.1 1.9.7 - 3.3.0 1.4.200 1.11.19 @@ -73,13 +75,13 @@ 3.1.0 8.29 1.2.0 - 0.8.2 + 0.8.7 2.2.4 3.8.0 2.22.2 ${maven-surefire-plugin.version} 0.36.0 - 1.12.1 + 1.13.0 2.10.0 false false @@ -324,12 +326,24 @@ ${junit.version} test + + org.junit.vintage + junit-vintage-engine + ${junit-jupiter.version} + test + org.mockito mockito-core ${mockito.version} test + + org.mockito + mockito-junit-jupiter + ${mockito-junit-jupiter.version} + test + org.assertj assertj-core @@ -467,12 +481,6 @@ ${testcontainers.version} test - - org.testcontainers - spock - ${testcontainers.version} - test - org.testcontainers mockserver @@ -493,8 +501,9 @@ io.qameta.allure - allure-spock + allure-java-commons ${allure.version} + test @@ -512,6 +521,9 @@ maven-surefire-plugin ${maven-surefire-plugin.version} + + false + ${skipUnitTests} @@ -520,6 +532,9 @@ maven-failsafe-plugin ${maven-failsafe-plugin.version} + + true + ${skipFunctionalTests} @@ -768,4 +783,18 @@ + + + + Java 17 + + [17,) + + + 17 + ${java.version} + ${java.version} + + + diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy index 585a327bf52..20b870dc337 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy @@ -8,6 +8,8 @@ import org.testcontainers.lifecycle.Startables class Dependencies { + private static final Boolean IS_LAUNCH_CONTAINERS = Boolean.valueOf(System.getProperty("launchContainers")) + static final ObjectMapperWrapper objectMapperWrapper = new ObjectMapperWrapper() static final Network network = Network.newNetwork() @@ -23,13 +25,17 @@ class Dependencies { .withNetwork(network) static void start() { - Startables.deepStart([networkServiceContainer, mysqlContainer]) - .join() + if (IS_LAUNCH_CONTAINERS) { + Startables.deepStart([networkServiceContainer, mysqlContainer]) + .join() + } } static void stop() { - [networkServiceContainer, mysqlContainer].parallelStream() - .forEach({ it.stop() }) + if (IS_LAUNCH_CONTAINERS) { + [networkServiceContainer, mysqlContainer].parallelStream() + .forEach({ it.stop() }) + } } private Dependencies() {} // should not be instantiated diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/container/NetworkServiceContainer.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/container/NetworkServiceContainer.groovy index eadeb5bbbf6..107d14d7ee4 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/container/NetworkServiceContainer.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/container/NetworkServiceContainer.groovy @@ -2,11 +2,12 @@ package org.prebid.server.functional.testcontainers.container import org.testcontainers.containers.MockServerContainer import org.testcontainers.containers.Network +import org.testcontainers.utility.DockerImageName class NetworkServiceContainer extends MockServerContainer { NetworkServiceContainer(String version) { - super(version) + super(DockerImageName.parse("mockserver/mockserver:mockserver-$version")) } String getHostAndPort() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy index f972616961a..f6516c6d0cc 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy @@ -60,7 +60,7 @@ class AuctionSpec extends BaseSpec { } @Unroll - def "PBS should prefer timeout from the auction request when stored request timeout is #tmax"() { + def "PBS should prefer timeout from the auction request"() { given: "Default basic BidRequest with generic bidder" def timeout = getRandomTimeout() def bidRequest = BidRequest.defaultBidRequest.tap { diff --git a/src/test/groovy/org/prebid/server/functional/util/AllureReporter.groovy b/src/test/groovy/org/prebid/server/functional/util/AllureReporter.groovy new file mode 100644 index 00000000000..e2065b936cf --- /dev/null +++ b/src/test/groovy/org/prebid/server/functional/util/AllureReporter.groovy @@ -0,0 +1,256 @@ +package org.prebid.server.functional.util + +import io.qameta.allure.Allure +import io.qameta.allure.AllureLifecycle +import io.qameta.allure.Description +import io.qameta.allure.Flaky +import io.qameta.allure.Muted +import io.qameta.allure.model.Label +import io.qameta.allure.model.Link +import io.qameta.allure.model.Parameter +import io.qameta.allure.model.Status +import io.qameta.allure.model.StatusDetails +import io.qameta.allure.model.TestResult +import io.qameta.allure.util.AnnotationUtils +import org.spockframework.runtime.AbstractRunListener +import org.spockframework.runtime.extension.IGlobalExtension +import org.spockframework.runtime.model.ErrorInfo +import org.spockframework.runtime.model.FeatureInfo +import org.spockframework.runtime.model.IterationInfo +import org.spockframework.runtime.model.MethodInfo +import org.spockframework.runtime.model.SpecInfo + +import java.lang.annotation.Annotation +import java.lang.annotation.Repeatable +import java.lang.reflect.Method +import java.security.MessageDigest +import java.security.NoSuchAlgorithmException +import java.util.stream.Collectors +import java.util.stream.Stream + +import static io.qameta.allure.util.ResultsUtils.createFrameworkLabel +import static io.qameta.allure.util.ResultsUtils.createHostLabel +import static io.qameta.allure.util.ResultsUtils.createLanguageLabel +import static io.qameta.allure.util.ResultsUtils.createPackageLabel +import static io.qameta.allure.util.ResultsUtils.createParameter +import static io.qameta.allure.util.ResultsUtils.createParentSuiteLabel +import static io.qameta.allure.util.ResultsUtils.createSubSuiteLabel +import static io.qameta.allure.util.ResultsUtils.createSuiteLabel +import static io.qameta.allure.util.ResultsUtils.createTestClassLabel +import static io.qameta.allure.util.ResultsUtils.createTestMethodLabel +import static io.qameta.allure.util.ResultsUtils.createThreadLabel +import static io.qameta.allure.util.ResultsUtils.firstNonEmpty +import static io.qameta.allure.util.ResultsUtils.getProvidedLabels +import static io.qameta.allure.util.ResultsUtils.getStatus +import static io.qameta.allure.util.ResultsUtils.getStatusDetails +import static java.nio.charset.StandardCharsets.UTF_8 +import static java.util.Comparator.comparing + +/** + * This is a temporary port of https://github.com/allure-framework/allure-java/tree/master/allure-spock to add support + * for Spock 2.0. + * **/ +class AllureReporter extends AbstractRunListener implements IGlobalExtension { + + private static final String FRAMEWORK = "spock" + private static final String LANGUAGE = "groovy" + private static final String MD5 = "md5" + + private final ThreadLocal testUuid + = InheritableThreadLocal.withInitial({ UUID.randomUUID().toString() }) + + private final AllureLifecycle lifecycle + + AllureReporter() { + this(Allure.getLifecycle()) + } + + AllureReporter(AllureLifecycle lifecycle) { + this.lifecycle = lifecycle + } + + @Override + void visitSpec(SpecInfo spec) { + spec.addListener(this) + } + + @Override + void beforeIteration(IterationInfo iteration) { + String uuid = testUuid.get() + FeatureInfo feature = iteration.feature + SpecInfo spec = feature.spec + List parameters = getParameters(iteration.dataVariables) + SpecInfo subSpec = spec.subSpec + SpecInfo superSpec = spec.superSpec + String packageName = spec.package + String specName = spec.name + String testClassName = spec.reflection.name + String testMethodName = iteration.name + + List