From c6ddf01a460ef3dd16161db698ff635ee086a831 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Sun, 5 Jan 2025 20:09:27 +0200 Subject: [PATCH 01/24] Refactoring functional tests --- .../model/config/AdminConfig.groovy | 1 - .../model/config/EndpointExecutionPlan.groovy | 19 ++- .../model/config/ExecutionGroup.groovy | 8 +- .../model/config/ExecutionPlan.groovy | 9 +- ...{AbTest.groovy => ModularityAbTest.groovy} | 6 +- .../config/ModuleHookImplementation.groovy | 1 - .../model/{ => config}/ModuleName.groovy | 6 +- .../functional/model/config/Stage.groovy | 4 + .../model/config/StageExecutionPlan.groovy | 10 +- .../model/request/auction/UserExtData.groovy | 8 +- .../response/auction/AnalyticResult.groovy | 5 +- .../model/response/auction/ModuleValue.groovy | 2 +- .../response/auction/OpenxBidResponse.groovy | 1 - .../testcontainers/scaffolding/Bidder.groovy | 4 +- .../scaffolding/FloorsProvider.groovy | 2 +- .../scaffolding/PrebidCache.groovy | 2 +- .../server/functional/tests/AmpFpdSpec.groovy | 16 +-- .../functional/tests/AnalyticsSpec.groovy | 1 - .../server/functional/tests/BaseSpec.groovy | 6 + .../tests/BidExpResponseSpec.groovy | 7 -- .../tests/BidderInsensitiveCaseSpec.groovy | 4 +- .../tests/StoredResponseSpec.groovy | 2 +- .../functional/tests/TargetingSpec.groovy | 5 +- .../tests/module/AbTestingModuleSpec.groovy | 116 ++++++++++-------- .../tests/module/GeneralModuleSpec.groovy | 83 +++++++------ .../tests/module/ModuleBaseSpec.groovy | 77 +++++++----- .../AnalyticsTagsModuleSpec.groovy | 19 ++- .../ortb2blocking/Ortb2BlockingSpec.groovy | 98 ++++++--------- .../PbRequestCorrectionSpec.groovy | 46 ++++--- .../ResponseCorrectionSpec.groovy | 71 +++++------ .../richmedia/RichMediaFilterSpec.groovy | 97 ++++++++------- .../tests/privacy/ActivityTraceLogSpec.groovy | 4 +- .../functional/tests/privacy/CoppaSpec.groovy | 4 +- .../tests/privacy/GdprAmpSpec.groovy | 2 +- .../tests/privacy/GdprAuctionSpec.groovy | 2 +- .../GppTransmitUfpdActivitiesSpec.groovy | 36 +++--- .../functional/tests/privacy/LmtSpec.groovy | 4 +- .../tests/privacy/PrivacyBaseSpec.groovy | 2 +- .../tests/prometheus/PrometheusSpec.groovy | 6 +- .../functional/tests/storage/AmpS3Spec.groovy | 6 - .../tests/storage/AuctionS3Spec.groovy | 2 +- .../tests/storage/StorageBaseSpec.groovy | 1 - .../server/functional/util/HttpUtil.groovy | 1 - .../util/privacy/model/State.groovy | 3 +- 44 files changed, 426 insertions(+), 383 deletions(-) rename src/test/groovy/org/prebid/server/functional/model/config/{AbTest.groovy => ModularityAbTest.groovy} (84%) rename src/test/groovy/org/prebid/server/functional/model/{ => config}/ModuleName.groovy (66%) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/AdminConfig.groovy b/src/test/groovy/org/prebid/server/functional/model/config/AdminConfig.groovy index 755a47bcbaa..6b0b82f6015 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/AdminConfig.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/AdminConfig.groovy @@ -3,7 +3,6 @@ package org.prebid.server.functional.model.config import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/EndpointExecutionPlan.groovy b/src/test/groovy/org/prebid/server/functional/model/config/EndpointExecutionPlan.groovy index 9ded40849d0..94856f2e85c 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/EndpointExecutionPlan.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/EndpointExecutionPlan.groovy @@ -1,7 +1,6 @@ package org.prebid.server.functional.model.config import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName @ToString(includeNames = true, ignoreNulls = true) class EndpointExecutionPlan { @@ -9,8 +8,9 @@ class EndpointExecutionPlan { Map stages static EndpointExecutionPlan getModuleEndpointExecutionPlan(ModuleName name, List stages) { - new EndpointExecutionPlan(stages: stages.collectEntries { - it -> [(it): StageExecutionPlan.getModuleStageExecutionPlan(name, it)] } as Map) + new EndpointExecutionPlan(stages: stages.collectEntries { + it -> [(it): StageExecutionPlan.getModuleStageExecutionPlan(name, it)] + } as Map) } static EndpointExecutionPlan getModulesEndpointExecutionPlan(Map> modulesStages) { @@ -24,4 +24,17 @@ class EndpointExecutionPlan { } as Map ) } + + static EndpointExecutionPlan getModuleEndpointExecutionPlan(List modulesHooks) { + Map stages = [:] + modulesHooks.each { moduleHook -> + def stage = Stage.forValue(moduleHook) + if (!stages.containsKey(stage)) { + stages[stage] = StageExecutionPlan.getModuleStageExecutionPlan([moduleHook]) + } else { + stages[stage].addGroup(moduleHook) + } + } + new EndpointExecutionPlan(stages: stages) + } } diff --git a/src/test/groovy/org/prebid/server/functional/model/config/ExecutionGroup.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ExecutionGroup.groovy index 09e95d7753d..7a480e43028 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/ExecutionGroup.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ExecutionGroup.groovy @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) @@ -16,6 +15,13 @@ class ExecutionGroup { @JsonProperty("hook_sequence") List hookSequenceSnakeCase + static ExecutionGroup getModuleExecutionGroup(ModuleHookImplementation moduleHook) { + new ExecutionGroup().tap { + timeout = 100 + hookSequence = [new HookId(moduleCode: ModuleName.forValue(moduleHook).code, hookImplCode: moduleHook.code)] + } + } + static ExecutionGroup getModuleExecutionGroup(ModuleName name, Stage stage) { new ExecutionGroup().tap { timeout = 100 diff --git a/src/test/groovy/org/prebid/server/functional/model/config/ExecutionPlan.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ExecutionPlan.groovy index 653f8c8cbea..a651afc424e 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/ExecutionPlan.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ExecutionPlan.groovy @@ -3,15 +3,20 @@ package org.prebid.server.functional.model.config import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName + +import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) class ExecutionPlan { - List abTests + List abTests Map endpoints + static ExecutionPlan getSingleEndpointExecutionPlan(List moduleHook, Endpoint endpoint = OPENRTB2_AUCTION) { + new ExecutionPlan(endpoints: [(endpoint): EndpointExecutionPlan.getModuleEndpointExecutionPlan(moduleHook)]) + } + static ExecutionPlan getSingleEndpointExecutionPlan(Endpoint endpoint, ModuleName moduleName, List stage) { new ExecutionPlan(endpoints: [(endpoint): EndpointExecutionPlan.getModuleEndpointExecutionPlan(moduleName, stage)]) } diff --git a/src/test/groovy/org/prebid/server/functional/model/config/AbTest.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ModularityAbTest.groovy similarity index 84% rename from src/test/groovy/org/prebid/server/functional/model/config/AbTest.groovy rename to src/test/groovy/org/prebid/server/functional/model/config/ModularityAbTest.groovy index baa19a80db4..8bb2cae77e1 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/AbTest.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ModularityAbTest.groovy @@ -7,7 +7,7 @@ import groovy.transform.ToString @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) -class AbTest { +class ModularityAbTest { Boolean enabled String moduleCode @@ -21,8 +21,8 @@ class AbTest { @JsonProperty("log_analytics_tag") Boolean logAnalyticsTagSnakeCase - static AbTest getDefault(String moduleCode, List accounts = null) { - new AbTest(enabled: true, + static ModularityAbTest getDefault(String moduleCode, List accounts = null) { + new ModularityAbTest(enabled: true, moduleCode: moduleCode, accounts: accounts, percentActive: 0, diff --git a/src/test/groovy/org/prebid/server/functional/model/config/ModuleHookImplementation.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ModuleHookImplementation.groovy index 247bdea4353..0959ccb6c19 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/ModuleHookImplementation.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ModuleHookImplementation.groovy @@ -1,7 +1,6 @@ package org.prebid.server.functional.model.config import com.fasterxml.jackson.annotation.JsonValue -import org.prebid.server.functional.model.ModuleName //TODO remove if module hooks implementation codes will become consistent enum ModuleHookImplementation { diff --git a/src/test/groovy/org/prebid/server/functional/model/ModuleName.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy similarity index 66% rename from src/test/groovy/org/prebid/server/functional/model/ModuleName.groovy rename to src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy index 2bc06ab7144..67ca94c833d 100644 --- a/src/test/groovy/org/prebid/server/functional/model/ModuleName.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy @@ -1,4 +1,4 @@ -package org.prebid.server.functional.model +package org.prebid.server.functional.model.config import com.fasterxml.jackson.annotation.JsonValue @@ -15,4 +15,8 @@ enum ModuleName { ModuleName(String code) { this.code = code } + + static ModuleName forValue(ModuleHookImplementation moduleHook) { + values().find { moduleHook.code.contains(it.code) } + } } diff --git a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy index 178f22552ae..3cc450219d9 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy @@ -24,6 +24,10 @@ enum Stage { this.metricValue = metricValue } + static Stage forValue(ModuleHookImplementation moduleHook) { + values().find { moduleHook.code.contains(it.value) } + } + @Override String toString() { value diff --git a/src/test/groovy/org/prebid/server/functional/model/config/StageExecutionPlan.groovy b/src/test/groovy/org/prebid/server/functional/model/config/StageExecutionPlan.groovy index b2fab91c200..81c4a8538ee 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/StageExecutionPlan.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/StageExecutionPlan.groovy @@ -1,7 +1,6 @@ package org.prebid.server.functional.model.config import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName @ToString(includeNames = true, ignoreNulls = true) class StageExecutionPlan { @@ -11,4 +10,13 @@ class StageExecutionPlan { static StageExecutionPlan getModuleStageExecutionPlan(ModuleName name, Stage stage) { new StageExecutionPlan(groups: [ExecutionGroup.getModuleExecutionGroup(name, stage)]) } + + static StageExecutionPlan getModuleStageExecutionPlan(List modulesHooks) { + new StageExecutionPlan(groups: modulesHooks.collect { ExecutionGroup.getModuleExecutionGroup(it) }) + } + + StageExecutionPlan addGroup(ModuleHookImplementation moduleHook) { + (groups ?: (groups = [])).add(ExecutionGroup.getModuleExecutionGroup(moduleHook)) + this + } } diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy index cb28895f37c..ad7cdf63390 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy @@ -7,15 +7,15 @@ import org.prebid.server.functional.util.PBSUtils class UserExtData { List keywords - String buyeruid - List buyeruids + String buyerUid + List buyerUids Geo geo static UserExtData getFPDUserExtData() { new UserExtData().tap { keywords = [PBSUtils.randomString] - buyeruid = PBSUtils.randomString - buyeruids = [PBSUtils.randomString] + buyerUid = PBSUtils.randomString + buyerUids = [PBSUtils.randomString] } } } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy index 7976ae24c2f..136fbc47e5e 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.EqualsAndHashCode import groovy.transform.ToString -import org.prebid.server.functional.model.request.auction.FetchStatus import org.prebid.server.functional.model.request.auction.Imp import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS @@ -15,12 +14,12 @@ import static org.prebid.server.functional.model.request.auction.FetchStatus.SUC class AnalyticResult { String name - FetchStatus status + String status List results static AnalyticResult buildFromImp(Imp imp) { def appliedTo = new AppliedTo(impIds: [imp.id], bidders: [imp.ext.prebid.bidder.configuredBidders.first()]) def impResult = new ImpResult(status: 'success-block', values: new ModuleValue(richmediaFormat: 'mraid'), appliedTo: appliedTo) - new AnalyticResult(name: 'reject-richmedia', status: SUCCESS, results: [impResult]) + new AnalyticResult(name: 'reject-richmedia', status: SUCCESS.value, results: [impResult]) } } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/ModuleValue.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/ModuleValue.groovy index 9a1e9d1b440..800f5a808bb 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/ModuleValue.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/ModuleValue.groovy @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.EqualsAndHashCode import groovy.transform.ToString -import org.prebid.server.functional.model.ModuleName +import org.prebid.server.functional.model.config.ModuleName @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.KebabCaseStrategy) diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy index 2ba60b226c1..b5d5289d5a6 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/OpenxBidResponse.groovy @@ -1,6 +1,5 @@ package org.prebid.server.functional.model.response.auction - import groovy.transform.ToString import org.prebid.server.functional.model.request.auction.BidRequest diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy index ff0b9f3b4f7..a0d1d4d8973 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy @@ -36,7 +36,7 @@ class Bidder extends NetworkScaffolding { request().withPath(AUCTION_ENDPOINT) } - HttpRequest getRequest(String bidRequestId, String requestMatchPath) { + static HttpRequest getRequest(String bidRequestId, String requestMatchPath) { request().withPath(AUCTION_ENDPOINT) .withBody(jsonPath("\$[?(@.$requestMatchPath == '$bidRequestId')]")) } @@ -68,7 +68,7 @@ class Bidder extends NetworkScaffolding { return getLastRecordedRequestHeaders(bidRequestId) } - private String getBodyByRequest(HttpRequest request) { + private static String getBodyByRequest(HttpRequest request) { def requestString = request.bodyAsString def jsonNode = toJsonNode(requestString) def id = jsonNode.get("id").asText() diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/FloorsProvider.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/FloorsProvider.groovy index 77c18b09088..a5393fa64b4 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/FloorsProvider.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/FloorsProvider.groovy @@ -37,7 +37,7 @@ class FloorsProvider extends NetworkScaffolding { : HttpResponse.notFoundResponse()} } - private String getDefaultResponse() { + private static String getDefaultResponse() { encode(PriceFloorData.priceFloorData) } } diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/PrebidCache.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/PrebidCache.groovy index 224f7c8b228..9396535b231 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/PrebidCache.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/PrebidCache.groovy @@ -76,7 +76,7 @@ class PrebidCache extends NetworkScaffolding { .withBody(jsonPath("\$.puts[?(@.value =~/^.*$payload.*\$/)]")) } - private String getBodyByRequest(HttpRequest request) { + private static String getBodyByRequest(HttpRequest request) { def requestString = request.bodyAsString def jsonNode = toJsonNode(requestString) def putsSize = jsonNode.get("puts").size() diff --git a/src/test/groovy/org/prebid/server/functional/tests/AmpFpdSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/AmpFpdSpec.groovy index 762c55fe879..9c52631656d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AmpFpdSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AmpFpdSpec.groovy @@ -74,8 +74,8 @@ class AmpFpdSpec extends BaseSpec { ampStoredRequest.user.geo.zip == user.geo.zip ampStoredRequest.user.geo.country == user.geo.country ampStoredRequest.user.ext.data.keywords == user.ext.data.keywords - ampStoredRequest.user.ext.data.buyeruid == user.ext.data.buyeruid - ampStoredRequest.user.ext.data.buyeruids == user.ext.data.buyeruids + ampStoredRequest.user.ext.data.buyerUid == user.ext.data.buyerUid + ampStoredRequest.user.ext.data.buyerUids == user.ext.data.buyerUids } and: "Bidder request shouldn't contain imp[0].ext.rp" @@ -195,8 +195,8 @@ class AmpFpdSpec extends BaseSpec { ortb2.user.gender == user.gender ortb2.user.keywords == user.keywords ortb2.user.ext.data.keywords == user.ext.data.keywords - ortb2.user.ext.data.buyeruid == user.ext.data.buyeruid - ortb2.user.ext.data.buyeruids == user.ext.data.buyeruids + ortb2.user.ext.data.buyerUid == user.ext.data.buyerUid + ortb2.user.ext.data.buyerUids == user.ext.data.buyerUids } and: "Bidder request shouldn't contain imp[0].ext.rp" @@ -289,8 +289,8 @@ class AmpFpdSpec extends BaseSpec { ampStoredRequest.user.geo.zip == user.geo.zip ampStoredRequest.user.geo.country == user.geo.country ampStoredRequest.user.ext.data.keywords == user.ext.data.keywords - ampStoredRequest.user.ext.data.buyeruid == user.ext.data.buyeruid - ampStoredRequest.user.ext.data.buyeruids == user.ext.data.buyeruids + ampStoredRequest.user.ext.data.buyerUid == user.ext.data.buyerUid + ampStoredRequest.user.ext.data.buyerUids == user.ext.data.buyerUids } } @@ -367,8 +367,8 @@ class AmpFpdSpec extends BaseSpec { ortb2.user.gender == user.gender ortb2.user.keywords == user.keywords ortb2.user.ext.data.keywords == user.ext.data.keywords - ortb2.user.ext.data.buyeruid == user.ext.data.buyeruid - ortb2.user.ext.data.buyeruids == user.ext.data.buyeruids + ortb2.user.ext.data.buyerUid == user.ext.data.buyerUid + ortb2.user.ext.data.buyerUids == user.ext.data.buyerUids } and: "Bidder request shouldn't contain imp[0].ext.rp" diff --git a/src/test/groovy/org/prebid/server/functional/tests/AnalyticsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/AnalyticsSpec.groovy index b113f649834..7d7d4469624 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AnalyticsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AnalyticsSpec.groovy @@ -28,7 +28,6 @@ class AnalyticsSpec extends BaseSpec { ENABLED_DEBUG_LOG_MODE + ['analytics.log.enabled' : 'true', 'analytics.global.adapters': '']) - @Shared PubStackAnalytics analytics = new PubStackAnalytics(Dependencies.networkServiceContainer).tap { it.setResponse(PubStackResponse.getDefaultPubStackResponse(SCOPE_ID, Dependencies.networkServiceContainer.rootUri)) diff --git a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy index fcb735d7186..3a5957d01cc 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy @@ -42,6 +42,12 @@ abstract class BaseSpec extends Specification implements ObjectMapperWrapper { private static final String DEFAULT_CACHE_DIRECTORY = "/app/prebid-server/data" protected static final Map GENERIC_ALIAS_CONFIG = ["adapters.generic.aliases.alias.enabled" : "true", "adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + protected static final Map EMPTY_CACHE_TTL_CONFIG = ["cache.default-ttl-seconds.banner": "", + "cache.default-ttl-seconds.video" : "", + "cache.default-ttl-seconds.native": "", + "cache.default-ttl-seconds.audio" : ""] + protected static final Map EMPTY_CACHE_TTL_HOST_CONFIG = ["cache.banner-ttl-seconds": "", + "cache.video-ttl-seconds" : ""] protected final PrebidServerService defaultPbsService = pbsServiceFactory.getService([:]) diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy index 6ca55f4b7bc..74ac930fa9d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy @@ -29,17 +29,10 @@ class BidExpResponseSpec extends BaseSpec { "cache.default-ttl-seconds.video" : VIDEO_TTL_DEFAULT_CACHE as String, "cache.default-ttl-seconds.native": NATIVE_TTL_DEFAULT_CACHE as String, "cache.default-ttl-seconds.audio" : AUDIO_TTL_DEFAULT_CACHE as String] - private static final Map EMPTY_CACHE_TTL_CONFIG = ["cache.default-ttl-seconds.banner": "", - "cache.default-ttl-seconds.video" : "", - "cache.default-ttl-seconds.native": "", - "cache.default-ttl-seconds.audio" : ""] - private static final Map EMPTY_CACHE_TTL_HOST_CONFIG = ["cache.banner-ttl-seconds": "", - "cache.video-ttl-seconds" : ""] private static def pbsOnlyHostCacheTtlService = pbsServiceFactory.getService(CACHE_TTL_HOST_CONFIG + EMPTY_CACHE_TTL_CONFIG) private static def pbsEmptyTtlService = pbsServiceFactory.getService(EMPTY_CACHE_TTL_CONFIG + EMPTY_CACHE_TTL_HOST_CONFIG) private static def pbsHostAndDefaultCacheTtlService = pbsServiceFactory.getService(CACHE_TTL_HOST_CONFIG + DEFAULT_CACHE_TTL_CONFIG) - def "PBS auction should resolve bid.exp from response that is set by the bidder’s adapter"() { given: "Default basicResponse with exp" def bidResponseExp = PBSUtils.randomNumber diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy index f2fb2803f1f..36f5332b7f5 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy @@ -109,8 +109,8 @@ class BidderInsensitiveCaseSpec extends BaseSpec { ortb2.user.gender == user.gender ortb2.user.keywords == user.keywords ortb2.user.ext.data.keywords == user.ext.data.keywords - ortb2.user.ext.data.buyeruid == user.ext.data.buyeruid - ortb2.user.ext.data.buyeruids == user.ext.data.buyeruids + ortb2.user.ext.data.buyerUid == user.ext.data.buyerUid + ortb2.user.ext.data.buyerUids == user.ext.data.buyerUids } and: "Bidder request shouldn't contain imp[0].ext.rp" diff --git a/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy index 767c4b8e544..467402dc331 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy @@ -18,7 +18,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.GENERIC class StoredResponseSpec extends BaseSpec { - private final PrebidServerService pbsService = pbsServiceFactory.getService(["cache.default-ttl-seconds.banner": ""]) + private final PrebidServerService pbsService = pbsServiceFactory.getService(EMPTY_CACHE_TTL_CONFIG) @PendingFeature def "PBS should not fail auction with storedAuctionResponse when request bidder params doesn't satisfy json-schema"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy index e24d22b4b8f..9cf3e9a6da9 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy @@ -476,7 +476,7 @@ class TargetingSpec extends BaseSpec { and: "Create and save stored response into DB" def storedBidResponse = BidResponse.getDefaultBidResponse(ampStoredRequest).tap { - seatbid[0].bid[0].price = max.plus(1) + seatbid[0].bid[0].price = max + 1 } def storedResponse = new StoredResponse(responseId: storedBidResponseId, storedBidResponse: storedBidResponse) storedResponseDao.save(storedResponse) @@ -509,7 +509,7 @@ class TargetingSpec extends BaseSpec { and: "Create and save stored response into DB" def storedBidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { - seatbid[0].bid[0].price = max.plus(1) + seatbid[0].bid[0].price = max + 1 } def storedResponse = new StoredResponse(responseId: storedBidResponseId, storedBidResponse: storedBidResponse) storedResponseDao.save(storedResponse) @@ -1301,7 +1301,6 @@ class TargetingSpec extends BaseSpec { def storedRequest = StoredRequest.getStoredRequest(ampRequest, ampStoredRequest) storedRequestDao.save(storedRequest) - and: "Account in the DB" def account = createAccountWithPriceGranularity(ampRequest.account, PBSUtils.getRandomEnum(PriceGranularityType)) accountDao.save(account) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 9ca353e0088..e7b2f8ded52 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -1,7 +1,7 @@ package org.prebid.server.functional.tests.module -import org.prebid.server.functional.model.ModuleName -import org.prebid.server.functional.model.config.AbTest +import org.prebid.server.functional.model.config.ModuleName +import org.prebid.server.functional.model.config.ModularityAbTest import org.prebid.server.functional.model.config.AccountConfig import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.ExecutionPlan @@ -15,7 +15,7 @@ import org.prebid.server.functional.model.response.auction.InvocationResult import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.util.PBSUtils -import static org.prebid.server.functional.model.ModuleName.PB_RESPONSE_CORRECTION +import static org.prebid.server.functional.model.config.ModuleName.PB_RESPONSE_CORRECTION import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_BIDDER_REQUEST import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_RAW_BIDDER_RESPONSE @@ -45,11 +45,19 @@ class AbTestingModuleSpec extends ModuleBaseSpec { private final static Map> RESPONSE_STAGES = [(ALL_PROCESSED_BID_RESPONSES): [PB_RESPONSE_CORRECTION]] private final static Map> MODULES_STAGES = ORTB_STAGES + RESPONSE_STAGES - private final static Map MULTI_MODULE_CONFIG = getResponseCorrectionConfig() + getOrtb2BlockingSettings() + + private final static Map MULTI_MODULE_CONFIG = getModuleBaseSettings(PB_RESPONSE_CORRECTION) + getModuleBaseSettings(ModuleName.ORTB2_BLOCKING) + ['hooks.host-execution-plan': null] - private final static PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getOrtb2BlockingSettings()) - private final static PrebidServerService pbsServiceWithMultipleModules = pbsServiceFactory.getService(MULTI_MODULE_CONFIG) + + private static PrebidServerService ortbModulePbsService + + def setupSpec() { + ortbModulePbsService = pbsServiceFactory.getService(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) + } + + def cleanupSpec() { + pbsServiceFactory.removeContainer(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) + } def "PBS shouldn't apply a/b test config when config of ab test is disabled"() { given: "Default bid request with verbose trace" @@ -59,7 +67,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { flushMetrics(ortbModulePbsService) and: "Save account with ab test config" - def abTest = AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + def abTest = ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { enabled = false } def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { @@ -95,7 +103,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def "PBS shouldn't apply valid a/b test config when module is disabled"() { given: "PBS service with disabled module config" - def pbsConfig = getOrtb2BlockingSettings(false) + def pbsConfig = getModuleBaseSettings(ModuleName.ORTB2_BLOCKING, false) def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" @@ -106,7 +114,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)] + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)] } def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(executionPlan: executionPlan)) def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) @@ -149,7 +157,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(moduleName)] + abTests = [ModularityAbTest.getDefault(moduleName)] } def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(executionPlan: executionPlan)) def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) @@ -190,10 +198,10 @@ class AbTestingModuleSpec extends ModuleBaseSpec { flushMetrics(pbsServiceWithMultipleModules) and: "Save account with ab test config" - def ortb2AbTestConfig = AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + def ortb2AbTestConfig = ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = MAX_PERCENT_AB } - def richMediaAbTestConfig = AbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { + def richMediaAbTestConfig = ModularityAbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { it.percentActive = MAX_PERCENT_AB } def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { @@ -213,7 +221,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].sort() + it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -224,7 +232,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -251,10 +259,10 @@ class AbTestingModuleSpec extends ModuleBaseSpec { flushMetrics(pbsServiceWithMultipleModules) and: "Save account with ab test config" - def ortb2AbTestConfig = AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + def ortb2AbTestConfig = ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = MIN_PERCENT_AB } - def richMediaAbTestConfig = AbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { + def richMediaAbTestConfig = ModularityAbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { it.percentActive = MIN_PERCENT_AB } def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { @@ -274,7 +282,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -285,7 +293,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -312,10 +320,10 @@ class AbTestingModuleSpec extends ModuleBaseSpec { flushMetrics(pbsServiceWithMultipleModules) and: "Save account with ab test config" - def ortb2AbTestConfig = AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + def ortb2AbTestConfig = ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = MIN_PERCENT_AB } - def richMediaAbTestConfig = AbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { + def richMediaAbTestConfig = ModularityAbTest.getDefault(PB_RESPONSE_CORRECTION.code).tap { it.percentActive = MAX_PERCENT_AB } def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { @@ -335,7 +343,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -346,7 +354,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -372,7 +380,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber]).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber]).tap { percentActive = MIN_PERCENT_AB }] } @@ -389,7 +397,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -409,7 +417,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = percentActive it.percentActiveSnakeCase = percentActiveSnakeCase }] @@ -427,7 +435,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].sort() + it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -458,7 +466,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = percentActive it.percentActiveSnakeCase = percentActiveSnakeCase }] @@ -476,7 +484,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -501,7 +509,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = percentActive it.percentActiveSnakeCase = percentActiveSnakeCase }] @@ -523,7 +531,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -548,7 +556,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { it.percentActive = percentActive it.percentActiveSnakeCase = percentActiveSnakeCase }] @@ -571,7 +579,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].sort() + it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -601,7 +609,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = MIN_PERCENT_AB it.logAnalyticsTag = logAnalyticsTag it.logAnalyticsTagSnakeCase = logAnalyticsTagSnakeCase @@ -620,7 +628,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -646,7 +654,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = MIN_PERCENT_AB it.logAnalyticsTag = logAnalyticsTag it.logAnalyticsTagSnakeCase = logAnalyticsTagSnakeCase @@ -689,7 +697,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = MAX_PERCENT_AB it.logAnalyticsTag = logAnalyticsTag it.logAnalyticsTagSnakeCase = logAnalyticsTagSnakeCase @@ -737,7 +745,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = PBSUtils.getRandomNumber(MIN_PERCENT_AB, MAX_PERCENT_AB) }] } @@ -764,10 +772,10 @@ class AbTestingModuleSpec extends ModuleBaseSpec { } } - def "PBS should apply a/b test config from host config when accounts is not specified when account config and default account doesn't include a/b test config"() { + def "PBS should apply a/b test config from host config when accounts is not specified"() { given: "PBS service with specific ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, accouns).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, accouns).tap { percentActive = MIN_PERCENT_AB }] } @@ -790,7 +798,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -827,7 +835,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { given: "PBS service with specific ab test config" def accountId = PBSUtils.randomNumber def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber, accountId]).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber, accountId]).tap { percentActive = MIN_PERCENT_AB }] } @@ -853,7 +861,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -886,10 +894,10 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def "PBS should apply a/b test config from host config for specific account and general config when account config and default account doesn't include a/b test config"() { given: "PBS service with specific ab test config" def accountId = PBSUtils.randomNumber - def ortb2AbTestConfig = AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, []).tap { + def ortb2AbTestConfig = ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, []).tap { it.percentActive = MIN_PERCENT_AB } - def richMediaAbTestConfig = AbTest.getDefault(PB_RESPONSE_CORRECTION.code, [accountId]).tap { + def richMediaAbTestConfig = ModularityAbTest.getDefault(PB_RESPONSE_CORRECTION.code, [accountId]).tap { it.percentActive = MIN_PERCENT_AB } def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { @@ -917,7 +925,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -928,7 +936,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -953,7 +961,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def "PBS shouldn't apply a/b test config from host config for non specified accounts when account config and default account doesn't include a/b test config"() { given: "PBS service with specific ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber]).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code, [PBSUtils.randomNumber]).tap { percentActive = MIN_PERCENT_AB }] } @@ -977,7 +985,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten() == [ORTB2_BLOCKING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SUCCESS_ALLOW].value it.analyticsTags.activities.results.values.module.flatten().every { it == null } } @@ -1015,7 +1023,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def "PBS should prioritise a/b test config from default account and only specified module when host and default account contains a/b test configs"() { given: "PBS service with specific ab test config" def accountExecutionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = MIN_PERCENT_AB }] } @@ -1024,7 +1032,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { } def hostExecutionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)] + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)] } def pbsConfig = MULTI_MODULE_CONFIG + ['hooks.host-execution-plan': encode(hostExecutionPlan)] + ["settings.default-account-config": encode(defaultAccountConfigSettings)] @@ -1046,7 +1054,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS, SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION, NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING, AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED, FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -1078,7 +1086,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def "PBS should prioritise a/b test config from account over default account and only specified module when specific account and default account contains a/b test configs"() { given: "PBS service with specific ab test config" - def accountExecutionPlan = new ExecutionPlan(abTests: [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)]) + def accountExecutionPlan = new ExecutionPlan(abTests: [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code)]) def defaultAccountConfigSettings = AccountConfig.defaultAccountConfig.tap { hooks = new AccountHooksConfiguration(executionPlan: accountExecutionPlan) } @@ -1095,7 +1103,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Save account with ab test config" def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES).tap { - abTests = [AbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { + abTests = [ModularityAbTest.getDefault(ModuleName.ORTB2_BLOCKING.code).tap { percentActive = MIN_PERCENT_AB }] } @@ -1115,7 +1123,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS] + it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy index 82727b16a56..f3e5c66c18b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy @@ -1,6 +1,6 @@ package org.prebid.server.functional.tests.module -import org.prebid.server.functional.model.ModuleName +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.AccountConfig import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.AdminConfig @@ -14,10 +14,9 @@ import org.prebid.server.functional.model.request.auction.RichmediaFilter import org.prebid.server.functional.model.request.auction.TraceLevel import org.prebid.server.functional.model.response.auction.InvocationResult import org.prebid.server.functional.service.PrebidServerService -import org.prebid.server.functional.util.PBSUtils -import static org.prebid.server.functional.model.ModuleName.ORTB2_BLOCKING -import static org.prebid.server.functional.model.ModuleName.PB_RICHMEDIA_FILTER +import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING +import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_BIDDER_REQUEST import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_RAW_BIDDER_RESPONSE @@ -41,12 +40,22 @@ class GeneralModuleSpec extends ModuleBaseSpec { (RAW_BIDDER_RESPONSE): [ORTB2_BLOCKING]] private final static Map> RESPONSE_STAGES = [(ALL_PROCESSED_BID_RESPONSES): [PB_RICHMEDIA_FILTER]] private final static Map> MODULES_STAGES = ORTB_STAGES + RESPONSE_STAGES - private final static Map MULTI_MODULE_CONFIG = getRichMediaFilterSettings(PBSUtils.randomString) + - getOrtb2BlockingSettings() + + private final static Map MULTI_MODULE_CONFIG = getModuleBaseSettings(PB_RICHMEDIA_FILTER) + + getModuleBaseSettings(ORTB2_BLOCKING) + ['hooks.host-execution-plan': encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES))] - private final static PrebidServerService pbsServiceWithMultipleModule = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) - private final static PrebidServerService pbsServiceWithMultipleModuleWithRequireInvoke = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + private static PrebidServerService pbsServiceWithMultipleModule + private static PrebidServerService pbsServiceWithMultipleModuleWithRequireInvoke + + def setupSpec() { + pbsServiceWithMultipleModule = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) + pbsServiceWithMultipleModuleWithRequireInvoke = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + } + + def cleanupSpec() { + pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) + pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + } def "PBS should call all modules and traces response when account config is empty and require-config-to-invoke is disabled"() { given: "Default bid request with verbose trace" @@ -140,7 +149,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { } def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -148,10 +157,10 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response should include trace information about called modules" verifyAll(response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() as List) { @@ -161,7 +170,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Ortb2blocking module call metrics should be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 @@ -296,7 +305,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { given: "PBS service with module-execution config" def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + [("hooks.admin.module-execution.${ORTB2_BLOCKING.code}".toString()): 'true'] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -304,10 +313,10 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response should include trace information about called modules" verifyAll(response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() as List) { @@ -317,7 +326,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Ortb2blocking module call metrics should be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 @@ -331,7 +340,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { given: "PBS service with module-execution config" def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + [("hooks.admin.module-execution.${ORTB2_BLOCKING.code}".toString()): 'false'] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -339,16 +348,16 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response shouldn't include trace information about no-called modules" assert !response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() and: "Ortb2blocking module call metrics shouldn't be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] assert !metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] @@ -364,8 +373,8 @@ class GeneralModuleSpec extends ModuleBaseSpec { hooks = new AccountHooksConfiguration(admin: new AdminConfig(moduleExecution: [(ORTB2_BLOCKING): true])) } def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + - [("hooks.admin.module-execution.${ORTB2_BLOCKING.code}".toString()): 'false'] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + [("hooks.admin.module-execution.${ORTB2_BLOCKING.code}".toString()): 'false'] + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -378,16 +387,16 @@ class GeneralModuleSpec extends ModuleBaseSpec { accountDao.save(account) and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response shouldn't include trace information about no-called modules" assert !response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() and: "Ortb2blocking module call metrics shouldn't be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] assert !metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] @@ -403,7 +412,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { hooks = new AccountHooksConfiguration(admin: new AdminConfig(moduleExecution: [(ORTB2_BLOCKING): true])) } def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -416,10 +425,10 @@ class GeneralModuleSpec extends ModuleBaseSpec { accountDao.save(account) and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response should include trace information about called modules" verifyAll(response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() as List) { @@ -429,7 +438,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Ortb2blocking module call metrics should be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 @@ -445,7 +454,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { hooks = new AccountHooksConfiguration(admin: new AdminConfig(moduleExecution: [(ORTB2_BLOCKING): moduleExecutionStatus])) } def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -458,16 +467,16 @@ class GeneralModuleSpec extends ModuleBaseSpec { accountDao.save(account) and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response shouldn't include trace information about no-called modules" assert !response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() and: "Ortb2blocking module call metrics shouldn't be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] assert !metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] @@ -490,7 +499,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { hooks = new AccountHooksConfiguration(admin: new AdminConfig(moduleExecution: [(ORTB2_BLOCKING): false])) } def pbsConfig = MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsServiceWithMultipleModules = pbsServiceFactory.getService(pbsConfig) + def pbsServiceWithMultipleModule = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with verbose trace" def bidRequest = defaultBidRequest.tap { @@ -503,10 +512,10 @@ class GeneralModuleSpec extends ModuleBaseSpec { accountDao.save(account) and: "Flush metrics" - flushMetrics(pbsServiceWithMultipleModules) + flushMetrics(pbsServiceWithMultipleModule) when: "PBS processes auction request" - def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModule.sendAuctionRequest(bidRequest) then: "PBS response should include trace information about called modules" verifyAll(response?.ext?.prebid?.modules?.trace?.stages?.outcomes?.groups?.invocationResults?.flatten() as List) { @@ -516,7 +525,7 @@ class GeneralModuleSpec extends ModuleBaseSpec { } and: "Ortb2blocking module call metrics should be updated" - def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModule.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[NOOP_METRIC.formatted(ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy index 453de43aa3c..030552c3c24 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy @@ -1,23 +1,51 @@ package org.prebid.server.functional.tests.module +import org.prebid.server.functional.model.config.AccountConfig +import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.Endpoint import org.prebid.server.functional.model.config.ExecutionPlan -import org.prebid.server.functional.model.config.Stage +import org.prebid.server.functional.model.config.ModuleHookImplementation +import org.prebid.server.functional.model.config.ModuleName +import org.prebid.server.functional.model.config.PbsModulesConfig +import org.prebid.server.functional.model.db.Account +import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.BaseSpec +import spock.lang.Shared -import static org.prebid.server.functional.model.ModuleName.ORTB2_BLOCKING -import static org.prebid.server.functional.model.ModuleName.PB_REQUEST_CORRECTION -import static org.prebid.server.functional.model.ModuleName.PB_RESPONSE_CORRECTION -import static org.prebid.server.functional.model.ModuleName.PB_RICHMEDIA_FILTER +import static org.prebid.server.functional.model.config.ModuleHookImplementation.PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES +import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING +import static org.prebid.server.functional.model.config.ModuleName.PB_REQUEST_CORRECTION +import static org.prebid.server.functional.model.config.ModuleName.PB_RESPONSE_CORRECTION +import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION -import static org.prebid.server.functional.model.config.Stage.ALL_PROCESSED_BID_RESPONSES -import static org.prebid.server.functional.model.config.Stage.PROCESSED_AUCTION_REQUEST +import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer class ModuleBaseSpec extends BaseSpec { + protected static final String WILDCARD = '*' + private static final Map ORTB_ADAPTER_CONFIG = ['adapter-defaults.ortb.multiformat-supported': 'false'] + private static final Map MODIFYING_VAST_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", + "adapters.generic.modifying-vast-xml-allowed": "false"] + private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", + "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + + protected final static Map EXTERNAL_MODULES_CONFIG = getModuleBaseSettings(PB_RICHMEDIA_FILTER) + + getModuleBaseSettings(PB_RESPONSE_CORRECTION) + + getModuleBaseSettings(ORTB2_BLOCKING) + + getModuleBaseSettings(PB_REQUEST_CORRECTION) + + @Shared + protected static PrebidServerService pbsServiceWithMultipleModules + def setupSpec() { prebidCache.setResponse() bidder.setResponse() + pbsServiceWithMultipleModules = pbsServiceFactory.getService( + IX_CONFIG + + ORTB_ADAPTER_CONFIG + + MODIFYING_VAST_CONFIG + + EXTERNAL_MODULES_CONFIG + ) } def cleanupSpec() { @@ -26,38 +54,29 @@ class ModuleBaseSpec extends BaseSpec { repository.removeAllDatabaseData() } - protected static Map getResponseCorrectionConfig(Endpoint endpoint = OPENRTB2_AUCTION) { - ["hooks.${PB_RESPONSE_CORRECTION.code}.enabled": true, - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, [(ALL_PROCESSED_BID_RESPONSES): [PB_RESPONSE_CORRECTION]]))] - .collectEntries { key, value -> [(key.toString()): value.toString()] } + protected static Map getModuleBaseSettings(ModuleName name, boolean isEnabled = true) { + [("hooks.${name.code}.enabled".toString()): isEnabled as String] } protected static Map getRichMediaFilterSettings(String scriptPattern, - Boolean filterMraidEnabled = true, - Endpoint endpoint = OPENRTB2_AUCTION) { - + Boolean filterMraidEnabled = true) { ["hooks.${PB_RICHMEDIA_FILTER.code}.enabled" : true, "hooks.modules.${PB_RICHMEDIA_FILTER.code}.mraid-script-pattern": scriptPattern, "hooks.modules.${PB_RICHMEDIA_FILTER.code}.filter-mraid" : filterMraidEnabled, - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, [(ALL_PROCESSED_BID_RESPONSES): [PB_RICHMEDIA_FILTER]]))] + "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan([PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES]))] .findAll { it.value != null } - .collectEntries { key, value -> [(key.toString()): value.toString()] } + .collectEntries { key, value -> [(key.toString()): value.toString()] + } } - protected static Map getDisabledRichMediaFilterSettings(String scriptPattern, - boolean filterMraidEnabled = true) { - ["hooks.${PB_RICHMEDIA_FILTER.code}.enabled" : false, - "hooks.modules.${PB_RICHMEDIA_FILTER.code}.mraid-script-pattern": scriptPattern, - "hooks.modules.${PB_RICHMEDIA_FILTER.code}.filter-mraid" : filterMraidEnabled] - .collectEntries { key, value -> [(key.toString()): value.toString()] } - } + protected static Account getAccountWithModuleConfig(String accountId, + List modulesHooks, + Endpoint endpoint = OPENRTB2_AUCTION) { - protected static Map getOrtb2BlockingSettings(boolean isEnabled = true) { - ["hooks.${ORTB2_BLOCKING.code}.enabled": isEnabled as String] + def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(modulesHooks, endpoint) + def accountHooksConfig = new AccountHooksConfiguration(executionPlan: executionPlan, modules: new PbsModulesConfig()) + def accountConfig = new AccountConfig(hooks: accountHooksConfig) + new Account(uuid: accountId, config: accountConfig) } - protected static Map getRequestCorrectionSettings(Endpoint endpoint = OPENRTB2_AUCTION, Stage stage = PROCESSED_AUCTION_REQUEST) { - ["hooks.${PB_REQUEST_CORRECTION.code}.enabled": "true", - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, PB_REQUEST_CORRECTION, [stage]))] - } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy index 8a99628b70c..f03a092495d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy @@ -15,12 +15,11 @@ import org.prebid.server.functional.model.request.auction.RichmediaFilter import org.prebid.server.functional.model.request.auction.StoredBidResponse import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.model.response.auction.ModuleActivityName -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils -import static org.prebid.server.functional.model.ModuleName.ORTB2_BLOCKING -import static org.prebid.server.functional.model.ModuleName.PB_RICHMEDIA_FILTER +import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING +import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.Stage.ALL_PROCESSED_BID_RESPONSES @@ -30,8 +29,6 @@ import static org.prebid.server.functional.model.response.auction.ErrorType.PREB class AnalyticsTagsModuleSpec extends ModuleBaseSpec { - private final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(ortb2BlockingSettings) - def "PBS should include analytics tag for ortb2-blocking module in response when request and account allow client details"() { given: "Default account with module config" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -46,7 +43,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain ext.prebid.analyticsTags with module record" def analyticsTagPrebid = bidResponse.ext.prebid.analytics.tags.first @@ -123,7 +120,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { def accountConfig = new AccountConfig(hooks: hooksConfiguration, analytics: new AccountAnalyticsConfig(allowClientDetails: true)) and: "Prebid server with proper default account" - def pbsConfig = ['settings.default-account-config': encode(accountConfig)] + ortb2BlockingSettings + def pbsConfig = ['settings.default-account-config': encode(accountConfig)] + getModuleBaseSettings(ORTB2_BLOCKING) def pbsServiceWithDefaultAccount = pbsServiceFactory.getService(pbsConfig) and: "Bid request with enabled client details" @@ -162,7 +159,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { def defaultAccountConfig = new AccountConfig(hooks: defaultHooksConfiguration, analytics: new AccountAnalyticsConfig(allowClientDetails: false)) and: "Prebid server with proper default account" - def pbsConfig = ['settings.default-account-config': encode(defaultAccountConfig)] + ortb2BlockingSettings + def pbsConfig = ['settings.default-account-config': encode(defaultAccountConfig)] + getModuleBaseSettings(ORTB2_BLOCKING) def pbsServiceWithDefaultAccount = pbsServiceFactory.getService(pbsConfig) and: "Bid request with enabled client details" @@ -238,7 +235,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should not contain any analytics tag" assert !bidResponse?.ext?.prebid?.analytics?.tags @@ -261,7 +258,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should not contain any analytics tag" assert !bidResponse?.ext?.prebid?.analytics?.tags @@ -285,7 +282,7 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should not contain any analytics tag" assert !bidResponse?.ext?.prebid?.analytics?.tags diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy index bb644508090..8061b08d735 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy @@ -3,16 +3,12 @@ package org.prebid.server.functional.tests.module.ortb2blocking import org.prebid.server.functional.model.bidder.BidderName import org.prebid.server.functional.model.bidder.Generic import org.prebid.server.functional.model.config.AccountAuctionConfig -import org.prebid.server.functional.model.config.AccountConfig -import org.prebid.server.functional.model.config.AccountHooksConfiguration -import org.prebid.server.functional.model.config.ExecutionPlan import org.prebid.server.functional.model.config.Ortb2BlockingActionOverride import org.prebid.server.functional.model.config.Ortb2BlockingAttributeConfig import org.prebid.server.functional.model.config.Ortb2BlockingAttribute import org.prebid.server.functional.model.config.Ortb2BlockingConditions import org.prebid.server.functional.model.config.Ortb2BlockingConfig import org.prebid.server.functional.model.config.Ortb2BlockingOverride -import org.prebid.server.functional.model.config.PbsModulesConfig import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.request.auction.Asset import org.prebid.server.functional.model.request.auction.Audio @@ -30,15 +26,14 @@ import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.model.response.auction.ErrorType import org.prebid.server.functional.model.response.auction.MediaType import org.prebid.server.functional.model.response.auction.SeatBid -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils -import static org.prebid.server.functional.model.ModuleName.ORTB2_BLOCKING +import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_BIDDER_REQUEST +import static org.prebid.server.functional.model.config.ModuleHookImplementation.ORTB2_BLOCKING_RAW_BIDDER_RESPONSE import static org.prebid.server.functional.model.bidder.BidderName.ALIAS import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.IX -import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.AUDIO_BATTR import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.BADV import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.BAPP @@ -46,23 +41,13 @@ import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.B import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.BCAT import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.BTYPE import static org.prebid.server.functional.model.config.Ortb2BlockingAttribute.VIDEO_BATTR -import static org.prebid.server.functional.model.config.Stage.BIDDER_REQUEST -import static org.prebid.server.functional.model.config.Stage.RAW_BIDDER_RESPONSE import static org.prebid.server.functional.model.response.auction.BidRejectionReason.RESPONSE_REJECTED_ADVERTISER_BLOCKED import static org.prebid.server.functional.model.response.auction.MediaType.AUDIO import static org.prebid.server.functional.model.response.auction.MediaType.BANNER import static org.prebid.server.functional.model.response.auction.MediaType.VIDEO -import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer class Ortb2BlockingSpec extends ModuleBaseSpec { - private static final String WILDCARD = '*' - private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", - "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - - private final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(ortb2BlockingSettings + IX_CONFIG + - ['adapter-defaults.ortb.multiformat-supported': 'false']) - def "PBS should send original array ortb2 attribute to bidder when enforce blocking is disabled"() { given: "Default bid request with proper ortb attribute" def bidRequest = getBidRequestForOrtbAttribute(attributeName) @@ -78,7 +63,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should contain proper ortb2 attributes from account config" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -117,7 +102,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes the auction request" - pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should contain proper ortb2 attributes from account config" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -147,7 +132,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request shouldn't contain ortb2 attributes from account config for any media-type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -192,7 +177,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request shouldn't contain ortb2 attributes from account config for any media-type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -238,7 +223,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request shouldn't contain ortb2 attributes from account config for any media-type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -277,7 +262,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain seatNonBid for the called bidder" assert response.ext.prebid.modules.errors.ortb2Blocking["ortb2-blocking-bidder-request"].first @@ -310,7 +295,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain seatNonBid for the called bidder" assert response.ext.prebid.modules.errors.ortb2Blocking["ortb2-blocking-bidder-request"].first @@ -352,7 +337,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response shouldn't contain any seatbid" assert !response.seatbid @@ -392,7 +377,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -458,7 +443,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -496,7 +481,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain proper seatbid" assert getOrtb2Attributes(response.seatbid.first.bid.first, attributeName) == [ortb2Attributes]*.toString() @@ -543,7 +528,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -574,7 +559,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -617,7 +602,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -648,7 +633,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -684,7 +669,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only allowed seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -725,7 +710,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response shouldn't contain any seatbid" assert !response.seatbid.bid.flatten().size() @@ -769,7 +754,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only openx seatbid" assert response.seatbid.size() == 1 @@ -817,7 +802,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only banner seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -867,7 +852,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain banner seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -921,7 +906,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response shouldn't contain any seatbid" assert !response.seatbid.bid.flatten().size() @@ -964,7 +949,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only seatbid with proper deal id" assert response.seatbid.bid.flatten().size() == 1 @@ -1013,7 +998,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should override blocked ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1056,7 +1041,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should override blocked ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1105,7 +1090,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only ix seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -1142,7 +1127,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain banner seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -1181,7 +1166,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only ix seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -1216,7 +1201,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain banner seatbid" assert response.seatbid.bid.flatten().size() == 1 @@ -1251,7 +1236,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only seatbid with proper deal id" assert response.seatbid.bid.flatten().size() == 1 @@ -1294,7 +1279,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should override blocked ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1344,7 +1329,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should override blocked ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1387,7 +1372,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should override blocked ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1432,7 +1417,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain only seatbid with proper deal id" assert response.seatbid.bid.flatten().size() == 1 @@ -1468,7 +1453,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS request should contain original ortb2 attribute" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -1510,7 +1495,7 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes the auction request" - def response = pbsServiceWithEnabledOrtb2Blocking.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS response should contain seatNonBid for the called bidder" assert response.ext.seatnonbid.size() == 1 @@ -1526,12 +1511,9 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { } private static Account getAccountWithOrtb2BlockingConfig(String accountId, Map attributes) { - def blockingConfig = new Ortb2BlockingConfig(attributes: attributes) - def executionPlan = ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, ORTB2_BLOCKING, [BIDDER_REQUEST, RAW_BIDDER_RESPONSE]) - def moduleConfig = new PbsModulesConfig(ortb2Blocking: blockingConfig) - def accountHooksConfig = new AccountHooksConfiguration(executionPlan: executionPlan, modules: moduleConfig) - def accountConfig = new AccountConfig(hooks: accountHooksConfig) - new Account(uuid: accountId, config: accountConfig) + getAccountWithModuleConfig(accountId, [ORTB2_BLOCKING_BIDDER_REQUEST, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE]).tap { + it.config.hooks.modules.ortb2Blocking = new Ortb2BlockingConfig(attributes: attributes) + } } private static BidRequest getBidRequestForOrtbAttribute(Ortb2BlockingAttribute attribute, List attributeValue = null) { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy index 68b00bdd0d1..8d76ea8dcd0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy @@ -11,10 +11,10 @@ import org.prebid.server.functional.model.request.auction.AppPrebid import org.prebid.server.functional.model.request.auction.Device import org.prebid.server.functional.model.request.auction.Imp import org.prebid.server.functional.model.request.auction.OperationState -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils +import static org.prebid.server.functional.model.config.ModuleHookImplementation.PB_REQUEST_CORRECTION_PROCESSED_AUCTION_REQUEST import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP import static org.prebid.server.functional.model.request.auction.OperationState.YES @@ -27,8 +27,6 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { private static final String ANDROID = "android" private static final String IOS = "IOS" - private PrebidServerService pbsServiceWithRequestCorrectionModule = pbsServiceFactory.getService(requestCorrectionSettings) - def "PBS should remove positive instl from imps for android app when request correction is enabled for account"() { given: "Android APP bid request with version lover then version threshold" def prebid = new AppPrebid(source: PBSUtils.getRandomCase(PREBID_MOBILE), version: ACCEPTABLE_DEVICE_INSTL_VERSION_THRESHOLD) @@ -43,7 +41,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request shouldn't contain imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -76,7 +74,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -104,7 +102,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -134,7 +132,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -163,7 +161,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -185,7 +183,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -207,7 +205,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -237,7 +235,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain original imp.instl" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -257,7 +255,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request shouldn't contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -285,7 +283,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -315,7 +313,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -344,7 +342,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -373,7 +371,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -394,7 +392,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -415,7 +413,7 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain device.ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -437,18 +435,16 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsServiceWithRequestCorrectionModule.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bidder request should contain request device ua" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert bidderRequest.device.ua == deviceUa } - private static Account createAccountWithRequestCorrectionConfig(BidRequest bidRequest, - PbRequestCorrectionConfig requestCorrectionConfig) { - def pbsModulesConfig = new PbsModulesConfig(pbRequestCorrection: requestCorrectionConfig) - def accountHooksConfig = new AccountHooksConfiguration(modules: pbsModulesConfig) - def accountConfig = new AccountConfig(hooks: accountHooksConfig) - new Account(uuid: bidRequest.accountId, config: accountConfig) + private static Account createAccountWithRequestCorrectionConfig(BidRequest bidRequest, PbRequestCorrectionConfig requestCorrectionConfig) { + getAccountWithModuleConfig(bidRequest.accountId, [PB_REQUEST_CORRECTION_PROCESSED_AUCTION_REQUEST]).tap { + it.config.hooks.modules.pbRequestCorrection = requestCorrectionConfig + } } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy index c848c30e2e4..8e5731e7ff5 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy @@ -1,10 +1,7 @@ package org.prebid.server.functional.tests.module.responsecorrenction -import org.prebid.server.functional.model.config.AccountConfig -import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.AppVideoHtml import org.prebid.server.functional.model.config.PbResponseCorrection -import org.prebid.server.functional.model.config.PbsModulesConfig import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Imp @@ -13,13 +10,13 @@ import org.prebid.server.functional.model.response.auction.BidExt import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.model.response.auction.Meta import org.prebid.server.functional.model.response.auction.Prebid -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils import java.time.Instant import static org.prebid.server.functional.model.bidder.BidderName.GENERIC +import static org.prebid.server.functional.model.config.ModuleHookImplementation.RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES import static org.prebid.server.functional.model.request.auction.BidRequest.getDefaultBidRequest import static org.prebid.server.functional.model.request.auction.BidRequest.getDefaultVideoRequest import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP @@ -32,11 +29,6 @@ import static org.prebid.server.functional.model.response.auction.MediaType.VIDE class ResponseCorrectionSpec extends ModuleBaseSpec { - private final PrebidServerService pbsServiceWithResponseCorrectionModule = pbsServiceFactory.getService( - ["adapter-defaults.modifying-vast-xml-allowed": "false", - "adapters.generic.modifying-vast-xml-allowed": "false"] + - responseCorrectionConfig) - private final static int OPTIMAL_MAX_LENGTH = 20 def "PBS shouldn't modify response when in account correction module disabled"() { @@ -57,10 +49,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -100,10 +92,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -142,10 +134,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -177,10 +169,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection[0].contains("Bid $bidId of bidder generic has an JSON ADM, that appears to be native" as String) @@ -216,10 +208,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -259,10 +251,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection[0].contains("Bid $bidId of bidder generic has an JSON ADM, that appears to be native" as String) @@ -300,10 +292,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -337,10 +329,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS shouldn't emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, bidResponse.seatbid[0].bid[0].id).size() == 0 and: "Response should contain seatBid" @@ -384,10 +376,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection.size() == 1 @@ -439,10 +431,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection.size() == 1 @@ -494,10 +486,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection.size() == 1 @@ -542,10 +534,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection.size() == 2 @@ -572,10 +564,13 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { assert !response.ext.warnings } - private static Account accountConfigWithResponseCorrectionModule(BidRequest bidRequest, Boolean enabledResponseCorrection = true, Boolean enabledAppVideoHtml = true) { - def modulesConfig = new PbsModulesConfig(pbResponseCorrection: new PbResponseCorrection( - enabled: enabledResponseCorrection, appVideoHtml: new AppVideoHtml(enabled: enabledAppVideoHtml))) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: modulesConfig)) - new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + private static Account accountConfigWithResponseCorrectionModule(BidRequest bidRequest, + Boolean enabledResponseCorrection = true, + Boolean enabledAppVideoHtml = true) { + + getAccountWithModuleConfig(bidRequest.accountId, [RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES]).tap { + it.config.hooks.modules.pbResponseCorrection = new PbResponseCorrection( + enabled: enabledResponseCorrection, appVideoHtml: new AppVideoHtml(enabled: enabledAppVideoHtml)) + } } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index c49743b275b..1b040cc3ab0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -16,8 +16,9 @@ import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils +import static org.prebid.server.functional.model.config.ModuleHookImplementation.PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES import static org.prebid.server.functional.model.response.auction.BidRejectionReason.RESPONSE_REJECTED_INVALID_CREATIVE -import static org.prebid.server.functional.model.ModuleName.PB_RICHMEDIA_FILTER +import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.Stage.ALL_PROCESSED_BID_RESPONSES @@ -27,19 +28,31 @@ class RichMediaFilterSpec extends ModuleBaseSpec { private static final String PATTERN_NAME = PBSUtils.randomString private static final String PATTERN_NAME_ACCOUNT = PBSUtils.randomString - private final PrebidServerService pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(getRichMediaFilterSettings(PATTERN_NAME)) - private final PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService( - (getRichMediaFilterSettings(PATTERN_NAME) + ["hooks.host-execution-plan": encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, PB_RICHMEDIA_FILTER, [ALL_PROCESSED_BID_RESPONSES]).tap { + private static final Map DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG = getRichMediaFilterSettings(PATTERN_NAME, false) + private static final Map SPECIFIC_PATTERN_NAME_CONFIG = getRichMediaFilterSettings(PATTERN_NAME) + private static final Map SNAKE_SPECIFIC_PATTERN_NAME_CONFIG = (getRichMediaFilterSettings(PATTERN_NAME) + + ["hooks.host-execution-plan": encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, PB_RICHMEDIA_FILTER, [ALL_PROCESSED_BID_RESPONSES]).tap { endpoints.values().first().stages.values().first().groups.first.hookSequenceSnakeCase = [new HookId(moduleCodeSnakeCase: PB_RICHMEDIA_FILTER.code, hookImplCodeSnakeCase: "${PB_RICHMEDIA_FILTER.code}-${ALL_PROCESSED_BID_RESPONSES.value}-hook")] - })]) - .collectEntries { key, value -> [(key.toString()): value.toString()] }) - private final PrebidServerService pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(getRichMediaFilterSettings(PATTERN_NAME, false)) + })]).collectEntries { key, value -> [(key.toString()): value.toString()] } - def "PBS should process request without rich media module when host config have empty settings"() { - given: "Prebid server with empty settings for module" - def prebidServerService = pbsServiceFactory.getService(pbsConfig) + private static PrebidServerService pbsServiceWithDisabledMediaFilter + private static PrebidServerService pbsServiceWithEnabledMediaFilter + private static PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy - and: "BidRequest with stored response" + def setupSpec() { + pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + } + + def cleanupSpec() { + pbsServiceFactory.removeContainer(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceFactory.removeContainer(SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceFactory.removeContainer(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + } + + def "PBS should process request without rich media module when host config have empty settings"() { + given: "BidRequest with stored response" def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { ext.prebid.returnAllBidStatus = true @@ -54,12 +67,12 @@ class RichMediaFilterSpec extends ModuleBaseSpec { def storedResponse = new StoredResponse(responseId: storedResponseId, storedBidResponse: storedBidResponse) storedResponseDao.save(storedResponse) - and: "Account in the DB" - def account = new Account(uuid: bidRequest.getAccountId()) + and: "Account with enabled richMedia config in the DB" + def account = getAccountWithRichmediaFilter(bidRequest.accountId, filterMraid, mraidScriptPattern) accountDao.save(account) when: "PBS processes auction request" - def response = prebidServerService.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Response header should contain seatbid" assert response.seatbid.size() == 1 @@ -70,14 +83,12 @@ class RichMediaFilterSpec extends ModuleBaseSpec { and: "Response shouldn't contain analytics" assert !getAnalyticResults(response) - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) - where: - pbsConfig << [getRichMediaFilterSettings(PBSUtils.randomString, null), - getRichMediaFilterSettings(null, true), - getRichMediaFilterSettings(null, false), - getRichMediaFilterSettings(null, null)] + filterMraid | mraidScriptPattern + true | PBSUtils.randomString + true | null + false | null + null | null } def "PBS should process request without analytics when adm matches with pattern name and filter set to disabled in host config"() { @@ -97,7 +108,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { storedResponseDao.save(storedResponse) and: "Account in the DB" - def account = new Account(uuid: bidRequest.getAccountId()) + def account = new Account(uuid: bidRequest.accountId) accountDao.save(account) when: "PBS processes auction request" @@ -133,7 +144,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { storedResponseDao.save(storedResponse) and: "Account in the DB" - def account = new Account(uuid: bidRequest.getAccountId()) + def account = new Account(uuid: bidRequest.accountId) accountDao.save(account) when: "PBS processes auction request" @@ -160,7 +171,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { admValue << [PATTERN_NAME, "${PBSUtils.randomString}-${PATTERN_NAME}", "${PATTERN_NAME}.${PBSUtils.randomString}"] } - def "PBS should process request without analytics when adm is #admValue and filter enabled in host config"() { + def "PBS should process request without analytics when adm is #admValue and filter enabled in config"() { given: "BidRequest with stored response" def storedResponseId = PBSUtils.randomNumber def bidRequest = BidRequest.defaultBidRequest.tap { @@ -177,9 +188,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { storedResponseDao.save(storedResponse) and: "Account with enabled richMedia config in the DB" - def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: true)) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = getAccountWithRichmediaFilter(bidRequest.accountId, true, null) accountDao.save(account) when: "PBS processes auction request" @@ -208,9 +217,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { } and: "Account with enabled richMedia config in the DB" - def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: true, mraidScriptPattern: PATTERN_NAME)) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = getAccountWithRichmediaFilter(bidRequest.accountId, true, PATTERN_NAME) accountDao.save(account) and: "Stored bid response in DB" @@ -254,9 +261,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { } and: "Account with disabled richMedia config in the DB" - def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: false, mraidScriptPattern: PATTERN_NAME)) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = getAccountWithRichmediaFilter(bidRequest.accountId, false, PATTERN_NAME) accountDao.save(account) and: "Stored bid response in DB" @@ -292,9 +297,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { } and: "Account with enabled richMedia config in the DB" - def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: true, mraidScriptPattern: PATTERN_NAME_ACCOUNT)) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = getAccountWithRichmediaFilter(bidRequest.accountId, true, PATTERN_NAME_ACCOUNT) accountDao.save(account) and: "Stored bid response in DB" @@ -335,9 +338,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { } and: "Account with enabled richMedia config in the DB" - def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: true, mraidScriptPattern: PATTERN_NAME_ACCOUNT)) - def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = getAccountWithRichmediaFilter(bidRequest.accountId, true, PATTERN_NAME_ACCOUNT) accountDao.save(account) and: "Stored bid response in DB" @@ -362,7 +363,10 @@ class RichMediaFilterSpec extends ModuleBaseSpec { def "PBS should process any request without analytics and errors when pb-richmedia-filter hook is disabled"() { given: "PBS with disabled pb-richmedia-filter hook" - def pbsServiceWithDisabledMediaFilterHook = pbsServiceFactory.getService(getDisabledRichMediaFilterSettings(PATTERN_NAME)) + def pbsConfig = getRichMediaFilterSettings(PATTERN_NAME) + + getModuleBaseSettings(PB_RICHMEDIA_FILTER, false) + + ["hooks.host-execution-plan": null] + def pbsServiceWithDisabledMediaFilterHook = pbsServiceFactory.getService(pbsConfig) and: "BidRequest with stored response" def storedResponseId = PBSUtils.randomNumber @@ -375,7 +379,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { and: "Account with enabled richMedia config in the DB" def richMediaFilterConfig = new PbsModulesConfig(pbRichmediaFilter: new RichmediaFilter(filterMraid: true, mraidScriptPattern: PATTERN_NAME_ACCOUNT)) def accountConfig = new AccountConfig(hooks: new AccountHooksConfiguration(modules: richMediaFilterConfig)) - def account = new Account(uuid: bidRequest.getAccountId(), config: accountConfig) + def account = new Account(uuid: bidRequest.accountId, config: accountConfig) accountDao.save(account) and: "Stored bid response in DB" @@ -397,6 +401,9 @@ class RichMediaFilterSpec extends ModuleBaseSpec { and: "Response shouldn't contain analytics" assert !getAnalyticResults(response) + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: admValue << [PATTERN_NAME, PATTERN_NAME_ACCOUNT] } @@ -418,7 +425,7 @@ class RichMediaFilterSpec extends ModuleBaseSpec { storedResponseDao.save(storedResponse) and: "Account in the DB" - def account = new Account(uuid: bidRequest.getAccountId()) + def account = new Account(uuid: bidRequest.accountId) accountDao.save(account) when: "PBS processes auction request" @@ -450,4 +457,10 @@ class RichMediaFilterSpec extends ModuleBaseSpec { ?.outcomes?.first()?.groups?.first() ?.invocationResults?.first()?.analyticsTags?.activities } + + private static Account getAccountWithRichmediaFilter(String accountId, Boolean filterMraid, String mraidScriptPattern) { + getAccountWithModuleConfig(accountId, [PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES]).tap { + it.config.hooks.modules.pbRichmediaFilter = new RichmediaFilter(filterMraid: filterMraid, mraidScriptPattern: mraidScriptPattern) + } + } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy index e0c3b279200..b3f732d7a2f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/ActivityTraceLogSpec.groovy @@ -398,8 +398,8 @@ class ActivityTraceLogSpec extends PrivacyBaseSpec { allow << [false, true] } - private List getActivityByName(List activityInfrastructures, - ActivityType activity) { + private static List getActivityByName(List activityInfrastructures, + ActivityType activity) { def firstIndex = activityInfrastructures.findLastIndexOf { it -> it.activity == activity } def lastIndex = activityInfrastructures.findIndexOf { it -> it.activity == activity } activityInfrastructures[new IntRange(true, firstIndex, lastIndex)] diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy index 134aa10c9a4..f93a014f058 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy @@ -192,7 +192,7 @@ class CoppaSpec extends PrivacyBaseSpec { bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.lat == bidRequest.user.geo.lat bidderRequest.user.geo.lon == bidRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" @@ -396,7 +396,7 @@ class CoppaSpec extends PrivacyBaseSpec { bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo.lat == ampStoredRequest.user.geo.lat bidderRequest.user.geo.lon == ampStoredRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy index 771fac9bd84..6876668470d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy @@ -647,7 +647,7 @@ class GdprAmpSpec extends PrivacyBaseSpec { bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo.lat == ampStoredRequest.user.geo.lat bidderRequest.user.geo.lon == ampStoredRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy index 351875e5f90..a7fb7795397 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy @@ -768,7 +768,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.lat == bidRequest.user.geo.lat bidderRequest.user.geo.lon == bidRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy index bbb019d515d..38f45160b6c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy @@ -124,7 +124,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -302,7 +302,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -397,7 +397,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -519,7 +519,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -649,7 +649,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -767,7 +767,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.zip == bidRequest.user.geo.zip - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1213,7 +1213,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1269,7 +1269,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1324,7 +1324,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1410,7 +1410,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1700,7 +1700,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1903,7 +1903,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2075,7 +2075,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2505,7 +2505,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2569,7 +2569,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2633,7 +2633,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2737,7 +2737,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -3088,7 +3088,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { it.user.yob = PBSUtils.randomNumber it.user.gender = PBSUtils.randomString it.user.geo = Geo.FPDGeo - it.user.ext = new UserExt(data: new UserExtData(buyeruid: PBSUtils.randomString)) + it.user.ext = new UserExt(data: new UserExtData(buyerUid: PBSUtils.randomString)) it.regs.ext ?= new RegsExt() } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy index 4966fe43ddf..4f13b59ff9c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy @@ -517,7 +517,7 @@ class LmtSpec extends PrivacyBaseSpec { bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.lat == bidRequest.user.geo.lat bidderRequest.user.geo.lon == bidRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" @@ -656,7 +656,7 @@ class LmtSpec extends PrivacyBaseSpec { bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo.lat == ampStoredRequest.user.geo.lat bidderRequest.user.geo.lon == ampStoredRequest.user.geo.lon - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Metrics processed across activities shouldn't be updated" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy index d4cbf17e2dd..f8c43d6ed9a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy @@ -172,7 +172,7 @@ abstract class PrivacyBaseSpec extends BaseSpec { yob = PBSUtils.randomNumber gender = PBSUtils.randomString geo = Geo.FPDGeo - ext = new UserExt(data: new UserExtData(buyeruid: PBSUtils.randomString)) + ext = new UserExt(data: new UserExtData(buyerUid: PBSUtils.randomString)) } } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy index 538705e3b68..b7cdcc3c4f1 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy @@ -122,17 +122,17 @@ class PrometheusSpec extends BaseSpec { serviceFailedToStartTimeoutMs) } - private Map getBasePrometheusConfig() { + private static Map getBasePrometheusConfig() { ["metrics.prometheus.enabled": "true", "metrics.prometheus.port" : PROMETHEUS_PORT as String] } - private Map getNamespaceSubsystemConfig(String namespace, String subsystem) { + private static Map getNamespaceSubsystemConfig(String namespace, String subsystem) { ["metrics.prometheus.namespace": namespace, "metrics.prometheus.subsystem": subsystem] } - private String normalizeMetricName(String metricName) { + private static String normalizeMetricName(String metricName) { metricName.replace(".", "_") .replace("-", "_") } diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy index e6dda6b407c..08f2ef25aed 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/AmpS3Spec.groovy @@ -78,12 +78,6 @@ class AmpS3Spec extends StorageBaseSpec { account = PBSUtils.randomNumber as String } - and: "Default stored request" - def ampStoredRequest = BidRequest.defaultStoredRequest.tap { - site = Site.defaultSite - setAccountId(ampRequest.account) - } - and: "Stored request in S3 service" s3Service.uploadFile(DEFAULT_BUCKET, INVALID_FILE_BODY, "${S3Service.DEFAULT_REQUEST_DIR}/${ampRequest.tagId}.json") diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/AuctionS3Spec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/AuctionS3Spec.groovy index 51d39dd5af9..cc7eb6ad188 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/AuctionS3Spec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/AuctionS3Spec.groovy @@ -53,7 +53,7 @@ class AuctionS3Spec extends StorageBaseSpec { } and: "Save storedImp with different impId into S3 service" - def secureStoredRequest = PBSUtils.getRandomNumber(0, 1) + def secureStoredRequest = PBSUtils.getRandomEnum(SecurityLevel) def storedImp = StoredImp.getStoredImp(bidRequest).tap { impId = PBSUtils.randomString impData = Imp.defaultImpression.tap { diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy index 583d6d97e06..2b1e37736fb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy @@ -51,6 +51,5 @@ class StorageBaseSpec extends BaseSpec { 'settings.database.stored-responses-query' : null ].asImmutable() as Map - protected PrebidServerService s3StoragePbsService = PbsServiceFactory.getService(s3StorageConfig + mySqlDisabledConfig) } diff --git a/src/test/groovy/org/prebid/server/functional/util/HttpUtil.groovy b/src/test/groovy/org/prebid/server/functional/util/HttpUtil.groovy index c1f60516abf..1417bdb4558 100644 --- a/src/test/groovy/org/prebid/server/functional/util/HttpUtil.groovy +++ b/src/test/groovy/org/prebid/server/functional/util/HttpUtil.groovy @@ -7,7 +7,6 @@ import static java.nio.charset.StandardCharsets.UTF_8 class HttpUtil implements ObjectMapperWrapper { - public static final String ACCEPT_HEADER = "Authorization" public static final String CONTENT_TYPE_HEADER = "Content-Type" public static final String COOKIE_HEADER = "cookie" diff --git a/src/test/groovy/org/prebid/server/functional/util/privacy/model/State.groovy b/src/test/groovy/org/prebid/server/functional/util/privacy/model/State.groovy index 9af51dceea3..1e56f4a4d88 100644 --- a/src/test/groovy/org/prebid/server/functional/util/privacy/model/State.groovy +++ b/src/test/groovy/org/prebid/server/functional/util/privacy/model/State.groovy @@ -8,8 +8,7 @@ enum State { //USA states ALABAMA("AL"), ALASKA("AK"), ARIZONA("AZ"); - - final String abbreviation; + final String abbreviation State(String abbreviation) { this.abbreviation = abbreviation From ec3b6a23bf6e83164a3098952b2d35dbd656336e Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Thu, 16 Jan 2025 19:50:27 +0200 Subject: [PATCH 02/24] Refactoring functional tests --- .../org/prebid/server/functional/model/config/Stage.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy index 3cc450219d9..ba787025f28 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy @@ -25,7 +25,11 @@ enum Stage { } static Stage forValue(ModuleHookImplementation moduleHook) { - values().find { moduleHook.code.contains(it.value) } + values() + .collect { [stage: it, matchLength: moduleHook.code.indexOf(it.value) >= 0 ? it.value.length() : -1] } + .findAll { it.matchLength > 0 } + .max { it.matchLength } + ?.stage } @Override From a31c436b9bb58ee26023b535cb89d9d958b30809 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Tue, 4 Feb 2025 20:10:02 +0200 Subject: [PATCH 03/24] Resolve conflicts --- .../tests/module/AbTestingModuleSpec.groovy | 5 ++--- .../module/ortb2blocking/Ortb2BlockingSpec.groovy | 12 ------------ .../PbRequestCorrectionSpec.groovy | 6 ------ .../ResponseCorrectionSpec.groovy | 9 --------- .../module/richmedia/RichMediaFilterSpec.groovy | 13 ++++++++++--- 5 files changed, 12 insertions(+), 33 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index c1a0794b8b4..8325eaacdee 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -48,12 +48,11 @@ class AbTestingModuleSpec extends ModuleBaseSpec { private final static Map MULTI_MODULE_CONFIG = getModuleBaseSettings(PB_RESPONSE_CORRECTION) + getModuleBaseSettings(ModuleName.ORTB2_BLOCKING) + ['hooks.host-execution-plan': null] - private static final PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getOrtb2BlockingSettings()) + private static final PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) private static final PrebidServerService pbsServiceWithMultipleModules = pbsServiceFactory.getService(MULTI_MODULE_CONFIG) def cleanupSpec() { - pbsServiceFactory.removeContainer(getOrtb2BlockingSettings()) - pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG) + pbsServiceFactory.removeContainer(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) } def "PBS shouldn't apply a/b test config when config of ab test is disabled"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy index 4317cb23f3b..8061b08d735 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy @@ -48,18 +48,6 @@ import static org.prebid.server.functional.model.response.auction.MediaType.VIDE class Ortb2BlockingSpec extends ModuleBaseSpec { - private static final String WILDCARD = '*' - private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", - "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - private static final Map PBS_CONFIG = getOrtb2BlockingSettings() + IX_CONFIG + - ['adapter-defaults.ortb.multiformat-supported': 'false'] - - private static final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(PBS_CONFIG) - - def cleanupSpec() { - pbsServiceFactory.removeContainer(PBS_CONFIG) - } - def "PBS should send original array ortb2 attribute to bidder when enforce blocking is disabled"() { given: "Default bid request with proper ortb attribute" def bidRequest = getBidRequestForOrtbAttribute(attributeName) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy index d7e997dadcb..8d76ea8dcd0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy @@ -27,12 +27,6 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { private static final String ANDROID = "android" private static final String IOS = "IOS" - private static final PrebidServerService pbsServiceWithRequestCorrectionModule = pbsServiceFactory.getService(getRequestCorrectionSettings()) - - def cleanupSpec() { - pbsServiceFactory.removeContainer(getRequestCorrectionSettings()) - } - def "PBS should remove positive instl from imps for android app when request correction is enabled for account"() { given: "Android APP bid request with version lover then version threshold" def prebid = new AppPrebid(source: PBSUtils.getRandomCase(PREBID_MOBILE), version: ACCEPTABLE_DEVICE_INSTL_VERSION_THRESHOLD) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy index d4e2cc929c1..8e5731e7ff5 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy @@ -30,15 +30,6 @@ import static org.prebid.server.functional.model.response.auction.MediaType.VIDE class ResponseCorrectionSpec extends ModuleBaseSpec { private final static int OPTIMAL_MAX_LENGTH = 20 - private static final Map PBS_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", - "adapters.generic.modifying-vast-xml-allowed": "false"] + - getResponseCorrectionConfig() - - private static final PrebidServerService pbsServiceWithResponseCorrectionModule = pbsServiceFactory.getService(PBS_CONFIG) - - def cleanupSpec() { - pbsServiceFactory.removeContainer(PBS_CONFIG) - } def "PBS shouldn't modify response when in account correction module disabled"() { given: "Start up time" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index fed9f8a095d..c42267767f6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -35,9 +35,16 @@ class RichMediaFilterSpec extends ModuleBaseSpec { endpoints.values().first().stages.values().first().groups.first.hookSequenceSnakeCase = [new HookId(moduleCodeSnakeCase: PB_RICHMEDIA_FILTER.code, hookImplCodeSnakeCase: "${PB_RICHMEDIA_FILTER.code}-${ALL_PROCESSED_BID_RESPONSES.value}-hook")] })]).collectEntries { key, value -> [(key.toString()): value.toString()] } - private static final PrebidServerService pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) - private static final PrebidServerService pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(SPECIFIC_PATTERN_NAME_CONFIG) - private static final PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + private static PrebidServerService pbsServiceWithDisabledMediaFilter + private static PrebidServerService pbsServiceWithEnabledMediaFilter + private static PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy + + + def setupSpec() { + pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + } def cleanupSpec() { pbsServiceFactory.removeContainer(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) From ed705d0788622588cbfee0d31df1390c00921b36 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Wed, 5 Feb 2025 20:06:56 +0200 Subject: [PATCH 04/24] update clean up for tests --- .../server/functional/tests/AliasSpec.groovy | 7 +- .../functional/tests/AuctionSpec.groovy | 33 +- .../tests/BidExpResponseSpec.groovy | 7 + .../tests/BidderInsensitiveCaseSpec.groovy | 17 +- .../server/functional/tests/CacheSpec.groovy | 12 +- .../functional/tests/CookieSyncSpec.groovy | 305 ++++++++++++------ .../functional/tests/CurrencySpec.groovy | 5 + .../server/functional/tests/DebugSpec.groovy | 51 ++- .../server/functional/tests/EidsSpec.groovy | 18 +- .../tests/FilterMultiFormatSpec.groovy | 147 +++------ .../server/functional/tests/GeoSpec.groovy | 1 + .../functional/tests/HttpSettingsSpec.groovy | 5 + .../functional/tests/ImpRequestSpec.groovy | 7 +- .../functional/tests/MetricsSpec.groovy | 7 +- .../functional/tests/OrtbConverterSpec.groovy | 12 +- .../server/functional/tests/SchainSpec.groovy | 26 +- .../functional/tests/SeatNonBidSpec.groovy | 21 +- .../tests/StoredResponseSpec.groovy | 6 +- .../functional/tests/TargetingSpec.groovy | 66 ++-- .../functional/tests/TimeoutSpec.groovy | 13 +- .../functional/tests/TopicsHeaderSpec.groovy | 9 +- .../server/functional/tests/UUIDSpec.groovy | 142 ++++---- .../functional/tests/UserSyncSpec.groovy | 107 +++--- .../tests/module/AbTestingModuleSpec.groovy | 1 - .../AnalyticsTagsModuleSpec.groovy | 3 + .../pricefloors/PriceFloorsBaseSpec.groovy | 5 + .../PriceFloorsCurrencySpec.groovy | 12 +- .../PriceFloorsEnforcementSpec.groovy | 28 +- .../PriceFloorsFetchingSpec.groovy | 20 +- .../pricefloors/PriceFloorsRulesSpec.groovy | 18 +- .../PriceFloorsSignalingSpec.groovy | 16 +- .../tests/prometheus/PrometheusSpec.groovy | 19 +- .../tests/storage/AccountS3Spec.groovy | 14 +- .../tests/storage/StorageBaseSpec.groovy | 2 +- 34 files changed, 712 insertions(+), 450 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/AliasSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/AliasSpec.groovy index 1ead8c32708..6748b5332d8 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AliasSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AliasSpec.groovy @@ -79,8 +79,8 @@ class AliasSpec extends BaseSpec { def "PBS should apply compression type for bidder alias when adapters.BIDDER.endpoint-compression = gzip"() { given: "PBS with adapter configuration" def compressionType = GZIP.value - def pbsService = pbsServiceFactory.getService( - ["adapters.generic.endpoint-compression": compressionType]) + def pbsConfig = ["adapters.generic.endpoint-compression": compressionType] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with alias" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -94,6 +94,9 @@ class AliasSpec extends BaseSpec { then: "Bidder request should contain header Content-Encoding = gzip" assert response.ext?.debug?.httpcalls?.get(ALIAS.value)?.requestHeaders?.first() ?.get(CONTENT_ENCODING_HEADER)?.first() == compressionType + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should return an error when GVL Id alias refers to unknown bidder alias"() { 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 f9b9688d4da..edf2e8f25d6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy @@ -181,9 +181,11 @@ class AuctionSpec extends BaseSpec { def "PBS should populate buyeruid from uids cookie when buyeruids with appropriate bidder but without value present in request"() { given: "PBS config" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.usersync.${REDIRECT.value}.url" : USER_SYNC_URL, - "adapters.${GENERIC.value}.usersync.${REDIRECT.value}.support-cors": "false"]) + def pbsConfig = PBS_CONFIG + + ["adapters.${GENERIC.value}.usersync.${REDIRECT.value}.url" : USER_SYNC_URL, + "adapters.${GENERIC.value}.usersync.${REDIRECT.value}.support-cors": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) + and: "Bid request with buyeruids" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -200,13 +202,17 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the uids cookie" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert bidderRequest?.user?.buyeruid == uidsCookie.tempUIDs[GENERIC].uid + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS shouldn't populate buyeruid from uids cookie when buyeruids with appropriate bidder but without value present in request"() { given: "PBS config" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.usersync.${REDIRECT.value}.url" : USER_SYNC_URL, - "adapters.${GENERIC.value}.usersync.${REDIRECT.value}.support-cors": "false"]) + def pbsConfig = PBS_CONFIG + + ["adapters.${GENERIC.value}.usersync.${REDIRECT.value}.url" : USER_SYNC_URL, + "adapters.${GENERIC.value}.usersync.${REDIRECT.value}.support-cors": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request with buyeruids" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -222,6 +228,9 @@ class AuctionSpec extends BaseSpec { then: "Bidder request shouldn't contain buyeruid from the uids cookie" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert !bidderRequest.user.buyeruid + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should take precedence buyeruids whenever present valid uid cookie"() { @@ -269,10 +278,11 @@ class AuctionSpec extends BaseSpec { def "PBS shouldn't populate buyeruid from cookie name config when host cookie family not matched with requested cookie-family-name"() { given: "PBS config" def cookieName = PBSUtils.randomString - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + GENERIC_CONFIG - + ["host-cookie.family" : APPNEXUS.value, - "host-cookie.cookie-name" : cookieName, - "adapters.generic.usersync.cookie-family-name": GENERIC.value]) + def pbsConfig = PBS_CONFIG + GENERIC_CONFIG + + ["host-cookie.family" : APPNEXUS.value, + "host-cookie.cookie-name" : cookieName, + "adapters.generic.usersync.cookie-family-name": GENERIC.value] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request" def bidRequest = BidRequest.defaultBidRequest @@ -287,6 +297,9 @@ class AuctionSpec extends BaseSpec { then: "Bidder request shouldn't contain buyeruid from cookieName" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert !bidderRequest.user + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS shouldn't populate buyeruid from cookie when cookie-name in cookie and config are diferent"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy index 74ac930fa9d..18be37c5dcc 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidExpResponseSpec.groovy @@ -2,6 +2,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.config.AccountAuctionConfig import org.prebid.server.functional.model.config.AccountConfig +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Imp @@ -33,6 +34,12 @@ class BidExpResponseSpec extends BaseSpec { private static def pbsEmptyTtlService = pbsServiceFactory.getService(EMPTY_CACHE_TTL_CONFIG + EMPTY_CACHE_TTL_HOST_CONFIG) private static def pbsHostAndDefaultCacheTtlService = pbsServiceFactory.getService(CACHE_TTL_HOST_CONFIG + DEFAULT_CACHE_TTL_CONFIG) + def cleanupSpec() { + pbsServiceFactory.removeContainer(CACHE_TTL_HOST_CONFIG + EMPTY_CACHE_TTL_CONFIG) + pbsServiceFactory.removeContainer(EMPTY_CACHE_TTL_CONFIG + EMPTY_CACHE_TTL_HOST_CONFIG) + pbsServiceFactory.removeContainer(CACHE_TTL_HOST_CONFIG + DEFAULT_CACHE_TTL_CONFIG) + } + def "PBS auction should resolve bid.exp from response that is set by the bidder’s adapter"() { given: "Default basicResponse with exp" def bidResponseExp = PBSUtils.randomNumber diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy index 36f5332b7f5..a6dc63f08f8 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy @@ -282,9 +282,9 @@ class BidderInsensitiveCaseSpec extends BaseSpec { def "PBS should respond errors with same bidder name which bidder name came in request with another case strategy"() { given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - ["adapter-defaults.enabled": "false", - "adapters.generic.enabled": "false"]) + def pbsConfig = ["adapter-defaults.enabled": "false", + "adapters.generic.enabled": "false"] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -299,13 +299,15 @@ class BidderInsensitiveCaseSpec extends BaseSpec { then: "Response should contain error" assert response.ext?.errors[ErrorType.GENERIC_CAMEL_CASE]*.code == [2] + + } def "PBS should respond warnings with same bidder name which bidder name came in request with another case strategy"() { given: "Pbs config" - def pbsService = pbsServiceFactory.getService( - ["auction.filter-imp-media-type.enabled" : "true", - "adapters.generic.meta-info.app-media-types": ""]) + def pbsConfig = ["auction.filter-imp-media-type.enabled" : "true", + "adapters.generic.meta-info.app-media-types": ""] + def pbsService = pbsServiceFactory.getService(pbsConfig) def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { imp[0].ext.prebid.bidder.tap { @@ -324,6 +326,9 @@ class BidderInsensitiveCaseSpec extends BaseSpec { assert response.ext?.warnings[ErrorType.GENERIC_CAMEL_CASE]*.code == [2] assert response.ext?.warnings[ErrorType.GENERIC_CAMEL_CASE]*.message == ["Bidder does not support any media types."] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should respond responsetimemillis with same bidder name which bidder name came in request with another case strategy"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy index 4f8dcf7675e..109f90fbeb1 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy @@ -97,7 +97,8 @@ class CacheSpec extends BaseSpec { def "PBS should cache bids without api-key header when targeting is specified and api-key-secured disabled"() { given: "Pbs config with disabled api-key-secured and pbc.api.key" def apiKey = PBSUtils.randomString - def pbsService = pbsServiceFactory.getService(['pbc.api.key': apiKey, 'cache.api-key-secured': 'false']) + def pbsConfig = ['pbc.api.key': apiKey, 'cache.api-key-secured': 'false'] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with cache, targeting" def bidRequest = BidRequest.defaultBidRequest @@ -113,12 +114,16 @@ class CacheSpec extends BaseSpec { and: "PBS call shouldn't include api-key" assert !prebidCache.getRequestHeaders(bidRequest.imp[0].id)[PBS_API_HEADER] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should cache bids with api-key header when targeting is specified and api-key-secured enabled"() { given: "Pbs config with api-key-secured and pbc.api.key" def apiKey = PBSUtils.randomString - def pbsService = pbsServiceFactory.getService(['pbc.api.key': apiKey, 'cache.api-key-secured': 'true']) + def pbsConfig = ['pbc.api.key': apiKey, 'cache.api-key-secured': 'true'] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with cache, targeting" def bidRequest = BidRequest.defaultBidRequest @@ -134,6 +139,9 @@ class CacheSpec extends BaseSpec { and: "PBS call should include api-key" assert prebidCache.getRequestHeaders(bidRequest.imp[0].id)[PBS_API_HEADER] == [apiKey] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should not cache bids when targeting isn't specified"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy index 29542fd8326..3429ffc0342 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy @@ -99,12 +99,17 @@ class CookieSyncSpec extends BaseSpec { private final PrebidServerService prebidServerService = pbsServiceFactory.getService(PBS_CONFIG) + def cleanupSpec() { + pbsServiceFactory.removeContainer(PBS_CONFIG) + } + def "PBS cookie sync request should replace synced as family bidder and fill up response with enabled bidders to the limit in request"() { given: "PBS config with alias bidder without cookie family name" def bidderAlias = ALIAS - def prebidServerService = pbsServiceFactory.getService(GENERIC_CONFIG + APPNEXUS_CONFIG - + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", - "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null]) + def pbsConfig = GENERIC_CONFIG + APPNEXUS_CONFIG + +["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", + "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def requestLimit = 2 @@ -127,12 +132,15 @@ class CookieSyncSpec extends BaseSpec { and: "Response should contain coop-synced bidder" assert response.getBidderUserSync(GENERIC) assert response.getBidderUserSync(APPNEXUS) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should replace bidder without config and fill up response with enabled bidders to the limit in request"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(RUBICON_CONFIG + APPNEXUS_CONFIG - + ["adapters.${BOGUS.value}.enabled": "true"]) + def pbsConfig = RUBICON_CONFIG + APPNEXUS_CONFIG + ["adapters.${BOGUS.value}.enabled": "true"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default Cookie sync request" def requestLimit = 2 @@ -155,11 +163,15 @@ class CookieSyncSpec extends BaseSpec { and: "Response should contain coop-synced bidder" assert response.getBidderUserSync(RUBICON) assert response.getBidderUserSync(APPNEXUS) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should replace unknown bidder and fill up response with enabled bidders to the limit in request"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(RUBICON_CONFIG + APPNEXUS_CONFIG) + def pbsConfig = RUBICON_CONFIG + APPNEXUS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request" def requestLimit = 2 @@ -182,12 +194,15 @@ class CookieSyncSpec extends BaseSpec { and: "Response should contain coop-synced bidder" assert response.getBidderUserSync(RUBICON) assert response.getBidderUserSync(APPNEXUS) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should replace disabled bidder and fill up response with enabled bidders to the limit in request"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(RUBICON_CONFIG + APPNEXUS_CONFIG - + ["adapters.${GENERIC.value}.enabled": "false",]) + def pbsConfig = RUBICON_CONFIG + APPNEXUS_CONFIG + ["adapters.${GENERIC.value}.enabled": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default Cookie sync request" def requestLimit = 2 @@ -210,11 +225,15 @@ class CookieSyncSpec extends BaseSpec { and: "Response should contain coop-synced bidder" assert response.getBidderUserSync(RUBICON) assert response.getBidderUserSync(APPNEXUS) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should replace filtered bidder and fill up response with enabled bidders to the limit in request"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(RUBICON_CONFIG + APPNEXUS_CONFIG) + def pbsConfig = RUBICON_CONFIG + APPNEXUS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request" def requestLimit = 2 @@ -238,12 +257,15 @@ class CookieSyncSpec extends BaseSpec { and: "Response should contain coop-synced bidder" assert response.getBidderUserSync(RUBICON) assert response.getBidderUserSync(APPNEXUS) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request shouldn't reflect error when coop-sync enabled and coop sync bidder disabled"() { given: "PBS bidder config " - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.enabled": "false"]) + def pbsConfig = PBS_CONFIG + ["adapters.${GENERIC.value}.enabled": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -256,12 +278,15 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't return error" assert !response.getBidderUserSync(GENERIC) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request shouldn't reflect error when coop-sync enabled and coop sync bidder without sync config"() { given: "PBS bidder config without cookie family name" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.${GENERIC.value}.usersync.cookie-family-name": null]) + def pbsConfig = ["adapters.${GENERIC.value}.usersync.cookie-family-name": null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -274,6 +299,9 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't return error" assert !response.getBidderUserSync(GENERIC) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request shouldn't reflect error when coop-sync enabled and coop sync bidder family already in uids cookie"() { @@ -294,9 +322,10 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request shouldn't reflect error when coop-sync enabled and coop sync bidder synced as family"() { given: "PBS config with alias bidder without cookie family name" def bidderAlias = ALIAS - def prebidServerService = pbsServiceFactory.getService(GENERIC_CONFIG - + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", - "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null,]) + def pbsConfig = GENERIC_CONFIG + + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", + "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with 2 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -309,6 +338,9 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't return error" assert !response.getBidderUserSync(bidderAlias) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should reflect error when coop-sync enabled and coop sync bidder with gdpr"() { @@ -341,8 +373,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request should reflect error when coop-sync enabled and coop sync bidder with ccpa"() { given: "PBS bidder config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["adapters.${bidderName.value}.ccpa-enforced": "true"] + GENERIC_CONFIG) + def pbsConfig = ["adapters.${bidderName.value}.ccpa-enforced": "true"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with account and privacy" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -364,6 +396,9 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain error" def bidderStatus = response.getBidderUserSync(bidderName) assert bidderStatus.error == "Rejected by CCPA" + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should reflect error when coop-sync enabled and coop sync bidder filtered"() { @@ -420,8 +455,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request should reflect error even when response is full by PBS config limit"() { given: "PBS config with expanded limit" - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": "1"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": "1"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with coop-sync and without bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -442,6 +477,9 @@ class CookieSyncSpec extends BaseSpec { assert bogusBidderStatus?.error == "Unsupported bidder" assert bogusBidderStatus?.noCookie == null assert bogusBidderStatus?.userSync == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should reflect error even when response is full by request limit"() { @@ -525,8 +563,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync should be able to define cookie family name"() { given: "PBS bidder config with defined cookie family name" def bidder = BOGUS - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.usersync.cookie-family-name": bidder.value]) + def pbsConfig = PBS_CONFIG + ["adapters.${GENERIC.value}.usersync.cookie-family-name": bidder.value] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -544,13 +582,17 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus?.userSync?.type == USER_SYNC_TYPE assert bidderStatus?.userSync?.supportCORS == CORS_SUPPORT assert bidderStatus?.noCookie == true + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync should be able to read custom cookie family name from uids cookie"() { given: "PBS bidder config with defined cookie family name" def bidder = BOGUS - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG + - ["adapters.${GENERIC.value}.usersync.cookie-family-name": bidder.value]) + def pbsConfig = PBS_CONFIG + + ["adapters.${GENERIC.value}.usersync.cookie-family-name": bidder.value] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -568,6 +610,9 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus.error == "Already in sync" assert bidderStatus?.userSync == null assert bidderStatus?.noCookie == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with unknown bidder respond with an error for that bidder"() { @@ -599,8 +644,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request with bidder without cookie family name should emit an error"() { given: "PBS bidder config without cookie family name" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.${GENERIC.value}.usersync.cookie-family-name": null]) + def pbsConfig = ["adapters.${GENERIC.value}.usersync.cookie-family-name": null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -613,12 +658,15 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus?.error == "No sync config" assert bidderStatus?.noCookie == null assert bidderStatus?.userSync == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with disabled bidder should emit an error"() { given: "PBS config with disabled bidder" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.${GENERIC.value}.enabled": "false"]) + def pbsConfig = ["adapters.${GENERIC.value}.enabled": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -631,13 +679,16 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus?.error == "Disabled bidder" assert bidderStatus?.noCookie == null assert bidderStatus?.userSync == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with enabled coop-sync should sync all enabled bidders"() { given: "PBS config with expanded limit" def countOfEnabledBidders = 3 - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": countOfEnabledBidders.toString()] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": countOfEnabledBidders.toString()] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with coop-sync and without bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -650,14 +701,18 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain all 3 enabled bidders" assert response.bidderStatus.size() == countOfEnabledBidders + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with alias bidder should sync as the source bidder when alias doesn't override cookie-family-name"() { given: "PBS config with alias bidder without cookie family name" def bidderAlias = ALIAS - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", - "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null]) + def pbsConfig = PBS_CONFIG + + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", + "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with 2 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -677,14 +732,18 @@ class CookieSyncSpec extends BaseSpec { assert mainBidderStatus?.userSync?.type == USER_SYNC_TYPE assert mainBidderStatus?.userSync?.supportCORS == CORS_SUPPORT assert mainBidderStatus?.noCookie == true + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with alias bidder should sync independently when alias provide cookie-family-name"() { given: "PBS config with alias bidder with cookie family name" def bidderAlias = ALIAS - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG - + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", - "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": bidderAlias.value]) + def pbsConfig = PBS_CONFIG + + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", + "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": bidderAlias.value] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with 2 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -702,14 +761,17 @@ class CookieSyncSpec extends BaseSpec { assert it.userSync?.supportCORS == CORS_SUPPORT assert it.noCookie == true } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with host cookie should return bidder sync with host cookie uid when there is no uids cookie"() { given: "PBS bidders config" def cookieName = PBSUtils.randomString - def prebidServerService = pbsServiceFactory.getService( - ["host-cookie.family" : GENERIC.value, - "host-cookie.cookie-name": cookieName] + PBS_CONFIG) + def pbsConfig = ["host-cookie.family" : GENERIC.value, + "host-cookie.cookie-name": cookieName] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def uidsCookie = UidsCookie.defaultUidsCookie @@ -727,14 +789,17 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain uid from cookies" def bidderStatus = response.getBidderUserSync(GENERIC) assert HttpUtil.decodeUrl(bidderStatus.userSync?.url).contains("uid=${uid}") + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with host cookie should return bidder sync with host cookie uid when uids are different"() { given: "PBS bidders config" def cookieName = PBSUtils.randomString - def prebidServerService = pbsServiceFactory.getService( - ["host-cookie.family" : GENERIC.value, - "host-cookie.cookie-name": cookieName] + PBS_CONFIG) + def pbsConfig = ["host-cookie.family" : GENERIC.value, + "host-cookie.cookie-name": cookieName] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def uidsCookie = UidsCookie.defaultUidsCookie.tap { @@ -754,14 +819,17 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain uid from cookies" def bidderStatus = response.getBidderUserSync(GENERIC) assert HttpUtil.decodeUrl(bidderStatus.userSync?.url).contains("uid=${hostCookieUid}") + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with host cookie should return an error when host cookie uid matches uids cookie uid for bidder"() { given: "PBS bidders config" def cookieName = PBSUtils.randomString - def prebidServerService = pbsServiceFactory.getService( - ["host-cookie.family" : GENERIC.value, - "host-cookie.cookie-name": cookieName] + PBS_CONFIG) + def pbsConfig = ["host-cookie.family" : GENERIC.value, + "host-cookie.cookie-name": cookieName] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -783,13 +851,16 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus?.error == "Already in sync" assert bidderStatus?.noCookie == null assert bidderStatus?.userSync == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request with host cookie shouldn't return bidder sync when host cookie doesn't match requested bidder"() { given: "PBS bidders config" - def prebidServerService = pbsServiceFactory.getService( - ["host-cookie.family" : PBSUtils.randomString, - "host-cookie.cookie-name": PBSUtils.randomString] + PBS_CONFIG) + def pbsConfig = ["host-cookie.family" : PBSUtils.randomString, + "host-cookie.cookie-name": PBSUtils.randomString] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -814,9 +885,9 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request with host cookie shouldn't return bidder sync when host cookie doesn't have configured name"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["host-cookie.family" : bidderName.value, - "host-cookie.cookie-name": null] + PBS_CONFIG) + def pbsConfig = ["host-cookie.family" : bidderName.value, + "host-cookie.cookie-name": null] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" def uidsCookie = UidsCookie.defaultUidsCookie @@ -832,6 +903,9 @@ class CookieSyncSpec extends BaseSpec { assert bidderStatus?.error == "Already in sync" assert bidderStatus?.noCookie == null assert bidderStatus?.userSync == null + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync without cookie-sync.default-limit config and with cookie sync account config limit should use limit from request"() { @@ -860,8 +934,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with cookie-sync.default-limit config should use limit from cookie sync account config"() { given: "PBS bidders config" - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": "2"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": "2"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 3 bidders" def accountId = PBSUtils.randomNumber @@ -883,12 +957,15 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain one synced bidder" assert response.bidderStatus.size() == accountDefaultLimit + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.default-limit config should use limit from request"() { given: "PBS config" - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": "2"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": "2"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 3 bidders" def requestLimit = 1 @@ -903,13 +980,16 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain only two synced bidder" assert response.bidderStatus.size() == requestLimit + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.default-limit config should use limit from PBS config"() { given: "PBS config" def defaultLimit = 1 - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": defaultLimit.toString()] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": defaultLimit.toString()] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 2 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -922,14 +1002,17 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain only one synced bidder" assert response.bidderStatus.size() == defaultLimit + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.max-limit should use max-limit from PBS config"() { given: "PBS bidders config" def maxLimit = 2 - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.max-limit" : maxLimit.toString(), - "cookie-sync.default-limit": "1"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.max-limit" : maxLimit.toString(), + "cookie-sync.default-limit": "1"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 3 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -943,13 +1026,16 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain only one synced bidder" assert response.bidderStatus.size() == maxLimit + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.max-limit should use max-limit from cookie sync account config"() { given: "PBS bidders config" - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.default-limit": "1", - "cookie-sync.max-limit" : "1"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.default-limit": "1", + "cookie-sync.max-limit" : "1"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 3 bidders" def accountId = PBSUtils.randomNumber @@ -981,9 +1067,9 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with cookie-sync.pri and enabled coop-sync in config should sync bidder which present in cookie-sync.pri config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.coop-sync.default": "true", - "cookie-sync.pri" : bidderName.value] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.coop-sync.default": "true", + "cookie-sync.pri" : bidderName.value] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -998,14 +1084,17 @@ class CookieSyncSpec extends BaseSpec { def genericBidder = response.getBidderUserSync(bidderName) assert genericBidder?.userSync?.url assert genericBidder?.userSync?.type + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.pri and disabled coop-sync in config shouldn't sync bidder which present in cookie-sync.pir config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.coop-sync.default": "false", - "cookie-sync.pri" : bidderName.value] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.coop-sync.default": "false", + "cookie-sync.pri" : bidderName.value] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -1046,13 +1135,13 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't contain generic bidder which present in cookie-sync.pri config" assert !response.getBidderUserSync(bidderName) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync should sync bidder by limit value"() { - given: "PBS config with bidders usersync config" - def prebidServerService = pbsServiceFactory.getService(PBS_CONFIG) - - and: "Default cookie sync request with 2 bidders and limit of 1" + given: "Default cookie sync request with 2 bidders and limit of 1" def limit = 1 def bidders = [GENERIC, RUBICON] def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -1174,9 +1263,9 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with cookie-sync.pri and enabled coop sync should sync bidder which present in cookie-sync.pri"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : bidderName.value, - "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : bidderName.value, + "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with coop-sync" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -1191,14 +1280,17 @@ class CookieSyncSpec extends BaseSpec { def genericBidder = response.getBidderUserSync(bidderName) assert genericBidder?.userSync?.url assert genericBidder?.userSync?.type + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with pri and enabled coop sync in cookie sync account should sync bidder which present in pir account config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : "null", - "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : "null", + "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber @@ -1221,14 +1313,17 @@ class CookieSyncSpec extends BaseSpec { def genericBidder = response.getBidderUserSync(bidderName) assert genericBidder?.userSync?.url assert genericBidder?.userSync?.type + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with coop-sync.default config and pri in cookie sync account should sync bidder which present in pir account config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : "null", - "cookie-sync.coop-sync.default": "true"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : "null", + "cookie-sync.coop-sync.default": "true"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber @@ -1251,14 +1346,17 @@ class CookieSyncSpec extends BaseSpec { def genericBidder = response.getBidderUserSync(bidderName) assert genericBidder?.userSync?.url assert genericBidder?.userSync?.type + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.pri and enabled coop sync in account should sync bidder which present in cookie-sync.pir config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : bidderName.value, - "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : bidderName.value, + "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber @@ -1281,14 +1379,17 @@ class CookieSyncSpec extends BaseSpec { def genericBidder = response.getBidderUserSync(bidderName) assert genericBidder?.userSync?.url assert genericBidder?.userSync?.type + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with cookie-sync.pri and disabled coop-sync in request shouldn't sync bidder which present in cookie-sync.pri config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : bidderName.value, - "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : bidderName.value, + "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -1301,6 +1402,9 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't contain generic bidder" assert !response.getBidderUserSync(bidderName) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync with filter setting should reject bidder sync"() { @@ -1348,8 +1452,8 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with ccpa should reject bidder sync"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.${GENERIC.value}.ccpa-enforced": "true"] + GENERIC_CONFIG) + def pbsConfig = ["adapters.${GENERIC.value}.ccpa-enforced": "true"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Flush metrics" flushMetrics(prebidServerService) @@ -1372,14 +1476,17 @@ class CookieSyncSpec extends BaseSpec { then: "Response should contain error" def bidderStatus = response.getBidderUserSync(GENERIC) assert bidderStatus.error == "Rejected by CCPA" + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync should emit error when requested bidder rejected by limit"() { given: "PBS config with bidders usersync config" def limit = 1 - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.max-limit" : limit as String, - "cookie-sync.default-limit": limit as String] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.max-limit" : limit as String, + "cookie-sync.default-limit": limit as String] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 2 bidders" def bidders = [GENERIC, RUBICON] @@ -1398,13 +1505,16 @@ class CookieSyncSpec extends BaseSpec { def rejectedBidderUserSyncs = getRejectedBidderUserSyncs(response) assert rejectedBidderUserSyncs.size() == bidders.size() - limit assert rejectedBidderUserSyncs.every { it.value == "limit reached" } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync shouldn't emit error limit reached when bidder coop-synced"() { given: "PBS config with bidders usersync config" - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.max-limit" : "1", - "cookie-sync.default-limit": "1"] + PBS_CONFIG) + def pbsConfig = ["cookie-sync.max-limit" : "1", + "cookie-sync.default-limit": "1"] + PBS_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 2 bidders" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -1417,6 +1527,9 @@ class CookieSyncSpec extends BaseSpec { then: "Response shouldn't contain generic bidder" assert !response.getBidderUserSync(GENERIC) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS cookie sync request should successful pass when request body empty"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy index df5bba70028..86aeb7fdb0a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy @@ -1,6 +1,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.Currency +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.mock.services.currencyconversion.CurrencyConversionRatesResponse import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.response.auction.BidResponse @@ -32,6 +33,10 @@ class CurrencySpec extends BaseSpec { } private static final PrebidServerService pbsService = pbsServiceFactory.getService(externalCurrencyConverterConfig) + def cleanupSpec() { + pbsServiceFactory.removeContainer(externalCurrencyConverterConfig) + } + def "PBS should return currency rates"() { when: "PBS processes bidders params request" def response = pbsService.withWarmup().sendCurrencyRatesRequest() diff --git a/src/test/groovy/org/prebid/server/functional/tests/DebugSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/DebugSpec.groovy index ea169ad00ee..22dd16b2b9a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/DebugSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/DebugSpec.groovy @@ -14,6 +14,7 @@ import org.prebid.server.functional.model.request.auction.StoredBidResponse import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.model.response.auction.ErrorType import org.prebid.server.functional.service.PrebidServerException +import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.util.PBSUtils import spock.lang.PendingFeature @@ -33,6 +34,14 @@ class DebugSpec extends BaseSpec { private static final String ACCOUNT_DEBUG_REQUESTS_METRIC = "account.%s.debug_requests" private static final String REQUEST_OK_WEB_METRICS = "requests.ok.openrtb2-web" + private static final PrebidServerService enabledDebugPbsService = pbsServiceFactory.getService("adapters.generic.debug.allow": "true") + private static final PrebidServerService disabledDebugPbsService = pbsServiceFactory.getService("adapters.generic.debug.allow": "false") + + def cleanupSpec() { + pbsServiceFactory.removeContainer("adapters.generic.debug.allow": "true") + pbsServiceFactory.removeContainer("adapters.generic.debug.allow": "false") + } + def "PBS should return debug information and emit metrics when debug flag is #debug and test flag is #test"() { given: "Default BidRequest with test flag" def bidRequest = BidRequest.defaultBidRequest @@ -92,15 +101,12 @@ class DebugSpec extends BaseSpec { } def "PBS should not return debug information when bidder-level setting debug.allowed = false"() { - given: "Pbs config" - def pbsService = pbsServiceFactory.getService(["adapters.generic.debug.allow": "false"]) - - and: "Default basic generic BidRequest" + given: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest bidRequest.ext.prebid.debug = ENABLED when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = disabledDebugPbsService.sendAuctionRequest(bidRequest) then: "Response should not contain ext.debug" assert !response.ext?.debug?.httpcalls @@ -112,15 +118,12 @@ class DebugSpec extends BaseSpec { } def "PBS should return debug information when bidder-level setting debug.allowed = true"() { - given: "Pbs config" - def pbsService = pbsServiceFactory.getService(["adapters.generic.debug.allow": "true"]) - - and: "Default basic generic BidRequest" + given: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest bidRequest.ext.prebid.debug = ENABLED when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = enabledDebugPbsService.sendAuctionRequest(bidRequest) then: "Response should contain ext.debug" assert response.ext?.debug?.httpcalls[GENERIC.value] @@ -130,10 +133,7 @@ class DebugSpec extends BaseSpec { } def "PBS should not return debug information when bidder-level setting debug.allowed = false is overridden by account-level setting debug-allowed = false"() { - given: "Pbs config" - def pbsService = pbsServiceFactory.getService(["adapters.generic.debug.allow": "false"]) - - and: "Default basic generic BidRequest" + given: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest bidRequest.ext.prebid.debug = ENABLED @@ -142,7 +142,7 @@ class DebugSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = disabledDebugPbsService.sendAuctionRequest(bidRequest) then: "Response should not contain ext.debug" assert !response.ext?.debug @@ -160,10 +160,7 @@ class DebugSpec extends BaseSpec { } def "PBS should not return debug information when bidder-level setting debug.allowed = false is overridden by account-level setting debug-allowed = true"() { - given: "Pbs config" - def pbsService = pbsServiceFactory.getService(["adapters.generic.debug.allow": "false"]) - - and: "Default basic generic BidRequest" + given: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest bidRequest.ext.prebid.debug = ENABLED @@ -172,7 +169,7 @@ class DebugSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = disabledDebugPbsService.sendAuctionRequest(bidRequest) then: "Response should not contain ext.debug" assert !response.ext?.debug?.httpcalls @@ -189,10 +186,7 @@ class DebugSpec extends BaseSpec { } def "PBS should not return debug information when bidder-level setting debug.allowed = true is overridden by account-level setting debug-allowed = false"() { - given: "Pbs config" - def pbsService = pbsServiceFactory.getService(["adapters.generic.debug.allow": "true"]) - - and: "Default basic generic BidRequest" + given: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest bidRequest.ext.prebid.debug = ENABLED @@ -202,7 +196,7 @@ class DebugSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = enabledDebugPbsService.sendAuctionRequest(bidRequest) then: "Response should not contain ext.debug" assert !response.ext?.debug @@ -230,7 +224,7 @@ class DebugSpec extends BaseSpec { def "PBS should return debug information when bidder-level setting debug.allowed = #debugAllowedConfig and account-level setting debug-allowed = #debugAllowedAccount is overridden by x-pbs-debug-override header"() { given: "PBS with debug configuration" - def pbsService = pbsServiceFactory.getService(pbdConfig) + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic generic BidRequest" def bidRequest = BidRequest.defaultBidRequest @@ -250,8 +244,11 @@ class DebugSpec extends BaseSpec { and: "Response should not contain ext.warnings" assert !response.ext?.warnings + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: - debugAllowedConfig | debugAllowedAccount | pbdConfig + debugAllowedConfig | debugAllowedAccount | pbsConfig false | true | ["debug.override-token" : overrideToken, "adapters.generic.debug.allow": "false"] true | false | ["debug.override-token" : overrideToken, diff --git a/src/test/groovy/org/prebid/server/functional/tests/EidsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/EidsSpec.groovy index 46b0ff2a5aa..b4d266cd456 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/EidsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/EidsSpec.groovy @@ -159,9 +159,9 @@ class EidsSpec extends BaseSpec { def "PBs eid permissions should affect only specified on source"() { given: "PBs with openx bidder" - def pbsService = pbsServiceFactory.getService( - ["adapters.openx.enabled" : "true", - "adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()]) + def pbsConfig = ["adapters.openx.enabled" : "true", + "adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with eidpremissions and openx bidder" def eidSource = PBSUtils.randomString @@ -186,13 +186,16 @@ class EidsSpec extends BaseSpec { and: "Openx bidder should contain two eids" assert bidderRequests[OPENX.value].user.eids.sort().last.sort() == eids.sort() + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBs eid permissions for non existing source should not stop auction"() { given: "PBs with openx bidder" - def pbsService = pbsServiceFactory.getService( - ["adapters.openx.enabled" : "true", - "adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()]) + def pbsConfig = ["adapters.openx.enabled" : "true", + "adapters.openx.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with eidpremissions and openx bidder" def firstEid = new Eid(source: PBSUtils.randomString, uids: [new Uid(id: PBSUtils.randomString)]) @@ -215,6 +218,9 @@ class EidsSpec extends BaseSpec { bidderRequests.user.eids.each { assert it.sort() == [secondEid, firstEid].sort() } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBs missing bidders in eid permissions should throw an error"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/FilterMultiFormatSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/FilterMultiFormatSpec.groovy index 1d36b8beadc..7640a98bead 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/FilterMultiFormatSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/FilterMultiFormatSpec.groovy @@ -20,12 +20,25 @@ import static org.prebid.server.functional.model.response.auction.MediaType.NULL class FilterMultiFormatSpec extends BaseSpec { - def "PBS should respond with all requested media types when default adapters multi format is true in config and preferred media type specified at account level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "true") + private static final Map ENABLED_MULTI_FORMAT = ["adapter-defaults.ortb.multiformat-supported": "true"] + private static final Map DISABLED_MULTI_FORMAT = ["adapter-defaults.ortb.multiformat-supported": "false"] + private static final Map DISABLED_MULTI_FORMAT_DEFAULT = [ + "adapter-defaults.ortb.multiformat-supported": "false", + "adapters.generic.ortb.multiformat-supported": "false" + ] + + private static def enabledMultiFormatPbsService = pbsServiceFactory.getService(ENABLED_MULTI_FORMAT) + private static def disabledMultiFormatPbsService = pbsServiceFactory.getService(DISABLED_MULTI_FORMAT) + private static def disabledMultiFormatDefaultPbsService = pbsServiceFactory.getService(DISABLED_MULTI_FORMAT_DEFAULT) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(ENABLED_MULTI_FORMAT) + pbsServiceFactory.removeContainer(DISABLED_MULTI_FORMAT) + pbsServiceFactory.removeContainer(DISABLED_MULTI_FORMAT_DEFAULT) + } - and: "Default bid request with banner and audio type" + def "PBS should respond with all requested media types when default adapters multi format is true in config and preferred media type specified at account level"() { + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -37,7 +50,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + enabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain all requested type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -46,11 +59,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with all requested media types when default adapters multi format is true in config and preferred media type specified at request level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "true") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -58,7 +67,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + enabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain all requested type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -73,11 +82,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with one requested preferred media type when default adapters multi format is false in config and preferred media type specified at account level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -89,7 +94,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain only requested preferred media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -98,11 +103,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with one requested preferred media type when default adapters multi format is false in config and preferred media type specified at request level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -110,7 +111,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain only requested preferred media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -125,11 +126,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with all requested media type when multi format is true in config and preferred media type specified at request level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "true") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -137,7 +134,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + enabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain all requested media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -152,11 +149,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with all requested media type when multi format is true in config and preferred media type specified at account level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "true") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -168,7 +161,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + enabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain all requested media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -177,11 +170,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with one requested preferred media type when multi format is false in config and preferred media type specified at account level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -193,7 +182,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain only requested preferred media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -202,11 +191,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with one requested preferred media type when multi format is false in config and preferred media type preferred at request level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -214,7 +199,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain only requested preferred media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -229,11 +214,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with warning and don't make a bidder call when multi format at request and preferred media type specified at account level with non requested media type"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with audio and nativeObj type" + given: "Default bid request with audio and nativeObj type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = null imp[0].audio = Audio.defaultAudio @@ -246,7 +227,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS shouldn't make bidder request" assert !bidder.getBidderRequests(bidRequest.id) @@ -258,11 +239,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with warning and don't make a bidder call when multi format at request and preferred media type specified at request level with non requested media type"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with audio and nativeObj type and preferredMediaType BANNER" + given: "Default bid request with audio and nativeObj type and preferredMediaType BANNER" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = null imp[0].audio = Audio.defaultAudio @@ -271,7 +248,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS shouldn't make bidder request" assert !bidder.getBidderRequests(bidRequest.id) @@ -289,11 +266,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS shouldn't respond with warning and make a bidder call when request doesn't contain multi format and preferred media type specified at account level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with audio and nativeObj type" + given: "Default bid request with audio and nativeObj type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = null imp[0].audio = Audio.defaultAudio @@ -305,7 +278,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS should make bidder request" def bidderRequests = bidder.getBidderRequests(bidRequest.id) @@ -316,11 +289,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS shouldn't respond with warning and make a bidder call when request doesn't contain multi format and preferred media type specified at request level"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with audio and nativeObj type and preferredMediaType BANNER" + given: "Default bid request with audio and nativeObj type and preferredMediaType BANNER" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = null imp[0].audio = Audio.defaultAudio @@ -328,7 +297,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS should make bidder request" def bidderRequests = bidder.getBidderRequests(bidRequest.id) @@ -345,11 +314,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS shouldn't respond with warning and make a bidder call when request doesn't contain multi format and multi format is false and preferred media type specified at request level with null"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.getDefaultBanner() imp[0].audio = Audio.defaultAudio @@ -357,7 +322,7 @@ class FilterMultiFormatSpec extends BaseSpec { } when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS should make bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -373,11 +338,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS shouldn't respond with warning and make a bidder call when request doesn't contain multi format and multi format is false and preferred media type specified at account level with null"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.getDefaultBanner() imp[0].audio = Audio.defaultAudio @@ -389,7 +350,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = disabledMultiFormatPbsService.sendAuctionRequest(bidRequest) then: "PBS should make bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -399,12 +360,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should respond with preferred media type that specified in request when preferred media type specified in both places"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "false", - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with banner and audio type" + given: "Default bid request with banner and audio type" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].banner = Banner.defaultBanner imp[0].audio = Audio.defaultAudio @@ -417,7 +373,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatDefaultPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain requested preferred media type" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -432,12 +388,7 @@ class FilterMultiFormatSpec extends BaseSpec { } def "PBS should not preferred media type specified at request level when it's alias bidder"() { - given: "PBS with adapter configuration" - def pbsService = pbsServiceFactory.getService( - "adapter-defaults.ortb.multiformat-supported": "false", - "adapters.generic.ortb.multiformat-supported": "false") - - and: "Default bid request with alias" + given: "Default bid request with alias" def bidRequest = BidRequest.defaultBidRequest.tap { imp[0].tap { banner = Banner.defaultBanner @@ -459,7 +410,7 @@ class FilterMultiFormatSpec extends BaseSpec { accountDao.save(account) when: "PBS processes auction request" - pbsService.sendAuctionRequest(bidRequest) + disabledMultiFormatDefaultPbsService.sendAuctionRequest(bidRequest) then: "Bidder request should contain preferred media type from account config" def bidderRequest = bidder.getBidderRequest(bidRequest.id) diff --git a/src/test/groovy/org/prebid/server/functional/tests/GeoSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/GeoSpec.groovy index 3d19d9d878d..808d16ccb04 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/GeoSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/GeoSpec.groovy @@ -23,6 +23,7 @@ import static org.prebid.server.functional.util.privacy.model.State.QUEBEC class GeoSpec extends BaseSpec { + // TODO refactor containers for this spec private static final String GEO_LOCATION_REQUESTS = "geolocation_requests" private static final String GEO_LOCATION_FAIL = "geolocation_fail" private static final String GEO_LOCATION_SUCCESSFUL = "geolocation_successful" diff --git a/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy index 2c6d1556a81..3ebed4dce5e 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy @@ -1,6 +1,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.UidsCookie +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.db.StoredRequest import org.prebid.server.functional.model.mock.services.httpsettings.HttpAccountsResponse import org.prebid.server.functional.model.request.amp.AmpRequest @@ -29,6 +30,10 @@ class HttpSettingsSpec extends BaseSpec { @Shared PrebidServerService prebidServerService = pbsServiceFactory.getService(PbsConfig.httpSettingsConfig) + def cleanupSpec() { + pbsServiceFactory.removeContainer(PbsConfig.httpSettingsConfig) + } + def "PBS should take account information from http data source on auction request"() { given: "Get basic BidRequest with generic bidder and set gdpr = 1" def bidRequest = BidRequest.defaultBidRequest diff --git a/src/test/groovy/org/prebid/server/functional/tests/ImpRequestSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/ImpRequestSpec.groovy index 4cc3b728449..a3c85e640ba 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/ImpRequestSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/ImpRequestSpec.groovy @@ -2,6 +2,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.bidder.Generic import org.prebid.server.functional.model.bidder.Openx +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.db.StoredImp import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Imp @@ -24,9 +25,13 @@ import static org.prebid.server.functional.testcontainers.Dependencies.getNetwor class ImpRequestSpec extends BaseSpec { - private final PrebidServerService defaultPbsServiceWithAlias = pbsServiceFactory.getService(GENERIC_ALIAS_CONFIG) + private static final PrebidServerService defaultPbsServiceWithAlias = pbsServiceFactory.getService(GENERIC_ALIAS_CONFIG) private static final String EMPTY_ID = "" + def cleanupSpec() { + pbsServiceFactory.removeContainer(GENERIC_ALIAS_CONFIG) + } + def "PBS should update imp fields when imp.ext.prebid.imp contain bidder information"() { given: "Default basic BidRequest" def extPmp = Pmp.defaultPmp diff --git a/src/test/groovy/org/prebid/server/functional/tests/MetricsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/MetricsSpec.groovy index 92ef175681e..02d43469d67 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/MetricsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/MetricsSpec.groovy @@ -2,6 +2,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.config.AccountConfig import org.prebid.server.functional.model.config.AccountMetricsConfig +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Dooh @@ -17,13 +18,17 @@ import static org.prebid.server.functional.model.request.auction.DistributionCha class MetricsSpec extends BaseSpec { - private final PrebidServerService softPrebidService = pbsServiceFactory.getService(['auction.strict-app-site-dooh': 'false']) + private static final PrebidServerService softPrebidService = pbsServiceFactory.getService(['auction.strict-app-site-dooh': 'false']) def setup() { flushMetrics(defaultPbsService) flushMetrics(softPrebidService) } + def cleanupSpec() { + pbsServiceFactory.removeContainer(['auction.strict-app-site-dooh': 'false']) + } + def "PBS should not populate account metric when verbosity level is none"() { given: "Default basic BidRequest with generic bidder" def bidRequest = BidRequest.defaultBidRequest diff --git a/src/test/groovy/org/prebid/server/functional/tests/OrtbConverterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/OrtbConverterSpec.groovy index 21bb80df135..213aeacf64d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/OrtbConverterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/OrtbConverterSpec.groovy @@ -1,5 +1,6 @@ package org.prebid.server.functional.tests +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.db.StoredRequest import org.prebid.server.functional.model.request.auction.Audio import org.prebid.server.functional.model.request.auction.BidRequest @@ -36,11 +37,18 @@ import static org.prebid.server.functional.model.request.auction.DistributionCha class OrtbConverterSpec extends BaseSpec { private final static String ORTB_PROPERTY_VERSION = "adapters.generic.ortb-version" + private static final Map ORTB_2_6 = [(ORTB_PROPERTY_VERSION): "2.6"] + private static final Map ORTB_2_5 = [(ORTB_PROPERTY_VERSION): "2.5"] @Shared - PrebidServerService prebidServerServiceWithNewOrtb = pbsServiceFactory.getService([(ORTB_PROPERTY_VERSION): "2.6"]) + PrebidServerService prebidServerServiceWithNewOrtb = pbsServiceFactory.getService(ORTB_2_6) @Shared - PrebidServerService prebidServerServiceWithElderOrtb = pbsServiceFactory.getService([(ORTB_PROPERTY_VERSION): "2.5"]) + PrebidServerService prebidServerServiceWithElderOrtb = pbsServiceFactory.getService(ORTB_2_5) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(ORTB_2_5) + pbsServiceFactory.removeContainer(ORTB_2_6) + } def "PBS shouldn't move regs.{gdpr,usPrivacy} to regs.ext.{gdpr,usPrivacy} when adapter support ortb 2.6"() { given: "Default bid request with regs object" diff --git a/src/test/groovy/org/prebid/server/functional/tests/SchainSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/SchainSpec.groovy index db67f6ce397..1f0994c912d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/SchainSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/SchainSpec.groovy @@ -23,8 +23,18 @@ class SchainSpec extends BaseSpec { rid = PBSUtils.randomString } + private static final Map SCHAIN_NODE_CONFIG = ["auction.host-schain-node": encode(GLOBAL_SUPPLY_SCHAIN_NODE)] + private static final Map ORTB_2_5_CONFIG = ["adapters.generic.ortb-version": "2.5"] + + @Shared + PrebidServerService prebidServerService = pbsServiceFactory.getService(SCHAIN_NODE_CONFIG) @Shared - PrebidServerService prebidServerService = pbsServiceFactory.getService(["auction.host-schain-node": encode(GLOBAL_SUPPLY_SCHAIN_NODE)]) + PrebidServerService prebidServerServiceWithElderOrtb = pbsServiceFactory.getService(ORTB_2_5_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(SCHAIN_NODE_CONFIG) + pbsServiceFactory.removeContainer(ORTB_2_5_CONFIG) + } def "Global schain node should be appended when only ext.prebid.schains exists"() { given: "Basic bid request" @@ -158,10 +168,7 @@ class SchainSpec extends BaseSpec { } def "PBS should use source.ext.schain when ext.prebid.schains.bidder isn't requested"() { - given: "Pbs config" - def defaultPbsService = pbsServiceFactory.getService([("adapters.generic.ortb-version"): "2.5"]) - - and: "Default basic BidRequest with schain obj" + given: "Default basic BidRequest with schain obj" def supplyChain = SupplyChain.defaultSupplyChain def bidRequest = BidRequest.defaultBidRequest.tap { source = new Source(ext: new SourceExt(schain: supplyChain)) @@ -169,7 +176,7 @@ class SchainSpec extends BaseSpec { } when: "PBS processes auction request" - defaultPbsService.sendAuctionRequest(bidRequest) + prebidServerServiceWithElderOrtb.sendAuctionRequest(bidRequest) then: "Bidder request should contain requested source.ext.schain" def bidderRequest = bidder.getBidderRequest(bidRequest.id) @@ -178,10 +185,7 @@ class SchainSpec extends BaseSpec { } def "PBS should use ext.prebid.schains.schain instead of source.ext.chain when ext.prebid.schains.bidder is requested"() { - given: "Pbs config" - def defaultPbsService = pbsServiceFactory.getService([("adapters.generic.ortb-version"): "2.5"]) - - and: "Default basic BidRequest with schain obj" + given: "Default basic BidRequest with schain obj" def supplyChain = SupplyChain.defaultSupplyChain def bidRequest = BidRequest.defaultBidRequest.tap { source = new Source(ext: new SourceExt(schain: SupplyChain.defaultSupplyChain)) @@ -189,7 +193,7 @@ class SchainSpec extends BaseSpec { } when: "PBS processes auction request" - defaultPbsService.sendAuctionRequest(bidRequest) + prebidServerServiceWithElderOrtb.sendAuctionRequest(bidRequest) then: "Bidder request should contain requested ext.prebid.schains[*].schain" def bidderRequest = bidder.getBidderRequest(bidRequest.id) diff --git a/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy index f6b02f22e76..c738b5b6573 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/SeatNonBidSpec.groovy @@ -145,7 +145,8 @@ class SeatNonBidSpec extends BaseSpec { def "PBS should populate seatNonBid when returnAllBidStatus=true and requested bidder responded with not secure status code"() { given: "PBS with secure-markup enforcement" - def pbsService = pbsServiceFactory.getService(["auction.validations.secure-markup": ENFORCE.value]) + def pbsConfig = ["auction.validations.secure-markup": ENFORCE.value] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "A bid request with secure and returnAllBidStatus flags set" def bidRequest = requestWithAllBidStatus.tap { @@ -175,6 +176,9 @@ class SeatNonBidSpec extends BaseSpec { and: "PBS response shouldn't contain seatBid" assert !response.seatbid + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS shouldn't populate seatNonBid when returnAllBidStatus=true and bidder successfully bids"() { @@ -256,7 +260,8 @@ class SeatNonBidSpec extends BaseSpec { def "PBS should populate seatNonBid when bidder is rejected due to timeout"() { given: "PBS config with min and max time-out" def timeout = 50 - def pbsService = pbsServiceFactory.getService(["auction.biddertmax.min": timeout as String]) + def pbsConfig = ["auction.biddertmax.min": timeout as String] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default bid request with max timeout" def bidRequest = requestWithAllBidStatus.tap { @@ -280,13 +285,16 @@ class SeatNonBidSpec extends BaseSpec { assert seatNonBid.seat == GENERIC.value assert seatNonBid.nonBid[0].impId == bidRequest.imp[0].id assert seatNonBid.nonBid[0].statusCode == ERROR_TIMED_OUT + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should populate seatNonBid when filter-imp-media-type=true and imp doesn't contain supported media type"() { given: "Pbs config" - def pbsService = pbsServiceFactory.getService( - ["auction.filter-imp-media-type.enabled" : "true", - "adapters.generic.meta-info.site-media-types": "banner"]) + def pbsConfig = ["auction.filter-imp-media-type.enabled" : "true", + "adapters.generic.meta-info.site-media-types": "banner"] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest with banner" def bidRequest = BidRequest.defaultVideoRequest.tap { @@ -307,6 +315,9 @@ class SeatNonBidSpec extends BaseSpec { and: "seatbid should be empty" assert response.seatbid.isEmpty() + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS shouldn't populate seatNonBid when returnAllBidStatus=true and storedAuctionResponse present"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy index 467402dc331..1ec48d08096 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/StoredResponseSpec.groovy @@ -18,7 +18,11 @@ import static org.prebid.server.functional.model.bidder.BidderName.GENERIC class StoredResponseSpec extends BaseSpec { - private final PrebidServerService pbsService = pbsServiceFactory.getService(EMPTY_CACHE_TTL_CONFIG) + private static final PrebidServerService pbsService = pbsServiceFactory.getService(EMPTY_CACHE_TTL_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(EMPTY_CACHE_TTL_CONFIG) + } @PendingFeature def "PBS should not fail auction with storedAuctionResponse when request bidder params doesn't satisfy json-schema"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy index 9cf3e9a6da9..1b1d0cff359 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy @@ -409,6 +409,9 @@ class TargetingSpec extends BaseSpec { .every(list -> list .every(map -> map.keySet() .every(key -> key.length() <= targetingLength))) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should truncate targeting corresponding to value in account config when in account define truncate target attr"() { @@ -867,8 +870,8 @@ class TargetingSpec extends BaseSpec { def "PBS amp should use long account targeting prefix when settings.targeting.truncate-attr-chars override"() { given: "PBS config with setting.targeting" def prefixMaxChars = PBSUtils.getRandomNumber(35, MAX_TRUNCATE_ATTR_CHARS) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": prefixMaxChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": prefixMaxChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default AmpRequest" def ampRequest = AmpRequest.defaultAmpRequest @@ -893,13 +896,16 @@ class TargetingSpec extends BaseSpec { def targeting = ampResponse.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should use long request targeting prefix when settings.targeting.truncate-attr-chars override"() { given: "PBS config with setting.targeting" def prefixMaxChars = PBSUtils.getRandomNumber(35, MAX_TRUNCATE_ATTR_CHARS) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": prefixMaxChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": prefixMaxChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default AmpRequest" def ampRequest = AmpRequest.defaultAmpRequest @@ -921,13 +927,16 @@ class TargetingSpec extends BaseSpec { def targeting = ampResponse.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should use long request targeting prefix when settings.targeting.truncate-attr-chars override"() { given: "PBS config with setting.targeting" def prefixMaxChars = PBSUtils.getRandomNumber(35, MAX_TRUNCATE_ATTR_CHARS) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": prefixMaxChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": prefixMaxChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request with prefix" def prefix = PBSUtils.getRandomString(prefixMaxChars - TARGETING_PREFIX_LENGTH) @@ -942,13 +951,16 @@ class TargetingSpec extends BaseSpec { def targeting = bidResponse.seatbid?.first()?.bid?.first()?.ext?.prebid?.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should use long account targeting prefix when settings.targeting.truncate-attr-chars override"() { given: "PBS config with setting.targeting" def prefixMaxChars = PBSUtils.getRandomNumber(35, MAX_TRUNCATE_ATTR_CHARS) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": prefixMaxChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": prefixMaxChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request with empty targeting" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -968,13 +980,16 @@ class TargetingSpec extends BaseSpec { def targeting = bidResponse.seatbid?.first()?.bid?.first()?.ext?.prebid?.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should ignore and add a warning to ext.warnings when value of the account prefix is longer then settings.targeting.truncate-attr-chars"() { given: "PBS config with setting.targeting" def targetingChars = PBSUtils.getRandomNumber(2, 10) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": targetingChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": targetingChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default AmpRequest" def ampRequest = AmpRequest.defaultAmpRequest @@ -999,13 +1014,16 @@ class TargetingSpec extends BaseSpec { assert ampResponse.ext?.warnings[TARGETING]*.message == ["Key prefix value is dropped to default. " + "Decrease custom prefix length or increase truncateattrchars by " + "${prefix.length() + TARGETING_PREFIX_LENGTH - targetingChars}"] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should ignore and add a warning to ext.warnings when value of the request prefix is longer then settings.targeting.truncate-attr-chars"() { given: "PBS config with setting.targeting" def targetingChars = PBSUtils.getRandomNumber(2, 10) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": targetingChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": targetingChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default AmpRequest" def ampRequest = AmpRequest.defaultAmpRequest @@ -1027,13 +1045,16 @@ class TargetingSpec extends BaseSpec { assert ampResponse.ext?.warnings[TARGETING]*.message == ["Key prefix value is dropped to default. " + "Decrease custom prefix length or increase truncateattrchars by " + "${prefix.length() + TARGETING_PREFIX_LENGTH - targetingChars}"] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should ignore and add a warning to ext.warnings when value of the request prefix is longer then settings.targeting.truncate-attr-chars"() { given: "PBS config with setting.targeting" def targetingChars = PBSUtils.getRandomNumber(2, 10) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": targetingChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": targetingChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request with prefix" def prefixSize = targetingChars + 1 @@ -1052,13 +1073,16 @@ class TargetingSpec extends BaseSpec { assert bidResponse.ext?.warnings[TARGETING]*.message == ["Key prefix value is dropped to default. " + "Decrease custom prefix length or increase truncateattrchars by " + "${prefix.length() + TARGETING_PREFIX_LENGTH - targetingChars}"] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should ignore and add a warning to ext.warnings when value of the account prefix is longer then settings.targeting.truncate-attr-chars"() { given: "PBS config with setting.targeting" def targetingChars = PBSUtils.getRandomNumber(2, 10) - def prebidServerService = pbsServiceFactory.getService( - ["settings.targeting.truncate-attr-chars": targetingChars as String]) + def pbsConfig = ["settings.targeting.truncate-attr-chars": targetingChars as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Bid request" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -1081,6 +1105,9 @@ class TargetingSpec extends BaseSpec { assert bidResponse.ext?.warnings[TARGETING]*.message == ["Key prefix value is dropped to default. " + "Decrease custom prefix length or increase truncateattrchars by " + "${prefix.length() + TARGETING_PREFIX_LENGTH - targetingChars}"] + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should apply data from query to ext.prebid.amp.data"() { @@ -1246,8 +1273,8 @@ class TargetingSpec extends BaseSpec { def priceGranularity = PBSUtils.getRandomEnum(PriceGranularityType, [UNKNOWN]) def accountAuctionConfig = new AccountAuctionConfig(priceGranularity: priceGranularity) def accountConfig = new AccountConfig(status: ACTIVE, auction: accountAuctionConfig) - def pbsService = pbsServiceFactory.getService( - ["settings.default-account-config": encode(accountConfig)]) + def pbsConfig = ["settings.default-account-config": encode(accountConfig)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -1260,6 +1287,9 @@ class TargetingSpec extends BaseSpec { then: "BidderRequest should include price granularity from account config" def bidderRequest = bidder.getBidderRequest(bidRequest.id) assert bidderRequest?.ext?.prebid?.targeting?.priceGranularity == PriceGranularity.getDefault(priceGranularity) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should include include default price granularity when original request and account config doesn't contain price granularity"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/TimeoutSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/TimeoutSpec.groovy index cff45989db1..fe246682e8b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/TimeoutSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/TimeoutSpec.groovy @@ -24,6 +24,10 @@ class TimeoutSpec extends BaseSpec { @Shared PrebidServerService prebidServerService = pbsServiceFactory.getService(PBS_CONFIG) + def cleanupSpec() { + pbsServiceFactory.removeContainer(PBS_CONFIG) + } + def "PBS should apply timeout from stored request when it's not specified in the auction request"() { given: "Default basic BidRequest with generic bidder" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -287,9 +291,9 @@ class TimeoutSpec extends BaseSpec { def "PBS should choose min timeout form config for bidder request when in request value lowest that in auction.biddertmax.min"() { given: "PBS config with percent" def minBidderTmax = PBSUtils.getRandomNumber(MIN_TIMEOUT, MAX_TIMEOUT) - def prebidServerService = pbsServiceFactory.getService( - ["auction.biddertmax.min": minBidderTmax as String, - "auction.biddertmax.max": MAX_TIMEOUT as String]) + def pbsConfig = ["auction.biddertmax.min": minBidderTmax as String, + "auction.biddertmax.max": MAX_TIMEOUT as String] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest" def timeout = PBSUtils.getRandomNumber(0, minBidderTmax) @@ -306,6 +310,9 @@ class TimeoutSpec extends BaseSpec { and: "PBS response should contain tmax from request" assert bidResponse?.ext?.tmaxrequest == timeout as Long + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should change timeout for bidder due to percent in auction.biddertmax.percent"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/TopicsHeaderSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/TopicsHeaderSpec.groovy index ea2bbebb67e..279d408ef83 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/TopicsHeaderSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/TopicsHeaderSpec.groovy @@ -15,8 +15,13 @@ class TopicsHeaderSpec extends BaseSpec { private static final DEFAULT_SEGTAX_VALUE = 599 private static final PRIVACY_SENDBOX_DOMAIN = "privacy-sandbox-domain" - private final PrebidServerService prebidServerServiceWithTopicsDomain - = pbsServiceFactory.getService(["auction.privacysandbox.topicsdomain": PRIVACY_SENDBOX_DOMAIN]) + private static final Map TOPICS_DOMAIN_CONFIG = ["auction.privacysandbox.topicsdomain": PRIVACY_SENDBOX_DOMAIN] + + private static final PrebidServerService prebidServerServiceWithTopicsDomain = pbsServiceFactory.getService(TOPICS_DOMAIN_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(TOPICS_DOMAIN_CONFIG) + } def "PBS should populate user.data when Sec-Browsing-Topics header present in request"() { given: "Default basic BidRequest with generic bidder" diff --git a/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy index eb988ac130b..107fadb70b5 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy @@ -7,6 +7,7 @@ import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.Imp import org.prebid.server.functional.model.request.auction.PrebidStoredRequest import org.prebid.server.functional.model.request.auction.Source +import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.util.PBSUtils import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP @@ -14,20 +15,34 @@ import static org.prebid.server.functional.model.request.auction.DistributionCha class UUIDSpec extends BaseSpec { - def "PBS auction should generate UUID for APP BidRequest id and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) + private static final Map STORED_REQUEST_ID_GEN_ENABLED_CONFIG = [ + "settings.generate-storedrequest-bidrequest-id": "true" + ] - and: "Flush metrics" - flushMetrics(pbsService) + private static final Map STORED_REQUEST_ID_GEN_DISABLED_CONFIG = [ + "settings.generate-storedrequest-bidrequest-id": "false" + ] + + private static final PrebidServerService storedRequestIdGenEnabledService = pbsServiceFactory.getService(STORED_REQUEST_ID_GEN_ENABLED_CONFIG) + + private static final PrebidServerService storedRequestIdGenDisabledService = pbsServiceFactory.getService(STORED_REQUEST_ID_GEN_DISABLED_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(STORED_REQUEST_ID_GEN_ENABLED_CONFIG) + pbsServiceFactory.removeContainer(STORED_REQUEST_ID_GEN_DISABLED_CONFIG) + } - and: "Default bid request with stored request and id" + def "PBS auction should generate UUID for APP BidRequest id and merge StoredRequest when bidRequestId = #bidRequestId"() { + given: "Default bid request with stored request and id" def storedRequestId = PBSUtils.randomString def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { id = bidRequestId ext.prebid.storedRequest = new PrebidStoredRequest(id: storedRequestId) } + and: "Flush metrics" + flushMetrics(pbsService) + and: "Save storedRequest into DB with cur and id" def currencies = [Currency.BOGUS] def storedBidRequest = new BidRequest(id: PBSUtils.randomString, cur: currencies) @@ -49,10 +64,10 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.id != bidRequestId where: - bidRequestId | generateBidRequestId - null | "false" - PBSUtils.randomString | "true" - "{{UUID}}" | "false" + bidRequestId | pbsService + null | storedRequestIdGenDisabledService + PBSUtils.randomString | storedRequestIdGenEnabledService + "{{UUID}}" | storedRequestIdGenDisabledService } def "PBS auction shouldn't generate UUID for BidRequest id when BidRequest doesn't have APP"() { @@ -81,11 +96,8 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.id == bidRequestId } - def "PBS amp should generate UUID for BidRequest id and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) - - and: "Default AMP request with custom Id" + def "PBS amp should generate UUID for BidRequest id and merge StoredRequest when bidRequestId = #bidRequestId"() { + given: "Default AMP request with custom Id" def ampRequest = AmpRequest.defaultAmpRequest.tap { tagId = bidRequestId } @@ -106,25 +118,22 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.id != bidRequestId where: - bidRequestId | generateBidRequestId - PBSUtils.randomString | "true" - "{{UUID}}" | "false" + bidRequestId | pbsService + PBSUtils.randomString | storedRequestIdGenEnabledService + "{{UUID}}" | storedRequestIdGenDisabledService } - def "PBS auction should generate UUID for source.tid and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) - - and: "Flush metrics" - flushMetrics(pbsService) - - and: "Default bid request with stored request and id" + def "PBS auction should generate UUID for source.tid and merge StoredRequest when sourceTid= #sourceTid"() { + given: "Default bid request with stored request and id" def storedRequestId = PBSUtils.randomString def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { source = new Source(tid: sourceTid) ext.prebid.storedRequest = new PrebidStoredRequest(id: storedRequestId) } + and: "Flush metrics" + flushMetrics(pbsService) + and: "Save storedRequest into DB with cur and source.tid" def currencies = [Currency.BOGUS] def storedBidRequest = new BidRequest(cur: currencies, source: new Source(tid: PBSUtils.randomString)) @@ -146,17 +155,14 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.source.tid != sourceTid where: - sourceTid | generateBidRequestId - null | "false" - "{{UUID}}" | "false" - PBSUtils.randomString | "true" + sourceTid | pbsService + null | storedRequestIdGenDisabledService + "{{UUID}}" | storedRequestIdGenDisabledService + PBSUtils.randomString | storedRequestIdGenEnabledService } - def "PBS amp should generate UUID for source.tid id and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) - - and: "Default AMP request with custom Id" + def "PBS amp should generate UUID for source.tid id and merge StoredRequest when sourceTid = #sourceTid"() { + given: "Default AMP request with custom Id" def ampRequest = AmpRequest.defaultAmpRequest and: "Default StoredBidRequest" @@ -177,26 +183,23 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.source.tid != sourceTid where: - sourceTid | generateBidRequestId - null | "false" - PBSUtils.randomString | "true" - "{{UUID}}" | "false" + sourceTid | pbsService + null | storedRequestIdGenDisabledService + PBSUtils.randomString | storedRequestIdGenEnabledService + "{{UUID}}" | storedRequestIdGenDisabledService } - def "PBS auction should generate UUID for imp[].ext.tid and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) - - and: "Flush metrics" - flushMetrics(pbsService) - - and: "Default bid request with stored request and id" + def "PBS auction should generate UUID for imp[].ext.tid and merge StoredRequest when impExtTid = #impExtTid"() { + given: "Default bid request with stored request and id" def storedRequestId = PBSUtils.randomString def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { imp[0].ext.tid = impExtTid ext.prebid.storedRequest = new PrebidStoredRequest(id: storedRequestId) } + and: "Flush metrics" + flushMetrics(pbsService) + and: "Save storedRequest into DB with cur and source.tid" def currencies = [Currency.BOGUS] def storedBidRequest = new BidRequest(cur: currencies) @@ -218,17 +221,14 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.imp[0].ext.tid != impExtTid where: - impExtTid | generateBidRequestId - null | "false" - PBSUtils.randomString | "true" - "{{UUID}}" | "false" + impExtTid | pbsService + null | storedRequestIdGenDisabledService + PBSUtils.randomString | storedRequestIdGenEnabledService + "{{UUID}}" | storedRequestIdGenDisabledService } - def "PBS amp should generate UUID for imp[].ext.tid id and merge StoredRequest when generate-storedrequest-bidrequest-id = #generateBidRequestId"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": (generateBidRequestId)]) - - and: "Default AMP request with custom Id" + def "PBS amp should generate UUID for imp[].ext.tid id and merge StoredRequest when impExtTid = #impExtTid"() { + given: "Default AMP request with custom Id" def ampRequest = AmpRequest.defaultAmpRequest and: "Default StoredBidRequest" @@ -249,17 +249,14 @@ class UUIDSpec extends BaseSpec { assert bidderRequest.imp[0].ext.tid != impExtTid where: - impExtTid | generateBidRequestId - null | "false" - PBSUtils.randomString | "true" - "{{UUID}}" | "false" + impExtTid | pbsService + null | storedRequestIdGenDisabledService + PBSUtils.randomString | storedRequestIdGenEnabledService + "{{UUID}}" | storedRequestIdGenDisabledService } def "PBS should generate UUID for empty imp[].id when generate-storedrequest-bidrequest-id = true"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": "true"]) - - and: "Default bid request with stored request and id" + given: "Default bid request with stored request and id" def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { imp[1] = Imp.defaultImpression.tap { it.id = null @@ -267,7 +264,7 @@ class UUIDSpec extends BaseSpec { } when: "Requesting PBS auction" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = storedRequestIdGenEnabledService.sendAuctionRequest(bidRequest) then: "BidResponse should generate UUID for imp[].id" def bidderRequest = bidder.getBidderRequest(bidResponse.id) @@ -275,13 +272,7 @@ class UUIDSpec extends BaseSpec { } def "PBS auction should re-assign UUID for all imp[].id and merge StoredRequest when imp[].id not different and generate-storedrequest-bidrequest-id = true"() { - given: "PBS config with settings.generate-storedrequest-bidrequest-id" - def pbsService = pbsServiceFactory.getService(["settings.generate-storedrequest-bidrequest-id": "true"]) - - and: "Flush metrics" - flushMetrics(pbsService) - - and: "Default bid request with stored request and id" + given: "Default bid request with stored request and id" def storedRequestId = PBSUtils.randomString def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { def imp = Imp.defaultImpression.tap { @@ -292,6 +283,9 @@ class UUIDSpec extends BaseSpec { ext.prebid.storedRequest = new PrebidStoredRequest(id: storedRequestId) } + and: "Flush metrics" + flushMetrics(storedRequestIdGenEnabledService) + and: "Save storedRequest into DB with cur and source.tid" def currencies = [Currency.BOGUS] def storedBidRequest = new BidRequest(cur: currencies) @@ -299,10 +293,10 @@ class UUIDSpec extends BaseSpec { storedRequestDao.save(storedRequest) when: "Requesting PBS auction" - def bidResponse = pbsService.sendAuctionRequest(bidRequest) + def bidResponse = storedRequestIdGenEnabledService.sendAuctionRequest(bidRequest) then: "Metric stored_requests_found should be updated" - def metrics = pbsService.sendCollectedMetricsRequest() + def metrics = storedRequestIdGenEnabledService.sendCollectedMetricsRequest() assert metrics["stored_requests_found"] == 1 and: "BidResponse should be merged with stored request" diff --git a/src/test/groovy/org/prebid/server/functional/tests/UserSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/UserSyncSpec.groovy index b4111e551fb..ee17f1f8ebb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/UserSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/UserSyncSpec.groovy @@ -1,6 +1,7 @@ package org.prebid.server.functional.tests import org.prebid.server.functional.model.request.cookiesync.CookieSyncRequest +import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.util.HttpUtil import static org.prebid.server.functional.model.bidder.BidderName.GENERIC @@ -12,14 +13,32 @@ import static org.prebid.server.functional.testcontainers.Dependencies.networkSe class UserSyncSpec extends BaseSpec { - private static final Map GENERIC_USERSYNC_CONFIG = ["adapters.${GENERIC.value}.usersync.${IFRAME.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.${GENERIC.value}.usersync.${IFRAME.value}.support-cors": "false"] + private static final Map BASE_USERSYNC_CONFIG = [ + "adapters.${GENERIC.value}.usersync.${IFRAME.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.${GENERIC.value}.usersync.${IFRAME.value}.support-cors": "false" + ] + + private static final Map USERSYNC_DISABLED_CONFIG = BASE_USERSYNC_CONFIG + [ + "adapters.${GENERIC.value}.usersync.enabled": "false" + ] + + private static final Map USERSYNC_ENABLED_CONFIG = BASE_USERSYNC_CONFIG + [ + "adapters.${GENERIC.value}.usersync.enabled": "true" + ] + + private static final PrebidServerService userSyncDisabledService = pbsServiceFactory.getService(USERSYNC_DISABLED_CONFIG) + private static final PrebidServerService userSyncEnabledService = pbsServiceFactory.getService(USERSYNC_ENABLED_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(USERSYNC_DISABLED_CONFIG) + pbsServiceFactory.removeContainer(USERSYNC_ENABLED_CONFIG) + } def "PBS should return usersync url with '#formatParam' format parameter for #userSyncFormat when format-override absent"() { given: "Pbs config with usersync.#userSyncFormat" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"]) + def pbsConfig = ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default CookieSyncRequest" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -32,18 +51,21 @@ class UserSyncSpec extends BaseSpec { assert bidderStatus?.userSync?.type == userSyncFormat assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "f") == formatParam + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: - userSyncFormat || formatParam - REDIRECT || PIXEL.name - IFRAME || BLANK.name + userSyncFormat | formatParam + REDIRECT | PIXEL.name + IFRAME | BLANK.name } def "PBS should return overridden usersync url format for #userSyncFormat usersync when format-override is #formatOverride"() { given: "Pbs config with usersync.#userSyncFormat and iframe.format-override: #formatOverride" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.generic.usersync.${userSyncFormat.value}.support-cors" : "false", - "adapters.generic.usersync.${userSyncFormat.value}.format-override": formatOverride.value]) + def pbsConfig = ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.generic.usersync.${userSyncFormat.value}.support-cors" : "false", + "adapters.generic.usersync.${userSyncFormat.value}.format-override": formatOverride.value] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default CookieSyncRequest" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -56,20 +78,23 @@ class UserSyncSpec extends BaseSpec { assert bidderStatus?.userSync?.type == userSyncFormat assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "f") == formatOverride.name + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: - userSyncFormat || formatOverride - REDIRECT || BLANK - REDIRECT || PIXEL - IFRAME || BLANK - IFRAME || PIXEL + userSyncFormat | formatOverride + REDIRECT | BLANK + REDIRECT | PIXEL + IFRAME | BLANK + IFRAME | PIXEL } def "PBS should return empty uid in usersync url when uid macro is not present in config"() { given: "Pbs config with usersync.#userSyncFormat.url" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false", - "adapters.generic.usersync.${userSyncFormat.value}.uid-macro" : null]) + def pbsConfig = ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false", + "adapters.generic.usersync.${userSyncFormat.value}.uid-macro" : null] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default CookieSyncRequest" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -81,13 +106,16 @@ class UserSyncSpec extends BaseSpec { def bidderStatus = response.getBidderUserSync(GENERIC) assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "uid").isEmpty() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: userSyncFormat << [REDIRECT, IFRAME] } def "PBS cookie sync should sync bidder by default when bidder.usersync.enabled not overridden"() { given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(GENERIC_USERSYNC_CONFIG) + def prebidServerService = pbsServiceFactory.getService(BASE_USERSYNC_CONFIG) and: "Default Cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest @@ -98,18 +126,17 @@ class UserSyncSpec extends BaseSpec { then: "Response should contain synced bidder" assert response.getBidderUserSync(GENERIC) assert response.bidderStatus.size() == 1 + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(BASE_USERSYNC_CONFIG) } def "PBS cookie sync should sync bidder when bidder.usersync.enabled=true"() { - given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(GENERIC_USERSYNC_CONFIG - + ["adapters.${GENERIC.value}.usersync.enabled": "true"]) - - and: "Default Cookie sync request" + given: "Default Cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest when: "PBS processes cookie sync request without cookies" - def response = prebidServerService.sendCookieSyncRequest(cookieSyncRequest) + def response = userSyncEnabledService.sendCookieSyncRequest(cookieSyncRequest) then: "Response should contain synced bidder" assert response.getBidderUserSync(GENERIC) @@ -117,15 +144,11 @@ class UserSyncSpec extends BaseSpec { } def "PBS cookie sync shouldn't sync bidder and emit error when bidder.usersync.enabled=false"() { - given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(GENERIC_USERSYNC_CONFIG - + ["adapters.${GENERIC.value}.usersync.enabled": "false"]) - - and: "Default Cookie sync request" + given: "Default Cookie sync request" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest when: "PBS processes cookie sync request without cookies" - def response = prebidServerService.sendCookieSyncRequest(cookieSyncRequest) + def response = userSyncDisabledService.sendCookieSyncRequest(cookieSyncRequest) then: "Response should contain bidder with error" def bidderStatus = response.getBidderUserSync(GENERIC) @@ -135,18 +158,14 @@ class UserSyncSpec extends BaseSpec { } def "PBS cookie sync shouldn't coop-sync bidder when coop-sync=true and bidder.usersync.enabled=false "() { - given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(GENERIC_USERSYNC_CONFIG - + ["adapters.${GENERIC.value}.usersync.enabled": "false"]) - - and: "Cookie sync request without bidders and coop-sync=true" + given: "Cookie sync request without bidders and coop-sync=true" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { bidders = null coopSync = true } when: "PBS processes cookie sync request without cookies" - def response = prebidServerService.sendCookieSyncRequest(cookieSyncRequest) + def response = userSyncDisabledService.sendCookieSyncRequest(cookieSyncRequest) then: "Response should contain bidder with error" def bidderStatus = response.getBidderUserSync(GENERIC) @@ -156,18 +175,14 @@ class UserSyncSpec extends BaseSpec { } def "PBS cookie sync should coop-sync bidder when coop-sync=true and bidder.usersync.enabled=true "() { - given: "PBS bidder config" - def prebidServerService = pbsServiceFactory.getService(GENERIC_USERSYNC_CONFIG - + ["adapters.${GENERIC.value}.usersync.enabled": "true"]) - - and: "Cookie sync request without bidders and coop-sync=true" + given: "Cookie sync request without bidders and coop-sync=true" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { bidders = null coopSync = true } when: "PBS processes cookie sync request without cookies" - def response = prebidServerService.sendCookieSyncRequest(cookieSyncRequest) + def response = userSyncEnabledService.sendCookieSyncRequest(cookieSyncRequest) then: "Response should contain bidder" assert response.getBidderUserSync(GENERIC) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 8325eaacdee..a62bf021514 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -49,7 +49,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { ['hooks.host-execution-plan': null] private static final PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) - private static final PrebidServerService pbsServiceWithMultipleModules = pbsServiceFactory.getService(MULTI_MODULE_CONFIG) def cleanupSpec() { pbsServiceFactory.removeContainer(getModuleBaseSettings(ModuleName.ORTB2_BLOCKING)) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy index 54386c65cbe..ece53e033c9 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy @@ -112,6 +112,9 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { it.appliedTo.bidders == [GENERIC.value] it.appliedTo.impIds == bidRequest.imp.id } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(getRichMediaFilterSettings(PATTERN_NAME)) } def "PBS should include analytics tag in response when request and default account allow client details"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsBaseSpec.groovy index 8b3f5d936bd..da563ab7251 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsBaseSpec.groovy @@ -5,6 +5,7 @@ import org.prebid.server.functional.model.bidder.BidderName import org.prebid.server.functional.model.config.AccountAuctionConfig import org.prebid.server.functional.model.config.AccountConfig import org.prebid.server.functional.model.config.AccountPriceFloorsConfig +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.PriceFloorsFetch import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.pricefloors.Country @@ -51,6 +52,10 @@ abstract class PriceFloorsBaseSpec extends BaseSpec { floorsProvider.setResponse() } + def cleanupSpec() { + pbsServiceFactory.removeContainer(FLOORS_CONFIG + GENERIC_ALIAS_CONFIG) + } + protected static AccountConfig getDefaultAccountConfigSettings() { def fetch = new PriceFloorsFetch(enabled: false, timeoutMs: 5000, diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy index 69d8dce297d..4dad6b2f4bb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy @@ -2,6 +2,7 @@ package org.prebid.server.functional.tests.pricefloors import org.prebid.server.functional.model.Currency import org.prebid.server.functional.model.config.AccountPriceFloorsConfig +import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.PriceFloorsFetch import org.prebid.server.functional.model.mock.services.currencyconversion.CurrencyConversionRatesResponse import org.prebid.server.functional.model.pricefloors.PriceFloorData @@ -43,6 +44,10 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec { private final PrebidServerService currencyFloorsPbsService = pbsServiceFactory.getService(FLOORS_CONFIG + CURRENCY_CONVERTER_CONFIG) + def cleanupSpec() { + pbsServiceFactory.removeContainer(FLOORS_CONFIG + CURRENCY_CONVERTER_CONFIG) + } + def "PBS should update bidFloor, bidFloorCur for signalling when request.cur is specified"() { given: "Default BidRequest with cur" def bidRequest = bidRequestWithFloors.tap { @@ -166,8 +171,8 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec { def "PBS should not update bidFloor, bidFloorCur for signalling when currency conversion is not available"() { given: "Pbs config with disabled conversion" - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["currency-converter.external-rates.enabled": "false"]) + def pbsConfig = FLOORS_CONFIG + ["currency-converter.external-rates.enabled": "false"] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "BidRequest with floorMinCur" def requestFloorCur = USD @@ -226,6 +231,9 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec { ext?.prebid?.floors?.location == FETCH ext?.prebid?.floors?.fetchStatus == SUCCESS } + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should forward bidFloor and bidFloorCur for signalling when they come in the bid request"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy index 4d47947670a..7729159a3af 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy @@ -787,8 +787,8 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { enforceDealFloorsSnakeCase = defaultAccountEnforeDealFloorsSnakeCase } } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest with generic bidder with preferdeals = true" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -833,6 +833,9 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { assert response.seatbid?.first()?.bid?.collect { it.id } == [bidResponse.seatbid.first().bid.last().id] assert response.seatbid.first().bid.collect { it.price } == [floorValue] + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: defaultAccountEnforeDealFloors | defaultAccountEnforeDealFloorsSnakeCase | accountEnforeDealFloors | accountEnforeDealFloorsSnakeCase false | null | true | null @@ -846,8 +849,8 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { auction.priceFloors.enforceDealFloors = pbsConfigEnforceDealFloors } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest with generic bidder with preferdeals = true" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -890,6 +893,9 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { assert response.seatbid?.first()?.bid?.first()?.id == bidResponse.seatbid.first().bid.first().id assert response.seatbid.first().bid.collect { it.price } == [dealBidPrice] + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigEnforceDealFloors | enforcePbs | accountEnforceDealFloors | floorDeals true | null | false | true @@ -902,8 +908,8 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { auction.priceFloors.enforceFloorsRate = pbsConfigEnforceRate } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -945,6 +951,9 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { assert response.seatbid?.first()?.bid?.first()?.id == bidResponse.seatbid.first().bid.last().id assert response.seatbid.first().bid.collect { it.price } == [floorValue] + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigEnforceRate | requestEnforceRate | accountEnforceRate PBSUtils.getRandomNumber(0, 100) | null | 100 @@ -957,8 +966,8 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { auction.priceFloors.enforceFloorsRate = pbsConfigEnforceFloorsRate } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { @@ -999,6 +1008,9 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { assert response.seatbid?.first()?.bid?.size() == 2 assert response.seatbid.first().bid.collect { it.price } == [floorValue, floorValue - 0.1] + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigEnforceFloorsRate | enforceRate | accountEnforceFloorsRate PBSUtils.getRandomNumber(0, 100) | null | 0 diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy index a897fbeff7c..0e45fb277e0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy @@ -48,7 +48,8 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { def "PBS should activate floors feature when price-floors.enabled = true in PBS config"() { given: "Pbs with PF configuration" - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + ["price-floors.enabled": "true"]) + def pbsConfig = FLOORS_CONFIG + ["price-floors.enabled": "true"] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" def bidRequest = BidRequest.getDefaultBidRequest(APP) @@ -69,11 +70,15 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { and: "PBS should signal bids" def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() assert bidderRequest.imp[0].bidFloor + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should not activate floors feature when price-floors.enabled = false in #description config"() { given: "Pbs with PF configuration" - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + ["price-floors.enabled": pbdConfigEnabled]) + def pbsConfig = FLOORS_CONFIG + ["price-floors.enabled": pbdConfigEnabled] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" def bidRequest = BidRequest.getDefaultBidRequest(APP) @@ -95,6 +100,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() assert !bidderRequest.imp[0].bidFloor + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: description | pbdConfigEnabled | accountConfigEnabled "PBS" | "false" | true @@ -341,8 +349,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { useDynamicDataSnakeCase = pbsConfigUseDynamicDataSnakeCase } } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with ext.prebid.floors" def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { @@ -373,6 +382,9 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() assert bidderRequest.imp[0].bidFloor == floorValue + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigUseDynamicData | accountUseDynamicData | pbsConfigUseDynamicDataSnakeCase | accountUseDynamicDataSnakeCase false | true | null | null diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy index e493bbb7df9..82372855c1b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy @@ -914,10 +914,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { } def "PBS should populate seatNonBid when bid rejected due to floor"() { - given: "PBS config with floors config" - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG) - - and: "Default BidRequest" + given: "Default BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(enforcePbs: enforcePbs)) ext.prebid.returnAllBidStatus = true @@ -935,7 +932,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { floorsProvider.setResponse(bidRequest.site.publisher.id, floorsResponse) and: "PBS cache rules" - cacheFloorsProviderRules(bidRequest, floorValue, pbsService) + cacheFloorsProviderRules(bidRequest, floorValue, floorsPbsService) and: "Set bidder response" def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { @@ -944,7 +941,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = floorsPbsService.sendAuctionRequest(bidRequest) then: "PBS response should contain seatNonBid and contain errors" def seatNonBids = response.ext.seatnonbid @@ -961,10 +958,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { } def "PBS shouldn't populate seatNonBid when rejected due to floor and returnAllBidStatus is false"() { - given: "PBS config with floors config" - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG) - - and: "Default BidRequest" + given: "Default BidRequest" def bidRequest = BidRequest.defaultBidRequest.tap { ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(enforcePbs: enforcePbs)) ext.prebid.returnAllBidStatus = false @@ -982,7 +976,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { floorsProvider.setResponse(bidRequest.site.publisher.id, floorsResponse) and: "PBS cache rules" - cacheFloorsProviderRules(bidRequest, floorValue, pbsService) + cacheFloorsProviderRules(bidRequest, floorValue, floorsPbsService) and: "Set bidder response" def bidResponse = BidResponse.getDefaultBidResponse(bidRequest).tap { @@ -991,7 +985,7 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { bidder.setResponse(bidRequest.id, bidResponse) when: "PBS processes auction request" - def response = pbsService.sendAuctionRequest(bidRequest) + def response = floorsPbsService.sendAuctionRequest(bidRequest) then: "PBS response shouldn't contain seatNonBid and contain errors" assert !response.ext.seatnonbid diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy index 72be2f0a0f3..2c93f251196 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy @@ -332,8 +332,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { auction.priceFloors.adjustForBidAdjustment = pbsConfigBidAdjustmentFlag } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "BidRequest with bidAdjustment" def floorsProviderFloorValue = PBSUtils.randomFloorValue @@ -365,6 +366,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { and: "Bidder request shouldn't include imp.ext.prebid.floors" assert !bidderRequest.imp[0].ext.prebid.floors + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag true | true | null @@ -380,8 +384,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { adjustForBidAdjustmentSnakeCase = pbsConfigBidAdjustmentFlagSnakeCase } } - def pbsService = pbsServiceFactory.getService(FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)]) + def pbsConfig = FLOORS_CONFIG + + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" def floorsProviderFloorValue = 0.8 @@ -415,6 +420,9 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { and: "Bidder request shouldn't include imp.ext.prebid.floors" assert !bidderRequest.imp[0].ext.prebid.floors + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: pbsConfigBidAdjustmentFlagSnakeCase | pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag | accountBidAdjustmentFlagSnakeCase null | false | false | null | false diff --git a/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy index b7cdcc3c4f1..e699eca908b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/prometheus/PrometheusSpec.groovy @@ -19,8 +19,8 @@ class PrometheusSpec extends BaseSpec { def "PBS should add custom labels to Prometheus metrics when custom labels are enabled in config"() { given: "PBS config with set up Prometheus and enabled Promethues custom labels" - def prometheusPbsService = pbsServiceFactory.getService(basePrometheusConfig + - ["metrics.prometheus.custom-labels-enabled": "true"]) + def pbsConfig = basePrometheusConfig + ["metrics.prometheus.custom-labels-enabled": "true"] + def prometheusPbsService = pbsServiceFactory.getService(pbsConfig) and: "Labels config metric matcher and an appropriate PBS metric to it are specified" def pbsMetricMatcher = "requests.*.*" @@ -44,15 +44,19 @@ class PrometheusSpec extends BaseSpec { def expectedLabelsString = "$normalizedMapperName$metricLabels" assert prometheusMetrics.contains(expectedLabelsString) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should add namespace, subsystem and custom labels info to Prometheus metrics when those are set in config"() { given: "PBS config with set up Prometheus with enabled custom labels" def namespace = "namespace_01" def subsystem = "subsystem_01" - def prometheusPbsService = pbsServiceFactory.getService(basePrometheusConfig + + def pbsConfig = basePrometheusConfig + getNamespaceSubsystemConfig(namespace, subsystem) + - ["metrics.prometheus.custom-labels-enabled": "true"]) + ["metrics.prometheus.custom-labels-enabled": "true"] + def prometheusPbsService = pbsServiceFactory.getService(pbsConfig) and: "Labels config metric matcher and an appropriate PBS metric to it are specified" def pbsMetricMatcher = "requests.*.*" @@ -77,6 +81,9 @@ class PrometheusSpec extends BaseSpec { def expectedLabelsString = "$namespaceSubsystemMapperName$metricLabels" assert prometheusMetrics.contains(expectedLabelsString) + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } def "PBS should add namespace and subsystem parts to Prometheus metric names when those are config provided"() { @@ -101,6 +108,10 @@ class PrometheusSpec extends BaseSpec { then: "Prometheus metrics response contains each of PBS metric with added namespace and subsystem" prometheusFormatPbsMetricNames.each { assert prometheusMetrics.contains(it) } + + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(config) } def "PBS service fails to start when invalid symbols by namespace and subsystem in Prometheus config are present"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/AccountS3Spec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/AccountS3Spec.groovy index 3a87be7b9e7..3ca62d3d849 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/AccountS3Spec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/AccountS3Spec.groovy @@ -2,6 +2,8 @@ package org.prebid.server.functional.tests.storage import org.prebid.server.functional.model.AccountStatus import org.prebid.server.functional.model.config.AccountConfig +import org.prebid.server.functional.model.config.ModuleName +import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.service.PrebidServerException import org.prebid.server.functional.service.PrebidServerService @@ -13,9 +15,15 @@ import static io.netty.handler.codec.http.HttpResponseStatus.UNAUTHORIZED class AccountS3Spec extends StorageBaseSpec { - protected PrebidServerService s3StorageAccountPbsService = PbsServiceFactory.getService(s3StorageConfig + - mySqlDisabledConfig + - ['settings.enforce-valid-account': 'true']) + private final static Map> S3_CONFIG = s3StorageConfig + + mySqlDisabledConfig + + ['settings.enforce-valid-account': 'true'] + + private static final PrebidServerService s3StorageAccountPbsService = PbsServiceFactory.getService(S3_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(S3_CONFIG) + } def "PBS should process request when active account is present in S3 storage"() { given: "Default BidRequest with account" diff --git a/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy index 2b1e37736fb..ba10f4e72e1 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/storage/StorageBaseSpec.groovy @@ -51,5 +51,5 @@ class StorageBaseSpec extends BaseSpec { 'settings.database.stored-responses-query' : null ].asImmutable() as Map - protected PrebidServerService s3StoragePbsService = PbsServiceFactory.getService(s3StorageConfig + mySqlDisabledConfig) + protected static final PrebidServerService s3StoragePbsService = PbsServiceFactory.getService(s3StorageConfig + mySqlDisabledConfig) } From 92b055c363729739f66ba56c6cf9ec6f86a39bb0 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Wed, 12 Feb 2025 18:22:50 +0200 Subject: [PATCH 05/24] Fix invalid tests --- .../functional/tests/CookieSyncSpec.groovy | 43 +++---- .../PriceFloorsCurrencySpec.groovy | 1 - .../PriceFloorsEnforcementSpec.groovy | 16 +-- .../PriceFloorsFetchingSpec.groovy | 4 +- .../PriceFloorsSignalingSpec.groovy | 116 ++++++++++-------- 5 files changed, 100 insertions(+), 80 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy index 3429ffc0342..b7fce18dda6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CookieSyncSpec.groovy @@ -106,9 +106,9 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync request should replace synced as family bidder and fill up response with enabled bidders to the limit in request"() { given: "PBS config with alias bidder without cookie family name" def bidderAlias = ALIAS - def pbsConfig = GENERIC_CONFIG + APPNEXUS_CONFIG - +["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", - "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null] + def pbsConfig = GENERIC_CONFIG + APPNEXUS_CONFIG + + ["adapters.${GENERIC.value}.aliases.${bidderAlias.value}.enabled" : "true", + "adapters.${GENERIC.value}.aliases.${bidderAlias.value}.usersync.cookie-family-name": null] def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request" @@ -377,9 +377,10 @@ class CookieSyncSpec extends BaseSpec { def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with account and privacy" + def accountId = PBSUtils.randomString def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { bidders = [] - account = PBSUtils.randomString + account = accountId usPrivacy = new CcpaConsent(optOutSale: ENFORCED) coopSync = true } @@ -387,7 +388,7 @@ class CookieSyncSpec extends BaseSpec { and: "Save account config into DB" def ccpaConfig = new AccountCcpaConfig(enabled: true) def accountConfig = new AccountConfig(privacy: new AccountPrivacyConfig(ccpa: ccpaConfig)) - def account = new Account(uuid: cookieSyncRequest.account, config: accountConfig) + def account = new Account(uuid: accountId, config: accountConfig) accountDao.save(account) when: "PBS processes cookie sync request" @@ -934,15 +935,15 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with cookie-sync.default-limit config should use limit from cookie sync account config"() { given: "PBS bidders config" - def pbsConfig = ["cookie-sync.default-limit": "2"] + PBS_CONFIG + def pbsConfig = ['cookie-sync.default-limit': '2'] + PBS_CONFIG def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request with 3 bidders" def accountId = PBSUtils.randomNumber def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { - bidders = [RUBICON, APPNEXUS, GENERIC] - account = accountId - debug = false + it.bidders = [RUBICON, APPNEXUS, GENERIC] + it.account = accountId + it.debug = false } and: "Save account with cookie config" @@ -956,7 +957,7 @@ class CookieSyncSpec extends BaseSpec { def response = prebidServerService.sendCookieSyncRequest(cookieSyncRequest) then: "Response should contain one synced bidder" - assert response.bidderStatus.size() == accountDefaultLimit + assert response.bidderStatus.size() == 1 cleanup: "Stop and remove pbs container" pbsServiceFactory.removeContainer(pbsConfig) @@ -1112,9 +1113,9 @@ class CookieSyncSpec extends BaseSpec { def "PBS cookie sync with cookie-sync.pri and in all places disabled coop sync in account shouldn't sync bidder which present in cookie-sync.pir config"() { given: "PBS bidders config" def bidderName = GENERIC - def prebidServerService = pbsServiceFactory.getService( - ["cookie-sync.pri" : bidderName.value, - "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG) + def pbsConfig = ["cookie-sync.pri" : bidderName.value, + "cookie-sync.coop-sync.default": "false"] + GENERIC_CONFIG + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber @@ -1295,9 +1296,9 @@ class CookieSyncSpec extends BaseSpec { and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { - bidders = null - coopSync = null - account = accountId + it.bidders = null + it.coopSync = null + it.account = accountId } and: "Save account with cookie config" @@ -1361,9 +1362,9 @@ class CookieSyncSpec extends BaseSpec { and: "Default cookie sync request without coop-sync and bidders" def accountId = PBSUtils.randomNumber def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { - bidders = null - coopSync = null - account = accountId + it.bidders = null + it.coopSync = null + it.account = accountId } and: "Save account with cookie config" @@ -1460,8 +1461,8 @@ class CookieSyncSpec extends BaseSpec { and: "Cookie sync request with account and privacy" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { - account = PBSUtils.randomString - usPrivacy = new CcpaConsent(optOutSale: ENFORCED) + it.account = PBSUtils.randomString + it.usPrivacy = new CcpaConsent(optOutSale: ENFORCED) } and: "Save account config into DB" diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy index 4dad6b2f4bb..cafd741f089 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy @@ -2,7 +2,6 @@ package org.prebid.server.functional.tests.pricefloors import org.prebid.server.functional.model.Currency import org.prebid.server.functional.model.config.AccountPriceFloorsConfig -import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.PriceFloorsFetch import org.prebid.server.functional.model.mock.services.currencyconversion.CurrencyConversionRatesResponse import org.prebid.server.functional.model.pricefloors.PriceFloorData diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy index 7729159a3af..e1fd6e87645 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsEnforcementSpec.groovy @@ -781,13 +781,13 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def "PBS should suppress deal that are below the matched floor when enforce-deal-floors = true"() { given: "Pbs with PF configuration with enforceDealFloors" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { + def accountConfig = defaultAccountConfigSettings.tap { auction.priceFloors.tap { enforceDealFloors = defaultAccountEnforeDealFloors enforceDealFloorsSnakeCase = defaultAccountEnforeDealFloorsSnakeCase } } - def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(accountConfig)] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest with generic bidder with preferdeals = true" @@ -846,10 +846,10 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def "PBS should not suppress deal that are below the matched floor according to ext.prebid.floors.enforcement.enforcePBS"() { given: "Pbs with PF configuration with enforceDealFloors" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { + def accountConfig = defaultAccountConfigSettings.tap { auction.priceFloors.enforceDealFloors = pbsConfigEnforceDealFloors } - def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(accountConfig)] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default basic BidRequest with generic bidder with preferdeals = true" @@ -905,10 +905,10 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def "PBS should suppress any bids below the matched floor when fetch.enforce-floors-rate = 100 in account config"() { given: "Pbs with PF configuration with minMaxAgeSec" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { + def accountConfig = defaultAccountConfigSettings.tap { auction.priceFloors.enforceFloorsRate = pbsConfigEnforceRate } - def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(accountConfig)] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" @@ -963,10 +963,10 @@ class PriceFloorsEnforcementSpec extends PriceFloorsBaseSpec { def "PBS should not suppress any bids below the matched floor when fetch.enforce-floors-rate = 0 in account config"() { given: "Pbs with PF configuration with minMaxAgeSec" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { + def accountConfig = defaultAccountConfigSettings.tap { auction.priceFloors.enforceFloorsRate = pbsConfigEnforceFloorsRate } - def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(defaultAccountConfigSettings)] + def pbsConfig = FLOORS_CONFIG + ["settings.default-account-config": encode(accountConfig)] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest" diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy index 0e45fb277e0..a9900f997f7 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsFetchingSpec.groovy @@ -343,14 +343,14 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { def "PBS should fetch data from provider when use-dynamic-data enabled"() { given: "Pbs with PF configuration with useDynamicData" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { + def accountConfig = defaultAccountConfigSettings.tap { auction.priceFloors.tap { useDynamicData = pbsConfigUseDynamicData useDynamicDataSnakeCase = pbsConfigUseDynamicDataSnakeCase } } def pbsConfig = FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)] + ["settings.default-account-config": encode(accountConfig)] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with ext.prebid.floors" diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy index 2c93f251196..0e0b2b035d8 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsSignalingSpec.groovy @@ -328,20 +328,12 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { } def "PBS should update imp[0].bidFloor when ext.prebid.bidadjustmentfactors is defined"() { - given: "Pbs with PF configuration with minMaxAgeSec" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { - auction.priceFloors.adjustForBidAdjustment = pbsConfigBidAdjustmentFlag - } - def pbsConfig = FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsService = pbsServiceFactory.getService(pbsConfig) - - and: "BidRequest with bidAdjustment" + given: "BidRequest with bidAdjustment" def floorsProviderFloorValue = PBSUtils.randomFloorValue BigDecimal bidAdjustment = 0.1 def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { - ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(bidAdjustment: requestBidAdjustmentFlag)) - ext.prebid.bidAdjustmentFactors = new BidAdjustmentFactors(adjustments: [(GENERIC): bidAdjustment]) + it.ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(bidAdjustment: requestBidAdjustmentFlag)) + it.ext.prebid.bidAdjustmentFactors = new BidAdjustmentFactors(adjustments: [(GENERIC): bidAdjustment]) } and: "Account with adjustForBidAdjustment in the DB" @@ -357,7 +349,7 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { floorsProvider.setResponse(bidRequest.app.publisher.id, floorsResponse) when: "PBS cache rules and processes auction request" - cacheFloorsProviderRules(bidRequest, floorsProviderFloorValue / bidAdjustment, pbsService) + cacheFloorsProviderRules(bidRequest, floorsProviderFloorValue / bidAdjustment, floorsPbsService) then: "Bidder request bidFloor should be update according to bidAdjustment" def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() @@ -366,52 +358,38 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { and: "Bidder request shouldn't include imp.ext.prebid.floors" assert !bidderRequest.imp[0].ext.prebid.floors - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) - where: - pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag - true | true | null - true | null | null - false | null | true + requestBidAdjustmentFlag | accountBidAdjustmentFlag + true | null + null | null + null | true } def "PBS should not update imp[0].bidFloor when bidadjustment is disallowed"() { - given: "Pbs with PF configuration with adjustForBidAdjustment" - def defaultAccountConfigSettings = defaultAccountConfigSettings.tap { - auction.priceFloors.tap { - adjustForBidAdjustment = pbsConfigBidAdjustmentFlag - adjustForBidAdjustmentSnakeCase = pbsConfigBidAdjustmentFlagSnakeCase - } - } - def pbsConfig = FLOORS_CONFIG + - ["settings.default-account-config": encode(defaultAccountConfigSettings)] - def pbsService = pbsServiceFactory.getService(pbsConfig) - - and: "Default BidRequest" + given: "Default BidRequest" def floorsProviderFloorValue = 0.8 def bidAdjustment = 0.1 def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { - ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(bidAdjustment: requestBidAdjustmentFlag)) - ext.prebid.bidAdjustmentFactors = new BidAdjustmentFactors(adjustments: [(GENERIC): bidAdjustment]) + it.ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(bidAdjustment: requestBidAdjustmentFlag)) + it.ext.prebid.bidAdjustmentFactors = new BidAdjustmentFactors(adjustments: [(GENERIC): bidAdjustment]) } and: "Account in the DB" def accountId = bidRequest.app.publisher.id def account = getAccountWithEnabledFetch(accountId).tap { - config.auction.priceFloors.adjustForBidAdjustment = accountBidAdjustmentFlag - config.auction.priceFloors.adjustForBidAdjustmentSnakeCase = accountBidAdjustmentFlagSnakeCase + it.config.auction.priceFloors.adjustForBidAdjustment = accountBidAdjustmentFlag + it.config.auction.priceFloors.adjustForBidAdjustmentSnakeCase = accountBidAdjustmentFlagSnakeCase } accountDao.save(account) and: "Set Floors Provider response" def floorsResponse = PriceFloorData.priceFloorData.tap { - modelGroups[0].values = [(rule): floorsProviderFloorValue] + it.modelGroups[0].values = [(rule): floorsProviderFloorValue] } floorsProvider.setResponse(accountId, floorsResponse) when: "PBS cache rules and processes auction request" - cacheFloorsProviderRules(bidRequest, floorsProviderFloorValue, pbsService) + cacheFloorsProviderRules(bidRequest, floorsProviderFloorValue, floorsPbsService) then: "Bidder request bidFloor should be changed" def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() @@ -420,15 +398,57 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { and: "Bidder request shouldn't include imp.ext.prebid.floors" assert !bidderRequest.imp[0].ext.prebid.floors + where: + requestBidAdjustmentFlag | accountBidAdjustmentFlag | accountBidAdjustmentFlagSnakeCase + false | null | false + null | false | null + false | null | false + null | false | null + } + + def "PBS should priorities account config over default account config and update imp[0].bidFloor"() { + given: "Pbs with PF configuration with adjustForBidAdjustment" + def accountConfig = defaultAccountConfigSettings.tap { + it.auction.priceFloors.tap { + it.adjustForBidAdjustment = false + adjustForBidAdjustmentSnakeCase = null + } + } + def pbsConfig = FLOORS_CONFIG + + ["settings.default-account-config": encode(accountConfig)] + def pbsService = pbsServiceFactory.getService(pbsConfig) + + and: "BidRequest with bidAdjustment" + def floorsProviderFloorValue = PBSUtils.randomFloorValue + BigDecimal bidAdjustment = 0.1 + def bidRequest = BidRequest.getDefaultBidRequest(APP).tap { + ext.prebid.floors = new ExtPrebidFloors(enforcement: new ExtPrebidPriceFloorEnforcement(bidAdjustment: null)) + ext.prebid.bidAdjustmentFactors = new BidAdjustmentFactors(adjustments: [(GENERIC): bidAdjustment]) + } + and: "Account with adjustForBidAdjustment in the DB" + def account = getAccountWithEnabledFetch(bidRequest.app.publisher.id).tap { + config.auction.priceFloors.adjustForBidAdjustment = null + config.auction.priceFloors.adjustForBidAdjustmentSnakeCase = true + } + accountDao.save(account) + + and: "Set Floors Provider response" + def floorsResponse = PriceFloorData.priceFloorData.tap { + modelGroups[0].values = [(rule): floorsProviderFloorValue] + } + floorsProvider.setResponse(bidRequest.app.publisher.id, floorsResponse) + when: "PBS cache rules and processes auction request" + cacheFloorsProviderRules(bidRequest, floorsProviderFloorValue / bidAdjustment, pbsService) + + then: "Bidder request bidFloor should be update according to bidAdjustment" + def bidderRequest = bidder.getBidderRequests(bidRequest.id).last() + assert bidderRequest.imp[0].bidFloor == floorsProviderFloorValue / bidAdjustment + + and: "Bidder request shouldn't include imp.ext.prebid.floors" + assert !bidderRequest.imp[0].ext.prebid.floors + cleanup: "Stop and remove pbs container" pbsServiceFactory.removeContainer(pbsConfig) - - where: - pbsConfigBidAdjustmentFlagSnakeCase | pbsConfigBidAdjustmentFlag | requestBidAdjustmentFlag | accountBidAdjustmentFlag | accountBidAdjustmentFlagSnakeCase - null | false | false | null | false - null | true | null | false | null - false | null | false | null | false - true | null | null | false | null } def "PBS should choose most aggressive adjustment when request contains multiple media-types"() { @@ -670,10 +690,10 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { and: "Floor config with default account" def accountConfig = getDefaultAccountConfigSettings().tap { - auction.priceFloors.fetch.enabled = true - auction.priceFloors.fetch.url = BASIC_FETCH_URL + bidRequest.site.publisher.id - auction.priceFloors.fetch.maxSchemaDims = MAX_SCHEMA_DIMENSIONS_SIZE - auction.priceFloors.maxSchemaDims = null + it.auction.priceFloors.fetch.enabled = true + it.auction.priceFloors.fetch.url = BASIC_FETCH_URL + bidRequest.site.publisher.id + it.auction.priceFloors.fetch.maxSchemaDims = MAX_SCHEMA_DIMENSIONS_SIZE + it.auction.priceFloors.maxSchemaDims = null } def pbsFloorConfig = GENERIC_ALIAS_CONFIG + ["price-floors.enabled" : "true", "settings.default-account-config": encode(accountConfig)] From fa6de4d50af2c65c7caf16cc627593aec9430590 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 21 Feb 2025 14:30:25 +0200 Subject: [PATCH 06/24] Update after review --- .../functional/model/config/Stage.groovy | 3 +- .../model/request/auction/UserExtData.groovy | 3 + .../response/auction/AnalyticResult.groovy | 6 +- .../response/auction/AnalyticTagStatus.groovy | 13 ++++ .../auction/AnalyticsTagActivity.groovy | 2 +- .../auction/AnalyticsTagActivityResult.groovy | 2 +- .../server/functional/tests/BaseSpec.groovy | 8 +- .../server/functional/tests/CacheSpec.groovy | 6 +- .../server/functional/tests/UUIDSpec.groovy | 1 - .../tests/module/AbTestingModuleSpec.groovy | 77 ++++++++++--------- .../AnalyticsTagsModuleSpec.groovy | 17 ++-- 11 files changed, 77 insertions(+), 61 deletions(-) create mode 100644 src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticTagStatus.groovy diff --git a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy index ba787025f28..a3a2b3f9ca7 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/Stage.groovy @@ -25,8 +25,7 @@ enum Stage { } static Stage forValue(ModuleHookImplementation moduleHook) { - values() - .collect { [stage: it, matchLength: moduleHook.code.indexOf(it.value) >= 0 ? it.value.length() : -1] } + values().collect { [stage: it, matchLength: moduleHook.code.indexOf(it.value) >= 0 ? it.value.length() : -1] } .findAll { it.matchLength > 0 } .max { it.matchLength } ?.stage diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy index ad7cdf63390..fb7ac0a62dc 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/UserExtData.groovy @@ -1,9 +1,12 @@ package org.prebid.server.functional.model.request.auction +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.ToString import org.prebid.server.functional.util.PBSUtils @ToString(includeNames = true, ignoreNulls = true) +@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) class UserExtData { List keywords diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy index 136fbc47e5e..14946e3b644 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy @@ -6,20 +6,18 @@ import groovy.transform.EqualsAndHashCode import groovy.transform.ToString import org.prebid.server.functional.model.request.auction.Imp -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS - @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) @EqualsAndHashCode class AnalyticResult { String name - String status + AnalyticTagStatus status List results static AnalyticResult buildFromImp(Imp imp) { def appliedTo = new AppliedTo(impIds: [imp.id], bidders: [imp.ext.prebid.bidder.configuredBidders.first()]) def impResult = new ImpResult(status: 'success-block', values: new ModuleValue(richmediaFormat: 'mraid'), appliedTo: appliedTo) - new AnalyticResult(name: 'reject-richmedia', status: SUCCESS.value, results: [impResult]) + new AnalyticResult(name: 'reject-richmedia', status: AnalyticTagStatus.SUCCESS, results: [impResult]) } } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticTagStatus.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticTagStatus.groovy new file mode 100644 index 00000000000..f7575677ce3 --- /dev/null +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticTagStatus.groovy @@ -0,0 +1,13 @@ +package org.prebid.server.functional.model.response.auction + +import com.fasterxml.jackson.annotation.JsonValue + +enum AnalyticTagStatus { + + NONE, LOOKUP, CONTROL, SUCCESS, ERROR, SUCCESS_ALLOW, SUCCESS_BLOCK, SKIPPED, RUN + + @JsonValue + String getValue() { + name().toLowerCase().replace('_', '-') + } +} diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivity.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivity.groovy index 6fd41583617..bc952b46b09 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivity.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivity.groovy @@ -10,6 +10,6 @@ import org.prebid.server.functional.model.request.auction.FetchStatus class AnalyticsTagActivity { ModuleActivityName name - FetchStatus status + AnalyticTagStatus status List results } diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivityResult.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivityResult.groovy index a439d6411c2..570d7271b5f 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivityResult.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticsTagActivityResult.groovy @@ -9,7 +9,7 @@ import org.prebid.server.functional.model.request.auction.FetchStatus @JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) class AnalyticsTagActivityResult { - FetchStatus status + AnalyticTagStatus status AnalyticsTagActivityValue values AppliedTo appliedTo } diff --git a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy index 4579c069e07..4428e69d1eb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy @@ -43,11 +43,11 @@ abstract class BaseSpec extends Specification implements ObjectMapperWrapper { protected static final Map GENERIC_ALIAS_CONFIG = ["adapters.generic.aliases.alias.enabled" : "true", "adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString()] protected static final Map EMPTY_CACHE_TTL_CONFIG = ["cache.default-ttl-seconds.banner": "", - "cache.default-ttl-seconds.video" : "", - "cache.default-ttl-seconds.native": "", - "cache.default-ttl-seconds.audio" : ""] + "cache.default-ttl-seconds.video" : "", + "cache.default-ttl-seconds.native": "", + "cache.default-ttl-seconds.audio" : ""] protected static final Map EMPTY_CACHE_TTL_HOST_CONFIG = ["cache.banner-ttl-seconds": "", - "cache.video-ttl-seconds" : ""] + "cache.video-ttl-seconds" : ""] protected static final PrebidServerService defaultPbsService = pbsServiceFactory.getService([:]) diff --git a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy index 109f90fbeb1..54dd3ee466c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy @@ -97,7 +97,8 @@ class CacheSpec extends BaseSpec { def "PBS should cache bids without api-key header when targeting is specified and api-key-secured disabled"() { given: "Pbs config with disabled api-key-secured and pbc.api.key" def apiKey = PBSUtils.randomString - def pbsConfig = ['pbc.api.key': apiKey, 'cache.api-key-secured': 'false'] + def pbsConfig = ['pbc.api.key' : apiKey, + 'cache.api-key-secured': 'false'] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with cache, targeting" @@ -122,7 +123,8 @@ class CacheSpec extends BaseSpec { def "PBS should cache bids with api-key header when targeting is specified and api-key-secured enabled"() { given: "Pbs config with api-key-secured and pbc.api.key" def apiKey = PBSUtils.randomString - def pbsConfig = ['pbc.api.key': apiKey, 'cache.api-key-secured': 'true'] + def pbsConfig = ['pbc.api.key' : apiKey, + 'cache.api-key-secured': 'true'] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with cache, targeting" diff --git a/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy index 107fadb70b5..cd4545ec6b0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/UUIDSpec.groovy @@ -24,7 +24,6 @@ class UUIDSpec extends BaseSpec { ] private static final PrebidServerService storedRequestIdGenEnabledService = pbsServiceFactory.getService(STORED_REQUEST_ID_GEN_ENABLED_CONFIG) - private static final PrebidServerService storedRequestIdGenDisabledService = pbsServiceFactory.getService(STORED_REQUEST_ID_GEN_DISABLED_CONFIG) def cleanupSpec() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index a62bf021514..f599bb4e645 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -11,6 +11,7 @@ import org.prebid.server.functional.model.request.auction.BidRequest import org.prebid.server.functional.model.request.auction.FetchStatus import org.prebid.server.functional.model.request.auction.TraceLevel import org.prebid.server.functional.model.response.auction.AnalyticResult +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.model.response.auction.InvocationResult import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.util.PBSUtils @@ -216,8 +217,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -227,8 +228,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.RUN].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -277,8 +278,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -288,8 +289,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -338,8 +339,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -349,8 +350,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.RUN].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -392,8 +393,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -430,8 +431,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -479,8 +480,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -526,8 +527,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -574,8 +575,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten().sort() == [FetchStatus.SUCCESS_ALLOW, FetchStatus.RUN, FetchStatus.RUN].value.sort() + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -623,8 +624,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -793,8 +794,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -856,8 +857,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -920,8 +921,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -931,8 +932,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -980,8 +981,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten() == [ORTB2_BLOCKING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SUCCESS_ALLOW].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SUCCESS_ALLOW].value it.analyticsTags.activities.results.values.module.flatten().every { it == null } } @@ -1049,8 +1050,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS, SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION, NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING, AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED, FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -1118,8 +1119,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [FetchStatus.SUCCESS, FetchStatus.SUCCESS].value - it.analyticsTags.activities.results.status.flatten() == [FetchStatus.SKIPPED, FetchStatus.SKIPPED].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy index ece53e033c9..6e29a4a2f1f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy @@ -13,6 +13,7 @@ import org.prebid.server.functional.model.request.auction.FetchStatus import org.prebid.server.functional.model.request.auction.PrebidAnalytics import org.prebid.server.functional.model.request.auction.RichmediaFilter import org.prebid.server.functional.model.request.auction.StoredBidResponse +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.model.response.auction.ModuleActivityName import org.prebid.server.functional.service.PrebidServerService @@ -53,12 +54,12 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { and: "Analytics tag should contain results with name and success status" def analyticResult = analyticsTagPrebid.analyticsTags.activities.first - assert analyticResult.status == FetchStatus.SUCCESS + assert analyticResult.status == AnalyticTagStatus.SUCCESS assert analyticResult.name == ModuleActivityName.ORTB2_BLOCKING and: "Should include appliedTo information in analytics tags results" verifyAll(analyticResult.results.first) { - it.status == FetchStatus.SUCCESS_ALLOW + it.status == AnalyticTagStatus.SUCCESS_ALLOW it.appliedTo.bidders == [GENERIC.value] it.appliedTo.impIds == bidRequest.imp.id } @@ -103,12 +104,12 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { and: "Analytics tag should contain results with name and success status" def analyticResult = analyticsTagPrebid.analyticsTags.activities.first - assert analyticResult.status == FetchStatus.SUCCESS + assert analyticResult.status == AnalyticTagStatus.SUCCESS assert analyticResult.name == ModuleActivityName.REJECT_RICHMEDIA and: "Should include appliedTo information in analytics tags results" verifyAll(analyticResult.results.first) { - it.status == FetchStatus.SUCCESS_BLOCK + it.status == AnalyticTagStatus.SUCCESS_BLOCK it.appliedTo.bidders == [GENERIC.value] it.appliedTo.impIds == bidRequest.imp.id } @@ -142,12 +143,12 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { and: "Analytics tag should contain results with name and success status" def analyticResult = analyticsTagPrebid.analyticsTags.activities.first - assert analyticResult.status == FetchStatus.SUCCESS + assert analyticResult.status == AnalyticTagStatus.SUCCESS assert analyticResult.name == ModuleActivityName.ORTB2_BLOCKING and: "Should include appliedTo information in analytics tags results" verifyAll(analyticResult.results.first) { - it.status == FetchStatus.SUCCESS_ALLOW + it.status == AnalyticTagStatus.SUCCESS_ALLOW it.appliedTo.bidders == [GENERIC.value] it.appliedTo.impIds == bidRequest.imp.id } @@ -188,12 +189,12 @@ class AnalyticsTagsModuleSpec extends ModuleBaseSpec { and: "Analytics tag should contain results with name and success status" def analyticResult = analyticsTagPrebid.analyticsTags.activities.first - assert analyticResult.status == FetchStatus.SUCCESS + assert analyticResult.status == AnalyticTagStatus.SUCCESS assert analyticResult.name == ModuleActivityName.ORTB2_BLOCKING and: "Should include appliedTo information in analytics tags results" verifyAll(analyticResult.results.first) { - it.status == FetchStatus.SUCCESS_ALLOW + it.status == AnalyticTagStatus.SUCCESS_ALLOW it.appliedTo.bidders == [GENERIC.value] it.appliedTo.impIds == bidRequest.imp.id } From dca221afb0341c286f5536b6560b1c1e6a697d62 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 21 Feb 2025 15:16:53 +0200 Subject: [PATCH 07/24] Update after review --- .../tests/module/AbTestingModuleSpec.groovy | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index f599bb4e645..3c70478e734 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -228,7 +228,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -278,7 +278,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -289,7 +289,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -339,7 +339,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -350,7 +350,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_ACTION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.RUN].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -393,7 +393,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -480,7 +480,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -527,7 +527,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -624,7 +624,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -794,7 +794,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -857,7 +857,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -921,7 +921,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -932,7 +932,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS] it.action == [NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [PB_RESPONSE_CORRECTION] } @@ -981,7 +981,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten() == [ORTB2_BLOCKING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SUCCESS_ALLOW].value it.analyticsTags.activities.results.values.module.flatten().every { it == null } } @@ -1050,7 +1050,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS, SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION, NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING, AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -1119,7 +1119,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_INVOCATION, NO_INVOCATION] it.analyticsTags.activities.name.flatten() == [AB_TESTING, AB_TESTING].value - it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten() == [AnalyticTagStatus.SKIPPED, AnalyticTagStatus.SKIPPED].value it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } From 72bb24111fdef0a55fa18fc5459d25f0503d8a11 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 21 Feb 2025 15:37:15 +0200 Subject: [PATCH 08/24] Update after review --- .../functional/tests/module/AbTestingModuleSpec.groovy | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 3c70478e734..341f65eee60 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -217,7 +217,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -431,7 +431,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.status == [SUCCESS, SUCCESS] it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } @@ -575,7 +575,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { it.action == [NO_ACTION, NO_ACTION] it.analyticsTags.activities.name.flatten().sort() == [ORTB2_BLOCKING, AB_TESTING, AB_TESTING].value.sort() - it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS].value + it.analyticsTags.activities.status.flatten().sort() == [AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS, AnalyticTagStatus.SUCCESS] it.analyticsTags.activities.results.status.flatten().sort() == [AnalyticTagStatus.SUCCESS_ALLOW, AnalyticTagStatus.RUN, AnalyticTagStatus.RUN].value.sort() it.analyticsTags.activities.results.values.module.flatten() == [ModuleName.ORTB2_BLOCKING, ModuleName.ORTB2_BLOCKING] } From 0b11156f7a66be13cffbd5019a5ce6a2c75a6300 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 11 Apr 2025 09:00:09 +0300 Subject: [PATCH 09/24] update after review --- .../functional/tests/module/richmedia/RichMediaFilterSpec.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index c42267767f6..1b040cc3ab0 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -39,7 +39,6 @@ class RichMediaFilterSpec extends ModuleBaseSpec { private static PrebidServerService pbsServiceWithEnabledMediaFilter private static PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy - def setupSpec() { pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(SPECIFIC_PATTERN_NAME_CONFIG) From 56b4c1e495dfdc1ba92019f20515f16adcc2b42e Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Mon, 14 Jul 2025 18:59:45 +0300 Subject: [PATCH 10/24] Update functional tests --- .../functional/testcontainers/scaffolding/Bidder.groovy | 2 +- .../org/prebid/server/functional/tests/CacheSpec.groovy | 2 -- .../tests/pricefloors/PriceFloorsCurrencySpec.groovy | 4 ---- 3 files changed, 1 insertion(+), 7 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy index c0991ee30d1..50cc351fdaa 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/Bidder.groovy @@ -34,7 +34,7 @@ class Bidder extends NetworkScaffolding { request().withPath(endpoint) } - static HttpRequest getRequest(String bidRequestId, String requestMatchPath) { + HttpRequest getRequest(String bidRequestId, String requestMatchPath) { request().withPath(endpoint) .withBody(jsonPath("\$[?(@.$requestMatchPath == '$bidRequestId')]")) } diff --git a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy index 96570469a3f..bc3d963d9f3 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy @@ -127,8 +127,6 @@ class CacheSpec extends BaseSpec { given: "Pbs config with disabled api-key-secured and pbc.api.key" def apiKey = PBSUtils.randomString def pbsConfig = ['pbc.api.key': apiKey, 'cache.api-key-secured': 'false'] - def pbsConfig = ['pbc.api.key' : apiKey, - 'cache.api-key-secured': 'false'] def pbsService = pbsServiceFactory.getService(pbsConfig) and: "Default BidRequest with cache, targeting" diff --git a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy index 9fd29ab64d8..0e9d84b29e2 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsCurrencySpec.groovy @@ -36,10 +36,6 @@ class PriceFloorsCurrencySpec extends PriceFloorsBaseSpec { pbsServiceFactory.removeContainer(FLOORS_CONFIG + PbsConfig.currencyConverterConfig) } - def cleanupSpec() { - pbsServiceFactory.removeContainer(FLOORS_CONFIG + CURRENCY_CONVERTER_CONFIG) - } - def "PBS should update bidFloor, bidFloorCur for signalling when request.cur is specified"() { given: "Default BidRequest with cur" def bidRequest = bidRequestWithFloors.tap { From 67c57c7c685c56c3299cd8f66cbbb02760dc46e1 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Mon, 14 Jul 2025 20:46:44 +0300 Subject: [PATCH 11/24] Fix module tests --- .../module/responsecorrenction/ResponseCorrectionSpec.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy index c8e16b9a799..d7f105b050d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy @@ -588,10 +588,10 @@ class ResponseCorrectionSpec extends ModuleBaseSpec { accountDao.save(accountWithResponseCorrectionModule) when: "PBS processes auction request" - def response = pbsServiceWithResponseCorrectionModule.sendAuctionRequest(bidRequest) + def response = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should emit log" - def logsByTime = pbsServiceWithResponseCorrectionModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) def bidId = bidResponse.seatbid[0].bid[0].id def responseCorrection = getLogsByText(logsByTime, bidId) assert responseCorrection.size() == 1 From b66572aeb4749df3af34c5b38501236d8e2d9df0 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Wed, 16 Jul 2025 11:15:37 +0300 Subject: [PATCH 12/24] Fix module tests --- .../model/request/auction/User.groovy | 2 +- .../functional/tests/AuctionSpec.groovy | 14 +-- .../tests/BidderInsensitiveCaseSpec.groovy | 2 +- .../functional/tests/CurrencySpec.groovy | 2 +- .../functional/tests/privacy/CoppaSpec.groovy | 10 +- .../tests/privacy/GdprAmpSpec.groovy | 4 +- .../tests/privacy/GdprAuctionSpec.groovy | 14 +-- .../GppTransmitUfpdActivitiesSpec.groovy | 118 +++++++++--------- .../functional/tests/privacy/LmtSpec.groovy | 10 +- .../tests/privacy/PrivacyBaseSpec.groovy | 2 +- 10 files changed, 89 insertions(+), 89 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy index 0104494910b..2643108e983 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy @@ -9,7 +9,7 @@ import org.prebid.server.functional.util.PBSUtils class User { String id - String buyeruid + String buyerUid Integer yob String gender String keywords 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 195e20977e8..faeb5ab0f62 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/AuctionSpec.groovy @@ -164,7 +164,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the user.ext.prebid.buyeruids" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == buyeruid + assert bidderRequest?.user?.buyerUid == buyeruid } def "PBS shouldn't populate bidder request buyeruid from buyeruids when buyeruids without appropriate bidder present in request"() { @@ -204,7 +204,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the uids cookie" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == uidsCookie.tempUIDs[GENERIC].uid + assert bidderRequest?.user?.buyerUid == uidsCookie.tempUIDs[GENERIC].uid cleanup: "Stop and remove pbs container" pbsServiceFactory.removeContainer(pbsConfig) @@ -230,7 +230,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request shouldn't contain buyeruid from the uids cookie" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert !bidderRequest.user.buyeruid + assert !bidderRequest.user.buyerUid cleanup: "Stop and remove pbs container" pbsServiceFactory.removeContainer(pbsConfig) @@ -252,7 +252,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the buyeruids" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == buyeruid + assert bidderRequest?.user?.buyerUid == buyeruid } def "PBS should populate buyeruid from host cookie name config when host cookie family matched with requested bidder"() { @@ -275,7 +275,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from cookieName" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == hostCookieUid + assert bidderRequest?.user?.buyerUid == hostCookieUid } def "PBS shouldn't populate buyeruid from cookie name config when host cookie family not matched with requested cookie-family-name"() { @@ -417,7 +417,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the user.ext.prebid.buyeruids" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == buyeruid + assert bidderRequest?.user?.buyerUid == buyeruid where: bidderName << [GENERIC, GENERIC_CAMEL_CASE] @@ -448,7 +448,7 @@ class AuctionSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the user.ext.prebid.buyeruids" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == buyeruid + assert bidderRequest?.user?.buyerUid == buyeruid where: bidderName << [GENERIC, GENERIC_CAMEL_CASE] diff --git a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy index a6dc63f08f8..de60c9be236 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BidderInsensitiveCaseSpec.groovy @@ -217,7 +217,7 @@ class BidderInsensitiveCaseSpec extends BaseSpec { then: "Bidder request should contain buyeruid from the user.ext.prebid.buyeruids" def bidderRequest = bidder.getBidderRequest(bidRequest.id) - assert bidderRequest?.user?.buyeruid == buyeruid + assert bidderRequest?.user?.buyerUid == buyeruid } def "PBS should be able to match requested bidder with original bidder name in ext.prebid.aliase"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy index 95a7af60ce8..c9ff3d005d3 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CurrencySpec.groovy @@ -27,7 +27,7 @@ class CurrencySpec extends BaseSpec { } def cleanupSpec() { - pbsServiceFactory.removeContainer(externalCurrencyConverterConfig) + pbsServiceFactory.removeContainer(PbsConfig.currencyConverterConfig) } def "PBS should return currency rates"() { diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy index f93a014f058..ebc3d3b2f23 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/CoppaSpec.groovy @@ -185,7 +185,7 @@ class CoppaSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == bidRequest.device.geo.ext bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.eids[0].source == bidRequest.user.eids[0].source @@ -254,7 +254,7 @@ class CoppaSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -324,7 +324,7 @@ class CoppaSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -389,7 +389,7 @@ class CoppaSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == ampStoredRequest.device.geo.ext bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.eids[0].source == ampStoredRequest.user.eids[0].source @@ -462,7 +462,7 @@ class CoppaSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy index a63738ab94b..8eb190ba857 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAmpSpec.groovy @@ -565,7 +565,7 @@ class GdprAmpSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -640,7 +640,7 @@ class GdprAmpSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == ampStoredRequest.device.geo.ext bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.eids[0].source == ampStoredRequest.user.eids[0].source diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy index cc2fe5e4156..a6b3fb34fff 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprAuctionSpec.groovy @@ -611,7 +611,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -689,7 +689,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -765,7 +765,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == bidRequest.device.geo.ext bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.eids[0].source == bidRequest.user.eids[0].source @@ -969,7 +969,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { given: "Default bid requests with personal data" def bidRequest = bidRequestWithPersonalData.tap { regs.gdpr = 1 - user.buyeruid = null + user.buyerUid = null user.ext.consent = new TcfConsent.Builder().build() ext.prebid.trace = VERBOSE } @@ -992,7 +992,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { def bidderRequest = bidder.getBidderRequest(bidRequest.id) verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -1038,7 +1038,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { def bidderRequest = bidder.getBidderRequest(bidRequest.id) verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -1083,7 +1083,7 @@ class GdprAuctionSpec extends PrivacyBaseSpec { def bidderRequest = bidder.getBidderRequest(bidRequest.id) verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy index 6da825b3f90..d75a38784e8 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy @@ -112,7 +112,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -162,7 +162,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -214,7 +214,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -290,7 +290,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -333,7 +333,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -385,7 +385,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -447,7 +447,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.geo @@ -507,7 +507,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -573,7 +573,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.geo @@ -637,7 +637,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -696,7 +696,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.geo @@ -755,7 +755,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -813,7 +813,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.geo @@ -865,7 +865,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -916,7 +916,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1087,7 +1087,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1150,12 +1150,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.zip == bidRequest.user.geo.zip - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1220,12 +1220,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo.zip == bidRequest.user.geo.zip - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1279,7 +1279,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1335,7 +1335,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -1394,7 +1394,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -1463,7 +1463,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -1549,7 +1549,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data @@ -1608,7 +1608,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1690,12 +1690,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -1749,7 +1749,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1871,7 +1871,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -1926,7 +1926,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -1980,7 +1980,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2074,7 +2074,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -2126,7 +2126,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2184,7 +2184,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2246,7 +2246,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -2305,7 +2305,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2365,7 +2365,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2545,7 +2545,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2617,12 +2617,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2695,12 +2695,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2762,7 +2762,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -2826,7 +2826,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -2893,12 +2893,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -2967,7 +2967,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -3037,7 +3037,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -3141,7 +3141,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data @@ -3209,7 +3209,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -3297,12 +3297,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == ampStoredRequest.device.macmd5 bidderRequest.device.dpidmd5 == ampStoredRequest.device.dpidmd5 bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.data == ampStoredRequest.user.data bidderRequest.user.geo == ampStoredRequest.user.geo - bidderRequest.user.ext.data.buyeruid == ampStoredRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == ampStoredRequest.user.ext.data.buyerUid } and: "Generic bidder request should have data in EIDS fields" @@ -3367,7 +3367,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -3483,7 +3483,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -3538,7 +3538,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -3586,7 +3586,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { !bidderRequest.device.macmd5 !bidderRequest.device.dpidmd5 !bidderRequest.user.id - !bidderRequest.user.buyeruid + !bidderRequest.user.buyerUid !bidderRequest.user.yob !bidderRequest.user.gender !bidderRequest.user.data @@ -3652,12 +3652,12 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { bidderRequest.device.macmd5 == bidRequest.device.macmd5 bidderRequest.device.dpidmd5 == bidRequest.device.dpidmd5 bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.data == bidRequest.user.data bidderRequest.user.geo == bidRequest.user.geo - bidderRequest.user.ext.data.buyeruid == bidRequest.user.ext.data.buyeruid + bidderRequest.user.ext.data.buyerUid == bidRequest.user.ext.data.buyerUid } and: "Bidder request should have data in EIDS fields" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy index 4f13b59ff9c..4028fb4d05e 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/LmtSpec.groovy @@ -377,7 +377,7 @@ class LmtSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -447,7 +447,7 @@ class LmtSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -510,7 +510,7 @@ class LmtSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == bidRequest.device.geo.ext bidderRequest.user.id == bidRequest.user.id - bidderRequest.user.buyeruid == bidRequest.user.buyeruid + bidderRequest.user.buyerUid == bidRequest.user.buyerUid bidderRequest.user.yob == bidRequest.user.yob bidderRequest.user.gender == bidRequest.user.gender bidderRequest.user.eids[0].source == bidRequest.user.eids[0].source @@ -583,7 +583,7 @@ class LmtSpec extends PrivacyBaseSpec { and: "Bidder request should mask user personal data" verifyAll(bidderRequest.user) { !id - !buyeruid + !buyerUid !yob !gender !eids @@ -649,7 +649,7 @@ class LmtSpec extends PrivacyBaseSpec { bidderRequest.device.geo.ext == ampStoredRequest.device.geo.ext bidderRequest.user.id == ampStoredRequest.user.id - bidderRequest.user.buyeruid == ampStoredRequest.user.buyeruid + bidderRequest.user.buyerUid == ampStoredRequest.user.buyerUid bidderRequest.user.yob == ampStoredRequest.user.yob bidderRequest.user.gender == ampStoredRequest.user.gender bidderRequest.user.eids[0].source == ampStoredRequest.user.eids[0].source diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy index 9c5bfb1681d..9cdeab282b3 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy @@ -164,7 +164,7 @@ abstract class PrivacyBaseSpec extends BaseSpec { customdata = PBSUtils.randomString eids = [Eid.defaultEid] data = [new Data(name: PBSUtils.randomString)] - buyeruid = PBSUtils.randomString + buyerUid = PBSUtils.randomString yob = PBSUtils.randomNumber gender = PBSUtils.randomString geo = Geo.FPDGeo From ec1bcf149736c90d1b53cd1a87ae3b47765e1f3c Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Wed, 16 Jul 2025 15:37:56 +0300 Subject: [PATCH 13/24] Fix module tests --- .../prebid/server/functional/model/request/auction/User.groovy | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy b/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy index 2643108e983..93090dd72e5 100644 --- a/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/request/auction/User.groovy @@ -1,10 +1,13 @@ package org.prebid.server.functional.model.request.auction +import com.fasterxml.jackson.databind.PropertyNamingStrategies +import com.fasterxml.jackson.databind.annotation.JsonNaming import groovy.transform.EqualsAndHashCode import groovy.transform.ToString import org.prebid.server.functional.util.PBSUtils @ToString(includeNames = true, ignoreNulls = true) +@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) @EqualsAndHashCode class User { From f5e659331dd2f197f66704087bc48b6a2f5a2d47 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 31 Oct 2025 10:27:39 +0200 Subject: [PATCH 14/24] fix imports --- .../prebid/server/functional/tests/HttpSettingsSpec.groovy | 4 ---- .../server/functional/tests/module/ModuleBaseSpec.groovy | 7 ++----- .../tests/module/optabletargeting/CacheStorageSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineAliasSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineBaseSpec.groovy | 4 +--- .../tests/module/pbruleengine/RuleEngineContextSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineCoreSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineDeviceSpec.groovy | 3 +-- .../pbruleengine/RuleEngineInfrastructureSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEnginePrivacySpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineSpecialSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineSyncSpec.groovy | 2 +- .../tests/module/richmedia/RichMediaFilterSpec.groovy | 6 ------ 13 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy index 87287722929..4c9e42bb888 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/HttpSettingsSpec.groovy @@ -43,10 +43,6 @@ class HttpSettingsSpec extends BaseSpec { prebidServerService = pbsServiceFactory.removeContainer(PBS_CONFIG_WITH_RFC) } - def cleanupSpec() { - pbsServiceFactory.removeContainer(PbsConfig.httpSettingsConfig) - } - def "PBS should take account information from http data source on auction request"() { given: "Get basic BidRequest with generic bidder and set gdpr = 1" def bidRequest = BidRequest.defaultBidRequest diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy index 8aa47ce1940..6c94d891091 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy @@ -12,7 +12,6 @@ import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.response.auction.AnalyticResult import org.prebid.server.functional.model.response.auction.BidResponse -import org.prebid.server.functional.model.response.auction.InvocationResult import org.prebid.server.functional.tests.BaseSpec import spock.lang.Shared import org.prebid.server.functional.util.PBSUtils @@ -22,13 +21,11 @@ import static org.prebid.server.functional.model.config.ModuleName.OPTABLE_TARGE import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING import static org.prebid.server.functional.model.config.ModuleName.PB_RESPONSE_CORRECTION import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER -import static org.prebid.server.functional.model.ModuleName.PB_REQUEST_CORRECTION -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_REQUEST_CORRECTION +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION -import static org.prebid.server.functional.model.config.Stage.ALL_PROCESSED_BID_RESPONSES import static org.prebid.server.functional.model.config.Stage.PROCESSED_AUCTION_REQUEST import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer -import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer class ModuleBaseSpec extends BaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy index 9a71d42ba7f..128b00312ee 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy @@ -21,7 +21,7 @@ import org.prebid.server.functional.util.PBSUtils import static org.apache.commons.codec.binary.Base64.encodeBase64 import static org.mockserver.model.HttpStatusCode.NOT_FOUND_404 -import static org.prebid.server.functional.model.ModuleName.OPTABLE_TARGETING +import static org.prebid.server.functional.model.config.ModuleName.OPTABLE_TARGETING import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer class CacheStorageSpec extends ModuleBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy index 4477e6d9d38..cb5653f5d6a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy @@ -2,7 +2,7 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.request.auction.Imp -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.ALIAS import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy index d27d44e0fc0..2326be54ddf 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy @@ -19,9 +19,8 @@ import org.prebid.server.functional.model.request.auction.ImpUnitCode import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils -import spock.lang.Retry -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.ALIAS import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC @@ -41,7 +40,6 @@ import static org.prebid.server.functional.model.request.auction.TraceLevel.VERB import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID -@Retry //TODO remove in 3.34+ abstract class RuleEngineBaseSpec extends ModuleBaseSpec { protected static final List MULTI_BID_ADAPTERS = [GENERIC, OPENX, AMX].sort() diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy index 5bea040218e..124468a3132 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy @@ -16,7 +16,7 @@ import org.prebid.server.functional.util.PBSUtils import java.time.Instant import static org.prebid.server.functional.model.ChannelType.WEB -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy index 8e9de1807c9..23f815a8cf4 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy @@ -8,7 +8,7 @@ import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.request.auction.Imp import org.prebid.server.functional.util.PBSUtils -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy index 229e54a0ff0..c109e4691e6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy @@ -6,11 +6,10 @@ import org.prebid.server.functional.model.pricefloors.Country import org.prebid.server.functional.model.request.auction.Device import org.prebid.server.functional.model.request.auction.DeviceType import org.prebid.server.functional.util.PBSUtils -import spock.lang.RepeatUntilFailure import java.time.Instant -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy index f710ba39f93..cc5ae6bf1a2 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy @@ -6,7 +6,7 @@ import org.prebid.server.functional.util.PBSUtils import java.time.Instant -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy index c4f207544b5..b8c30337d44 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy @@ -19,7 +19,7 @@ import org.prebid.server.functional.util.privacy.TcfConsent import java.time.Instant -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy index cce9631e1b9..af06f07e305 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy @@ -5,7 +5,7 @@ import org.prebid.server.functional.util.PBSUtils import java.time.Instant -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy index 881a8211ca4..72e1e442274 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy @@ -3,7 +3,7 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.UidsCookie import org.prebid.server.functional.util.HttpUtil -import static org.prebid.server.functional.model.ModuleName.PB_RULE_ENGINE +import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index 9fba58d6eab..a31b16c340a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -452,12 +452,6 @@ class RichMediaFilterSpec extends ModuleBaseSpec { admValue << [PATTERN_NAME, "${PBSUtils.randomString}-${PATTERN_NAME}", "${PATTERN_NAME}.${PBSUtils.randomString}"] } - private static List getAnalyticResults(BidResponse response) { - response.ext.prebid.modules?.trace?.stages?.first() - ?.outcomes?.first()?.groups?.first() - ?.invocationResults?.first()?.analyticsTags?.activities - } - private static Account getAccountWithRichmediaFilter(String accountId, Boolean filterMraid, String mraidScriptPattern) { getAccountWithModuleConfig(accountId, [PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES]).tap { it.config.hooks.modules.pbRichmediaFilter = new RichmediaFilter(filterMraid: filterMraid, mraidScriptPattern: mraidScriptPattern) From d3371fbe5824e24fa577292d6150a1f14412db7b Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 31 Oct 2025 13:26:07 +0200 Subject: [PATCH 15/24] fix imports --- .../server/functional/model/response/auction/ImpResult.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineAliasSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineContextSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineCoreSpec.groovy | 3 ++- .../tests/module/pbruleengine/RuleEngineDeviceSpec.groovy | 2 +- .../module/pbruleengine/RuleEngineInfrastructureSpec.groovy | 3 ++- .../tests/module/pbruleengine/RuleEnginePrivacySpec.groovy | 3 ++- .../tests/module/pbruleengine/RuleEngineSpecialSpec.groovy | 2 +- .../tests/module/pbruleengine/RuleEngineSyncSpec.groovy | 3 ++- 9 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/ImpResult.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/ImpResult.groovy index 8740e415f47..e95e3ee896e 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/ImpResult.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/ImpResult.groovy @@ -11,7 +11,7 @@ import org.prebid.server.functional.model.request.auction.FetchStatus @EqualsAndHashCode class ImpResult { - FetchStatus status + AnalyticTagStatus status ModuleValue values AppliedTo appliedTo } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy index cb5653f5d6a..a4cc7a15556 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy @@ -11,7 +11,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX_ALIAS import static org.prebid.server.functional.model.config.PbRulesEngine.createRulesEngineWithRule import static org.prebid.server.functional.model.config.RuleEngineModelRuleResult.createRuleEngineModelRuleWithExcludeResult import static org.prebid.server.functional.model.config.RuleEngineModelRuleResult.createRuleEngineModelRuleWithIncludeResult -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineAliasSpec extends RuleEngineBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy index 124468a3132..3b9b96c479f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy @@ -33,11 +33,11 @@ import static org.prebid.server.functional.model.pricefloors.MediaType.BANNER import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP import static org.prebid.server.functional.model.request.auction.DistributionChannel.DOOH import static org.prebid.server.functional.model.request.auction.DistributionChannel.SITE -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS import static org.prebid.server.functional.model.request.auction.ImpUnitCode.GPID import static org.prebid.server.functional.model.request.auction.ImpUnitCode.PB_AD_SLOT import static org.prebid.server.functional.model.request.auction.ImpUnitCode.STORED_REQUEST import static org.prebid.server.functional.model.request.auction.ImpUnitCode.TAG_ID +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineContextSpec extends RuleEngineBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy index 23f815a8cf4..58b6e2d5a01 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy @@ -6,6 +6,7 @@ import org.prebid.server.functional.model.config.RuleSet import org.prebid.server.functional.model.config.RulesEngineModelGroup import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.request.auction.Imp +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.util.PBSUtils import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE @@ -20,8 +21,8 @@ import static org.prebid.server.functional.model.config.RuleEngineModelRuleResul import static org.prebid.server.functional.model.config.RuleEngineModelRuleResult.createRuleEngineModelRuleWithLogATagResult import static org.prebid.server.functional.model.config.Stage.PROCESSED_AUCTION_REQUEST import static org.prebid.server.functional.model.pricefloors.Country.BULGARIA -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.ERROR_NO_BID import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy index c109e4691e6..5500ba3c09a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy @@ -19,7 +19,7 @@ import static org.prebid.server.functional.model.config.RuleEngineFunction.DEVIC import static org.prebid.server.functional.model.config.RuleEngineFunction.DEVICE_TYPE import static org.prebid.server.functional.model.config.RuleEngineFunction.DEVICE_TYPE_IN import static org.prebid.server.functional.model.pricefloors.Country.USA -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineDeviceSpec extends RuleEngineBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy index cc5ae6bf1a2..72f8ee83173 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy @@ -2,6 +2,7 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.config.RuleEngineFunctionArgs import org.prebid.server.functional.model.config.RuleEngineModelSchema +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.util.PBSUtils import java.time.Instant @@ -13,7 +14,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX import static org.prebid.server.functional.model.config.PbRulesEngine.createRulesEngineWithRule import static org.prebid.server.functional.model.config.RuleEngineFunction.DATA_CENTER import static org.prebid.server.functional.model.config.RuleEngineFunction.DATA_CENTER_IN -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy index b8c30337d44..49b90352640 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy @@ -14,6 +14,7 @@ import org.prebid.server.functional.model.request.auction.SiteExtData import org.prebid.server.functional.model.request.auction.User import org.prebid.server.functional.model.request.auction.UserExt import org.prebid.server.functional.model.request.auction.UserExtData +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.util.PBSUtils import org.prebid.server.functional.util.privacy.TcfConsent @@ -32,7 +33,7 @@ import static org.prebid.server.functional.model.config.RuleEngineFunction.GPP_S import static org.prebid.server.functional.model.config.RuleEngineFunction.TCF_IN_SCOPE import static org.prebid.server.functional.model.config.RuleEngineFunction.USER_FPD_AVAILABLE import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID import static org.prebid.server.functional.util.privacy.TcfConsent.PurposeId.BASIC_ADS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy index af06f07e305..a504f7ca37a 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy @@ -12,7 +12,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX import static org.prebid.server.functional.model.config.PbRulesEngine.createRulesEngineWithRule import static org.prebid.server.functional.model.config.RuleEngineFunction.PERCENT import static org.prebid.server.functional.model.config.RuleEngineFunction.PREBID_KEY -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineSpecialSpec extends RuleEngineBaseSpec { diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy index 72e1e442274..b62f1cff541 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy @@ -1,6 +1,7 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.UidsCookie +import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.util.HttpUtil import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE @@ -10,7 +11,7 @@ import static org.prebid.server.functional.model.bidder.BidderName.OPENX import static org.prebid.server.functional.model.config.PbRulesEngine.createRulesEngineWithRule import static org.prebid.server.functional.model.config.RuleEngineModelRuleResult.createRuleEngineModelRuleWithExcludeResult import static org.prebid.server.functional.model.config.RuleEngineModelRuleResult.createRuleEngineModelRuleWithIncludeResult -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE class RuleEngineSyncSpec extends RuleEngineBaseSpec { From 11f47a333bb2e9ba02c18538df744760a7966cf9 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 31 Oct 2025 18:37:57 +0200 Subject: [PATCH 16/24] fix mr conflicts --- .../response/auction/AnalyticResult.groovy | 6 +++--- .../functional/tests/TargetingSpec.groovy | 21 ------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy index 8d1967bf09d..5b605b12c0f 100644 --- a/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/response/auction/AnalyticResult.groovy @@ -6,8 +6,8 @@ import groovy.transform.EqualsAndHashCode import groovy.transform.ToString import org.prebid.server.functional.model.request.auction.Imp -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS -import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS_BLOCK +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS +import static org.prebid.server.functional.model.response.auction.AnalyticTagStatus.SUCCESS_BLOCK @ToString(includeNames = true, ignoreNulls = true) @JsonNaming(PropertyNamingStrategies.LowerCaseStrategy) @@ -21,6 +21,6 @@ class AnalyticResult { static AnalyticResult buildFromImp(Imp imp) { def appliedTo = new AppliedTo(impIds: [imp.id], bidders: [imp.ext.prebid.bidder.configuredBidders.first()]) def impResult = new ImpResult(status: SUCCESS_BLOCK, values: new ModuleValue(richmediaFormat: 'mraid'), appliedTo: appliedTo) - new AnalyticResult(name: 'reject-richmedia', status: AnalyticTagStatus.SUCCESS, results: [impResult]) + new AnalyticResult(name: 'reject-richmedia', status: SUCCESS, results: [impResult]) } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy index 9638b843c5e..d9d337b3c27 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/TargetingSpec.groovy @@ -955,9 +955,6 @@ class TargetingSpec extends BaseSpec { def targeting = ampResponse.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should use long request targeting prefix when settings.targeting.truncate-attr-chars override"() { @@ -981,9 +978,6 @@ class TargetingSpec extends BaseSpec { def targeting = ampResponse.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should use long request targeting prefix when settings.targeting.truncate-attr-chars override"() { @@ -1000,9 +994,6 @@ class TargetingSpec extends BaseSpec { def targeting = bidResponse.seatbid?.first()?.bid?.first()?.ext?.prebid?.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should use long account targeting prefix when settings.targeting.truncate-attr-chars override"() { @@ -1024,9 +1015,6 @@ class TargetingSpec extends BaseSpec { def targeting = bidResponse.seatbid?.first()?.bid?.first()?.ext?.prebid?.targeting assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(prefix) } - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should ignore and add a warning to ext.warnings when value of the account prefix is longer then settings.targeting.truncate-attr-chars"() { @@ -1075,9 +1063,6 @@ class TargetingSpec extends BaseSpec { then: "Amp response should contain warning" def decreasePrefixLength = prefix.length() + TARGETING_PREFIX_LENGTH - DEFAULT_TRUNCATE_CHARS assert ampResponse.ext?.warnings[TARGETING]*.message == [DROP_PREFIX_WARNING.formatted(decreasePrefixLength), truncatedMessage()] - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should ignore and add a warning to ext.warnings when value of the request prefix is longer then settings.targeting.truncate-attr-chars"() { @@ -1096,9 +1081,6 @@ class TargetingSpec extends BaseSpec { assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(DEFAULT_TARGETING_PREFIX) } assert bidResponse.ext?.warnings[TARGETING]*.message == [DROP_PREFIX_WARNING.formatted(prefix.length() + TARGETING_PREFIX_LENGTH - DEFAULT_TRUNCATE_CHARS)] - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS auction should ignore and add a warning to ext.warnings when value of the account prefix is longer then settings.targeting.truncate-attr-chars"() { @@ -1121,9 +1103,6 @@ class TargetingSpec extends BaseSpec { assert !targeting.isEmpty() assert targeting.keySet().every { it -> it.startsWith(DEFAULT_TARGETING_PREFIX) } assert bidResponse.ext?.warnings[TARGETING]*.message == [DROP_PREFIX_WARNING.formatted(prefix.length() + TARGETING_PREFIX_LENGTH - DEFAULT_TRUNCATE_CHARS)] - - cleanup: "Stop and remove pbs container" - pbsServiceFactory.removeContainer(pbsConfig) } def "PBS amp should apply data from query to ext.prebid.amp.data"() { From 8a4d564ae7b1558cf00ca3bc92cca7319a36cb96 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Mon, 3 Nov 2025 13:43:10 +0200 Subject: [PATCH 17/24] Optimize module tests --- .../tests/module/ModuleBaseSpec.groovy | 91 ++++++++++++------- .../optabletargeting/CacheStorageSpec.groovy | 59 +++++------- .../pbruleengine/RuleEngineAliasSpec.groovy | 8 +- .../pbruleengine/RuleEngineBaseSpec.groovy | 37 ++------ .../pbruleengine/RuleEngineContextSpec.groovy | 48 +++++----- .../pbruleengine/RuleEngineCoreSpec.groovy | 38 ++++---- .../pbruleengine/RuleEngineDeviceSpec.groovy | 20 ++-- .../RuleEngineInfrastructureSpec.groovy | 12 +-- .../pbruleengine/RuleEnginePrivacySpec.groovy | 36 ++++---- .../pbruleengine/RuleEngineSpecialSpec.groovy | 16 ++-- .../pbruleengine/RuleEngineSyncSpec.groovy | 12 +-- .../RuleEngineValidationSpec.groovy | 40 ++++---- 12 files changed, 203 insertions(+), 214 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy index 6c94d891091..bf911d38e64 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy @@ -9,13 +9,16 @@ import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.PbsModulesConfig import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.service.PrebidServerService -import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.response.auction.AnalyticResult import org.prebid.server.functional.model.response.auction.BidResponse import org.prebid.server.functional.tests.BaseSpec import spock.lang.Shared import org.prebid.server.functional.util.PBSUtils +import static org.prebid.server.functional.model.bidder.BidderName.AMX +import static org.prebid.server.functional.model.bidder.BidderName.GENERIC +import static org.prebid.server.functional.model.bidder.BidderName.OPENX +import static org.prebid.server.functional.model.bidder.BidderName.OPENX_ALIAS import static org.prebid.server.functional.model.config.ModuleHookImplementation.PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES import static org.prebid.server.functional.model.config.ModuleName.OPTABLE_TARGETING import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING @@ -24,22 +27,44 @@ import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_ import static org.prebid.server.functional.model.config.ModuleName.PB_REQUEST_CORRECTION import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION -import static org.prebid.server.functional.model.config.Stage.PROCESSED_AUCTION_REQUEST import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer +import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID class ModuleBaseSpec extends BaseSpec { protected static final String WILDCARD = '*' - private static final Map ORTB_ADAPTER_CONFIG = ['adapter-defaults.ortb.multiformat-supported': 'false'] - private static final Map MODIFYING_VAST_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", - "adapters.generic.modifying-vast-xml-allowed": "false"] - private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", - "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - + protected static final String CONFIG_DATA_CENTER = PBSUtils.randomString protected final static Map EXTERNAL_MODULES_CONFIG = getModuleBaseSettings(PB_RICHMEDIA_FILTER) + getModuleBaseSettings(PB_RESPONSE_CORRECTION) + getModuleBaseSettings(ORTB2_BLOCKING) + - getModuleBaseSettings(PB_REQUEST_CORRECTION) + getModuleBaseSettings(PB_REQUEST_CORRECTION) + + getOptableTargetingSettings() + + getRulesEngineSettings() + + private static final Map ENABLED_DEBUG_LOG_MODE = ["logging.level.root": "debug"] + private static final Map ORTB_ADAPTER_CONFIG = ['adapter-defaults.ortb.multiformat-supported': 'false'] + private static final Map MODIFYING_VAST_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", + "adapters.generic.modifying-vast-xml-allowed": "false"] + private static final Map CACHE_STORAGE_CONFIG = ['storage.pbc.path' : "$networkServiceContainer.rootUri/stored-cache".toString(), + 'storage.pbc.call-timeout-ms': '1000', + 'storage.pbc.enabled' : 'true', + 'cache.module.enabled' : 'true', + 'pbc.api.key' : PBSUtils.randomString, + 'cache.api-key-secured' : 'false'] + private static final String USER_SYNC_URL = "$networkServiceContainer.rootUri/generic-usersync" + private static final Map GENERIC_CONFIG = [ + "adapters.${GENERIC.value}.usersync.redirect.url" : USER_SYNC_URL, + "adapters.${GENERIC.value}.usersync.redirect.support-cors": false as String, + "adapters.${GENERIC.value}.meta-info.vendor-id" : GENERIC_VENDOR_ID as String] + private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", + "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + private static final Map AMX_CONFIG = ["adapters.${AMX}.enabled" : "true", + "adapters.${AMX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + private static final Map OPENX_CONFIG = ["adapters.${OPENX}.enabled" : "true", + "adapters.${OPENX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + + private static final Map OPENX_ALIAS_CONFIG = ["adapters.${OPENX}.aliases.${OPENX_ALIAS}.enabled" : "true", + "adapters.${OPENX}.aliases.${OPENX_ALIAS}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] @Shared protected static PrebidServerService pbsServiceWithMultipleModules @@ -48,10 +73,17 @@ class ModuleBaseSpec extends BaseSpec { prebidCache.setResponse() bidder.setResponse() pbsServiceWithMultipleModules = pbsServiceFactory.getService( - IX_CONFIG + + ['datacenter-region': CONFIG_DATA_CENTER] + + EXTERNAL_MODULES_CONFIG + + ENABLED_DEBUG_LOG_MODE + ORTB_ADAPTER_CONFIG + MODIFYING_VAST_CONFIG + - EXTERNAL_MODULES_CONFIG + CACHE_STORAGE_CONFIG + + GENERIC_CONFIG + + IX_CONFIG + + AMX_CONFIG + + OPENX_CONFIG + + OPENX_ALIAS_CONFIG ) } @@ -76,15 +108,24 @@ class ModuleBaseSpec extends BaseSpec { } } - protected static Map getOptableTargetingSettings(boolean isEnabled = true, Endpoint endpoint = OPENRTB2_AUCTION) { - ["hooks.${OPTABLE_TARGETING.code}.enabled": isEnabled as String, - "hooks.modules.${OPTABLE_TARGETING.code}.api-endpoint" : "$networkServiceContainer.rootUri/stored-cache".toString(), - "hooks.modules.${OPTABLE_TARGETING.code}.tenant" : PBSUtils.randomString, - "hooks.modules.${OPTABLE_TARGETING.code}.origin" : PBSUtils.randomString, - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, [(PROCESSED_AUCTION_REQUEST): [OPTABLE_TARGETING]]))] + protected static Map getOptableTargetingSettings(boolean isEnabled = true) { + ["hooks.${OPTABLE_TARGETING.code}.enabled" : isEnabled as String, + "hooks.modules.${OPTABLE_TARGETING.code}.api-endpoint": "$networkServiceContainer.rootUri/stored-cache".toString(), + "hooks.modules.${OPTABLE_TARGETING.code}.tenant" : PBSUtils.randomString, + "hooks.modules.${OPTABLE_TARGETING.code}.origin" : PBSUtils.randomString] .collectEntries { key, value -> [(key.toString()): value.toString()] } } + protected static Map getRulesEngineSettings() { + ["hooks.${PB_RULE_ENGINE.code}.enabled" : "true", + "hooks.${PB_RULE_ENGINE.code}.rule-cache.expire-after-minutes" : "10000", + "hooks.${PB_RULE_ENGINE.code}.rule-cache.max-size" : "20000", + "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-initial-delay-millis": "10000", + "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-max-delay-millis" : "10000", + "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-factor" : "1.2", + "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-jitter" : "1.2"] + } + protected static Account getAccountWithModuleConfig(String accountId, List modulesHooks, Endpoint endpoint = OPENRTB2_AUCTION) { @@ -95,22 +136,6 @@ class ModuleBaseSpec extends BaseSpec { new Account(uuid: accountId, config: accountConfig) } - protected static Map getRequestCorrectionSettings(Endpoint endpoint = OPENRTB2_AUCTION, Stage stage = PROCESSED_AUCTION_REQUEST) { - ["hooks.${PB_REQUEST_CORRECTION.code}.enabled": "true", - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, PB_REQUEST_CORRECTION, [stage]))] - } - - protected static Map getRulesEngineSettings(Endpoint endpoint = OPENRTB2_AUCTION, Stage stage = PROCESSED_AUCTION_REQUEST) { - ["hooks.${PB_RULE_ENGINE.code}.enabled" : "true", - "hooks.${PB_RULE_ENGINE.code}.rule-cache.expire-after-minutes" : "10000", - "hooks.${PB_RULE_ENGINE.code}.rule-cache.max-size" : "20000", - "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-initial-delay-millis": "10000", - "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-max-delay-millis" : "10000", - "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-factor" : "1.2", - "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-jitter" : "1.2", - "hooks.host-execution-plan" : encode(ExecutionPlan.getSingleEndpointExecutionPlan(endpoint, PB_RULE_ENGINE, [stage]))] - } - protected static List getAnalyticResults(BidResponse response) { response.ext.prebid.modules?.trace?.stages?.first() ?.outcomes?.first()?.groups?.first() diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy index 128b00312ee..3d551a00139 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy @@ -3,6 +3,7 @@ package org.prebid.server.functional.tests.module.optabletargeting import org.prebid.server.functional.model.config.AccountConfig import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.IdentifierType +import org.prebid.server.functional.model.config.ModuleHookImplementation import org.prebid.server.functional.model.config.OperatingSystem import org.prebid.server.functional.model.config.OptableTargetingConfig import org.prebid.server.functional.model.config.PbsModulesConfig @@ -14,13 +15,13 @@ import org.prebid.server.functional.model.request.auction.Eid import org.prebid.server.functional.model.request.auction.Geo import org.prebid.server.functional.model.request.auction.PublicCountryIp import org.prebid.server.functional.model.request.auction.User -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.testcontainers.scaffolding.StoredCache import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils import static org.apache.commons.codec.binary.Base64.encodeBase64 import static org.mockserver.model.HttpStatusCode.NOT_FOUND_404 +import static org.prebid.server.functional.model.config.ModuleHookImplementation.OPTABLE_TARGETING_PROCESSED_AUCTION_REQUEST import static org.prebid.server.functional.model.config.ModuleName.OPTABLE_TARGETING import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer @@ -36,23 +37,10 @@ class CacheStorageSpec extends ModuleBaseSpec { private static final StoredCache storedCache = new StoredCache(networkServiceContainer) - private static final Map CACHE_STORAGE_CONFIG = ['storage.pbc.path' : "$networkServiceContainer.rootUri/stored-cache".toString(), - 'storage.pbc.call-timeout-ms': '1000', - 'storage.pbc.enabled' : 'true', - 'cache.module.enabled' : 'true', - 'pbc.api.key' : PBSUtils.randomString, - 'cache.api-key-secured' : 'false'] - private static final Map MODULE_STORAGE_CACHE_CONFIG = getOptableTargetingSettings() + CACHE_STORAGE_CONFIG - private static final PrebidServerService prebidServerStoredCacheService = pbsServiceFactory.getService(MODULE_STORAGE_CACHE_CONFIG) - def setup() { storedCache.reset() } - def cleanupSpec() { - pbsServiceFactory.removeContainer(MODULE_STORAGE_CACHE_CONFIG) - } - def "PBS should update error metrics when no cached requests present"() { given: "Default BidRequest with cache and device info" def randomIfa = PBSUtils.randomString @@ -65,13 +53,13 @@ class CacheStorageSpec extends ModuleBaseSpec { accountDao.save(account) and: "Flash metrics" - flushMetrics(prebidServerStoredCacheService) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - prebidServerStoredCacheService.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should update metrics for new saved text storage cache" - def metrics = prebidServerStoredCacheService.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[METRIC_CREATIVE_READ_ERR] == 1 and: "No updates for success metrics" @@ -96,13 +84,13 @@ class CacheStorageSpec extends ModuleBaseSpec { storedCache.setCachingResponse(NOT_FOUND_404) and: "Flash metrics" - flushMetrics(prebidServerStoredCacheService) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - prebidServerStoredCacheService.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should update error metrics" - def metrics = prebidServerStoredCacheService.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[METRIC_CREATIVE_WRITE_ERR] == 1 and: "No updates for success metrics" @@ -111,7 +99,7 @@ class CacheStorageSpec extends ModuleBaseSpec { def "PBS should update metrics for new saved text storage cache when no cached requests"() { given: "Current value of metric prebid cache" - def okInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_WRITE_OK) + def okInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_WRITE_OK) and: "Default BidRequest with cache and device info" def randomIfa = PBSUtils.randomString @@ -128,13 +116,13 @@ class CacheStorageSpec extends ModuleBaseSpec { storedCache.setCachingResponse() and: "Flash metrics" - flushMetrics(prebidServerStoredCacheService) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - prebidServerStoredCacheService.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should update metrics for new saved text storage cache" - def metrics = prebidServerStoredCacheService.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[METRIC_CREATIVE_SIZE_TEXT] == new String(encodeBase64(encode(targetingResult).bytes)).size() assert metrics[METRIC_CREATIVE_WRITE_OK] == okInitialValue + 1 @@ -144,11 +132,11 @@ class CacheStorageSpec extends ModuleBaseSpec { def "PBS should update metrics for stored cached requests cache when proper record present"() { given: "Current value of metric prebid cache" - def textInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_SIZE_TEXT) - def ttlInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_TTL_TEXT) - def writeInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_WRITE_OK) - def readErrorInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_READ_ERR) - def writeErrorInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_WRITE_ERR) + def textInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_SIZE_TEXT) + def ttlInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_TTL_TEXT) + def writeInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_WRITE_OK) + def readErrorInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_READ_ERR) + def writeErrorInitialValue = getCurrentMetricValue(pbsServiceWithMultipleModules, METRIC_CREATIVE_WRITE_ERR) and: "Default BidRequest with cache and device info" def randomIfa = PBSUtils.randomString @@ -165,13 +153,13 @@ class CacheStorageSpec extends ModuleBaseSpec { storedCache.setCachingResponse() and: "Flash metrics" - flushMetrics(prebidServerStoredCacheService) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - prebidServerStoredCacheService.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBS should update metrics for stored cached requests" - def metrics = prebidServerStoredCacheService.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[METRIC_CREATIVE_READ_OK] == 1 and: "No updates for new saved text storage metrics" @@ -199,9 +187,8 @@ class CacheStorageSpec extends ModuleBaseSpec { private static Account createAccountWithRequestCorrectionConfig(BidRequest bidRequest, OptableTargetingConfig optableTargetingConfig) { - def pbsModulesConfig = new PbsModulesConfig(optableTargeting: optableTargetingConfig) - def accountHooksConfig = new AccountHooksConfiguration(modules: pbsModulesConfig) - def accountConfig = new AccountConfig(hooks: accountHooksConfig) - new Account(uuid: bidRequest.accountId, config: accountConfig) + getAccountWithModuleConfig(bidRequest.accountId, [OPTABLE_TARGETING_PROCESSED_AUCTION_REQUEST]).tap { + it.config.hooks.modules.optableTargeting = optableTargetingConfig + } } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy index a4cc7a15556..b07003a0fbb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineAliasSpec.groovy @@ -35,7 +35,7 @@ class RuleEngineAliasSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.size() == 1 @@ -97,7 +97,7 @@ class RuleEngineAliasSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -157,7 +157,7 @@ class RuleEngineAliasSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seat" assert bidResponse.seatbid.seat == [ALIAS] @@ -219,7 +219,7 @@ class RuleEngineAliasSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy index 2326be54ddf..1ac39666347 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineBaseSpec.groovy @@ -3,10 +3,7 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.bidder.BidderName import org.prebid.server.functional.model.bidder.Generic import org.prebid.server.functional.model.bidder.Openx -import org.prebid.server.functional.model.config.AccountConfig -import org.prebid.server.functional.model.config.AccountHooksConfiguration import org.prebid.server.functional.model.config.PbRulesEngine -import org.prebid.server.functional.model.config.PbsModulesConfig import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.pricefloors.Country import org.prebid.server.functional.model.request.auction.Amx @@ -16,7 +13,6 @@ import org.prebid.server.functional.model.request.auction.DistributionChannel import org.prebid.server.functional.model.request.auction.Geo import org.prebid.server.functional.model.request.auction.Imp import org.prebid.server.functional.model.request.auction.ImpUnitCode -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.module.ModuleBaseSpec import org.prebid.server.functional.util.PBSUtils @@ -37,13 +33,10 @@ import static org.prebid.server.functional.model.request.auction.ImpUnitCode.PB_ import static org.prebid.server.functional.model.request.auction.ImpUnitCode.STORED_REQUEST import static org.prebid.server.functional.model.request.auction.ImpUnitCode.TAG_ID import static org.prebid.server.functional.model.request.auction.TraceLevel.VERBOSE -import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer -import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID abstract class RuleEngineBaseSpec extends ModuleBaseSpec { protected static final List MULTI_BID_ADAPTERS = [GENERIC, OPENX, AMX].sort() - protected static final String APPLIED_FOR_ALL_IMPS = "*" protected static final String DEFAULT_CONDITIONS = "default" protected final static String CALL_METRIC = "modules.module.${PB_RULE_ENGINE.code}.stage.${PROCESSED_AUCTION_REQUEST.metricValue}.hook.${PB_RULES_ENGINE_PROCESSED_AUCTION_REQUEST.code}.call" protected final static String NOOP_METRIC = "modules.module.${PB_RULE_ENGINE.code}.stage.${PROCESSED_AUCTION_REQUEST.metricValue}.hook.${PB_RULES_ENGINE_PROCESSED_AUCTION_REQUEST.code}.success.noop" @@ -72,23 +65,6 @@ abstract class RuleEngineBaseSpec extends ModuleBaseSpec { "Field '$functionType.fieldName' is required and has to be an array of integers" } - protected static final Map ENABLED_DEBUG_LOG_MODE = ["logging.level.root": "debug"] - protected static final Map OPENX_CONFIG = ["adapters.${OPENX}.enabled" : "true", - "adapters.${OPENX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - protected static final Map AMX_CONFIG = ["adapters.${AMX}.enabled" : "true", - "adapters.${AMX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - protected static final Map OPENX_ALIAS_CONFIG = ["adapters.${OPENX}.aliases.${OPENX_ALIAS}.enabled" : "true", - "adapters.${OPENX}.aliases.${OPENX_ALIAS}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - protected static final String CONFIG_DATA_CENTER = PBSUtils.randomString - private static final String USER_SYNC_URL = "$networkServiceContainer.rootUri/generic-usersync" - private static final Map GENERIC_CONFIG = [ - "adapters.${GENERIC.value}.usersync.redirect.url" : USER_SYNC_URL, - "adapters.${GENERIC.value}.usersync.redirect.support-cors": false as String, - "adapters.${GENERIC.value}.meta-info.vendor-id" : GENERIC_VENDOR_ID as String] - protected static final PrebidServerService pbsServiceWithRulesEngineModule = pbsServiceFactory.getService(GENERIC_CONFIG + - getRulesEngineSettings() + AMX_CONFIG + OPENX_CONFIG + OPENX_ALIAS_CONFIG + ['datacenter-region': CONFIG_DATA_CENTER] + - ENABLED_DEBUG_LOG_MODE) - protected static BidRequest getDefaultBidRequestWithMultiplyBidders(DistributionChannel distributionChannel = SITE) { BidRequest.getDefaultBidRequest(distributionChannel).tap { it.tmax = 5_000 // prevents timeout issues on slow pipelines @@ -116,8 +92,9 @@ abstract class RuleEngineBaseSpec extends ModuleBaseSpec { } protected static Account getAccountWithRulesEngine(String accountId, PbRulesEngine ruleEngine) { - def accountHooksConfiguration = new AccountHooksConfiguration(modules: new PbsModulesConfig(pbRuleEngine: ruleEngine)) - new Account(uuid: accountId, config: new AccountConfig(hooks: accountHooksConfiguration)) + getAccountWithModuleConfig(accountId, [PB_RULES_ENGINE_PROCESSED_AUCTION_REQUEST]).tap { + it.config.hooks.modules.pbRuleEngine = ruleEngine + } } protected static BidRequest createBidRequestWithDomains(DistributionChannel type, String domain, boolean usePublisher = true) { @@ -180,15 +157,15 @@ abstract class RuleEngineBaseSpec extends ModuleBaseSpec { protected static waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) { PBSUtils.waitUntil({ - pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) - pbsServiceWithRulesEngineModule.isContainLogsByValue("Successfully parsed rule-engine config for account $bidRequest.accountId") + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.isContainLogsByValue("Successfully parsed rule-engine config for account $bidRequest.accountId") }) } protected static waitUntilFailedParsedAndCacheAccount(bidRequest) { PBSUtils.waitUntil({ - pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) - pbsServiceWithRulesEngineModule.isContainLogsByValue("Failed to parse rule-engine config for account $bidRequest.accountId") + pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) + pbsServiceWithMultipleModules.isContainLogsByValue("Failed to parse rule-engine config for account $bidRequest.accountId") }) } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy index 3b9b96c479f..e82a78754da 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineContextSpec.groovy @@ -62,7 +62,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -122,7 +122,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -164,7 +164,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -229,7 +229,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -274,7 +274,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -293,7 +293,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, DOMAIN_IN)) where: @@ -339,7 +339,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -405,7 +405,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -468,7 +468,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -530,7 +530,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -574,7 +574,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -593,7 +593,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { assert !bidResponse.ext?.errors then: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, BUNDLE_IN)) } @@ -620,7 +620,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -682,7 +682,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -724,7 +724,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -743,7 +743,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) then: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, MEDIA_TYPE_IN)) where: @@ -774,7 +774,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -834,7 +834,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -882,7 +882,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -953,7 +953,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -1006,7 +1006,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -1025,7 +1025,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, AD_UNIT_CODE_IN)) where: @@ -1062,7 +1062,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -1125,7 +1125,7 @@ class RuleEngineContextSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy index 58b6e2d5a01..ab264a09c27 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineCoreSpec.groovy @@ -45,10 +45,10 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) and: "Flush metric" - flushMetrics(pbsServiceWithRulesEngineModule) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Response should contain seat bid" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -64,7 +64,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { assert !bidResponse.ext?.errors and: "PBs should populate call and update metrics" - def metrics = pbsServiceWithRulesEngineModule.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[CALL_METRIC] == 1 assert metrics[UPDATE_METRIC] == 1 @@ -95,7 +95,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [OPENX, AMX].sort() @@ -159,7 +159,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [OPENX, AMX].sort() @@ -212,7 +212,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.size() == 0 @@ -245,7 +245,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -278,7 +278,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat == [OPENX] @@ -338,7 +338,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seatBids" assert bidResponse.seatbid.seat.sort() == [OPENX, AMX].sort() @@ -397,7 +397,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat == [GENERIC] @@ -455,7 +455,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -487,7 +487,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { it.values.resultFunction == groups.rules.first.results.first.function.value it.values.conditionFired == groups.rules.first.conditions.first - it.appliedTo.impIds == [APPLIED_FOR_ALL_IMPS] + it.appliedTo.impIds == [WILDCARD] } verifyAll(impResult) { @@ -514,7 +514,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Response should contain seat bid" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -578,7 +578,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Response should contain seat bid" assert bidResponse.seatbid.seat.sort() == [GENERIC, OPENX].sort() @@ -646,7 +646,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [OPENX, AMX].sort() @@ -706,7 +706,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -766,7 +766,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -797,7 +797,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { it.values.analyticsValue == analyticsValue it.values.resultFunction == LOG_A_TAG.value it.values.conditionFired == DEFAULT_CONDITIONS - it.appliedTo.impIds == [APPLIED_FOR_ALL_IMPS] + it.appliedTo.impIds == [WILDCARD] } and: "Analytics imp result shouldn't contain remove info" @@ -826,7 +826,7 @@ class RuleEngineCoreSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain two seat" assert bidResponse.seatbid.size() == 2 diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy index 5500ba3c09a..3891eafd32c 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineDeviceSpec.groovy @@ -46,7 +46,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -108,7 +108,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -150,7 +150,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -213,7 +213,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -257,7 +257,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -276,7 +276,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, DEVICE_COUNTRY_IN)) } @@ -305,7 +305,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -324,7 +324,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_INTEGERS_LOG_WARNING(bidRequest.accountId, DEVICE_TYPE_IN)) } @@ -351,7 +351,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -413,7 +413,7 @@ class RuleEngineDeviceSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy index 72f8ee83173..a312d9978ad 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy @@ -42,7 +42,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -61,7 +61,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, DATA_CENTER_IN)) } @@ -85,7 +85,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -145,7 +145,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -184,7 +184,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -244,7 +244,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy index 49b90352640..367027fc609 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEnginePrivacySpec.groovy @@ -59,7 +59,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -121,7 +121,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -168,7 +168,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -187,7 +187,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_STRINGS_LOG_WARNING(bidRequest.accountId, EID_IN)) } @@ -214,7 +214,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -276,7 +276,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -314,7 +314,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -378,7 +378,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -417,7 +417,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -493,7 +493,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -555,7 +555,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -614,7 +614,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -661,7 +661,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -680,7 +680,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_INTEGERS_LOG_WARNING(bidRequest.accountId, GPP_SID_IN)) } @@ -706,7 +706,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -771,7 +771,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -819,7 +819,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -890,7 +890,7 @@ class RuleEnginePrivacySpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy index a504f7ca37a..416590b010f 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSpecialSpec.groovy @@ -40,7 +40,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -59,7 +59,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { assert !bidResponse.ext?.errors and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_SINGLE_INTEGER_LOG_WARNING(bidRequest.accountId, PERCENT)) } @@ -83,7 +83,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -143,7 +143,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -188,7 +188,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -207,7 +207,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, INVALID_CONFIGURATION_FOR_SINGLE_STRING_LOG_WARNING(bidRequest.accountId, PREBID_KEY)) } @@ -236,7 +236,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [GENERIC, AMX].sort() @@ -300,7 +300,7 @@ class RuleEngineSpecialSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy index b62f1cff541..0f902b7b31b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineSyncSpec.groovy @@ -36,7 +36,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest, cookieHeader) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest, cookieHeader) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == [OPENX, AMX] @@ -93,7 +93,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest, cookieHeader) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest, cookieHeader) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -129,7 +129,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -168,7 +168,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest, cookieHeader) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest, cookieHeader) then: "Bid response shouldn't contain seat" assert bidResponse.seatbid.seat == [GENERIC] @@ -228,7 +228,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest, cookieHeader) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest, cookieHeader) then: "Bid response shouldn't contain seat" assert !bidResponse.seatbid.seat @@ -278,7 +278,7 @@ class RuleEngineSyncSpec extends RuleEngineBaseSpec { accountDao.save(accountWithRulesEngine) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineValidationSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineValidationSpec.groovy index dbf7395c1f0..6cc940023b9 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineValidationSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineValidationSpec.groovy @@ -35,10 +35,10 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) and: "Flush metrics" - flushMetrics(pbsServiceWithRulesEngineModule) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -57,7 +57,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "PBs should populate call and noop metrics" - def metrics = pbsServiceWithRulesEngineModule.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[CALL_METRIC] == 1 assert metrics[NOOP_METRIC] == 1 @@ -89,10 +89,10 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) and: "Flush metrics" - flushMetrics(pbsServiceWithRulesEngineModule) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -111,7 +111,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "PBs should populate noop metrics" - def metrics = pbsServiceWithRulesEngineModule.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[NOOP_METRIC] == 1 } @@ -130,10 +130,10 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) and: "Flush metrics" - flushMetrics(pbsServiceWithRulesEngineModule) + flushMetrics(pbsServiceWithMultipleModules) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -149,7 +149,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS and: "PBs should populate failer metrics" - def metrics = pbsServiceWithRulesEngineModule.sendCollectedMetricsRequest() + def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[NOOP_METRIC] == 1 } @@ -171,7 +171,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -187,7 +187,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS and: "PBs should emit failed logs" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, "Failed to parse rule-engine config for account $bidRequest.accountId:" + " Weighted list cannot be empty") } @@ -209,7 +209,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -239,7 +239,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { accountDao.save(accountWithRulesEngine) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -278,7 +278,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilSuccessfullyParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -312,7 +312,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { accountDao.save(accountWithRulesEngine) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -331,7 +331,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "PBs should emit failed logs" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, "Parsing rule for account $bidRequest.accountId").size() == 1 } @@ -357,7 +357,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "Bid response should contain seats" assert bidResponse.seatbid.seat.sort() == MULTI_BID_ADAPTERS @@ -376,7 +376,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) and: "PBS should emit log" - def logsByTime = pbsServiceWithRulesEngineModule.getLogsByTime(start) + def logsByTime = pbsServiceWithMultipleModules.getLogsByTime(start) assert getLogsByText(logsByTime, "Failed to parse rule-engine config for account $bidRequest.accountId:" + " Weight must be greater than zero") @@ -407,7 +407,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { waitUntilFailedParsedAndCacheAccount(bidRequest) when: "PBS processes auction request" - def bidResponse = pbsServiceWithRulesEngineModule.sendAuctionRequest(bidRequest) + def bidResponse = pbsServiceWithMultipleModules.sendAuctionRequest(bidRequest) then: "PBs should perform bidder request" assert bidder.getBidderRequests(bidRequest.id) @@ -426,7 +426,7 @@ class RuleEngineValidationSpec extends RuleEngineBaseSpec { assert !bidResponse.ext?.errors and: "Logs should contain error" - def logs = pbsServiceWithRulesEngineModule.getLogsByTime(startTime) + def logs = pbsServiceWithMultipleModules.getLogsByTime(startTime) assert getLogsByText(logs, "Failed to parse rule-engine config for account ${bidRequest.accountId}: " + "Function '${function.value}' configuration is invalid: No arguments allowed") From de083663c4e94d59d25f273f5419f6bd2c670a05 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Mon, 3 Nov 2025 18:50:47 +0200 Subject: [PATCH 18/24] fix gpp error --- .../functional/tests/privacy/GppAuctionSpec.groovy | 2 +- .../functional/tests/privacy/GppCookieSyncSpec.groovy | 1 - .../tests/privacy/GppSyncUserActivitiesSpec.groovy | 2 +- .../tests/privacy/GppTransmitEidsActivitiesSpec.groovy | 4 ++-- .../tests/privacy/GppTransmitUfpdActivitiesSpec.groovy | 4 ++-- .../functional/tests/privacy/PrivacyBaseSpec.groovy | 10 ++++++++++ 6 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppAuctionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppAuctionSpec.groovy index 4eb78ee2140..7d918287220 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppAuctionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppAuctionSpec.groovy @@ -108,7 +108,7 @@ class GppAuctionSpec extends PrivacyBaseSpec { def "PBS should emit warning when GPP string is invalid"() { given: "Default bid request with invalid gpp" - def invalidGpp = "Invalid_GPP_Consent_String" + def invalidGpp = invalidGppString def bidRequest = BidRequest.defaultBidRequest.tap { regs = new Regs(gpp: invalidGpp) } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy index a5a6a13ca09..fb880039585 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy @@ -18,7 +18,6 @@ import org.prebid.server.functional.util.privacy.CcpaConsent import org.prebid.server.functional.util.privacy.TcfConsent import org.prebid.server.functional.util.privacy.gpp.TcfEuV2Consent import org.prebid.server.functional.util.privacy.gpp.UsV1Consent -import spock.lang.IgnoreRest import static org.prebid.server.functional.model.bidder.BidderName.ALIAS import static org.prebid.server.functional.model.bidder.BidderName.GENERIC diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy index 2303bfc9e5f..b78f78f1fc8 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy @@ -533,7 +533,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync call when privacy module contain invalid GPP string should respond with required bidder URL and emit warning in response"() { given: "Cookie sync request with link to account" def accountId = PBSUtils.randomString - def invalidGpp = PBSUtils.randomString + def invalidGpp = invalidGppString def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { it.gppSid = US_NAT_V1.value it.account = accountId diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy index 41e1079986d..4f1d4be16ed 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy @@ -897,7 +897,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { def "PBS auction call when privacy module contain invalid GPP string shouldn't remove EIDS fields in request and emit warning in response"() { given: "Default Generic BidRequests with EIDS fields and account id" def accountId = PBSUtils.randomNumber as String - def invalidGpp = PBSUtils.randomString + def invalidGpp = invalidGppString def bidRequest = getBidRequestWithPersonalData(accountId).tap { regs.gppSid = [US_NAT_V1.intValue] regs.gpp = invalidGpp @@ -2023,7 +2023,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { def ampStoredRequest = getBidRequestWithPersonalData(accountId) and: "Default amp request with link to account" - def invalidGpp = PBSUtils.randomString + def invalidGpp = invalidGppString def ampRequest = AmpRequest.defaultAmpRequest.tap { it.account = accountId it.gppSid = US_NAT_V1.value diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy index d75a38784e8..c361fa63846 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy @@ -1182,7 +1182,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { def "PBS auction call when privacy module contain invalid GPP string shouldn't remove UFPD fields in request and emit warning in response"() { given: "Default Generic BidRequests with UFPD fields and account id" def accountId = PBSUtils.randomNumber as String - def invalidGpp = PBSUtils.randomString + def invalidGpp = invalidGppString def bidRequest = getBidRequestWithPersonalData(accountId).tap { regs.gppSid = [US_NAT_V1.intValue] regs.gpp = invalidGpp @@ -2651,7 +2651,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { def ampStoredRequest = getBidRequestWithPersonalData(accountId) and: "Default amp request with link to account" - def invalidGpp = PBSUtils.randomString + def invalidGpp = invalidGppString def ampRequest = AmpRequest.defaultAmpRequest.tap { it.account = accountId it.gppSid = US_NAT_V1.value diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy index 9cdeab282b3..3b950ba4a32 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy @@ -581,6 +581,16 @@ abstract class PrivacyBaseSpec extends BaseSpec { }) } + protected static String getInvalidGppString(int stringLength = 20) { + // Random string can potentially generate deprecated v1 value with specific starting values + def gppV1Prefix = ['A', 'B', 'C', 'D'] + def invalidGPPValue + do { + invalidGPPValue = PBSUtils.getRandomString(stringLength) + } while (gppV1Prefix.contains(invalidGPPValue[0].toUpperCase())) + return invalidGPPValue + } + private static Purpose getRandomPurposeWithExclusion(Purpose excludeFromRandom) { def availablePurposes = Purpose.values().toList() - excludeFromRandom availablePurposes.shuffled().first() From 6f32685dfd595ad72724ca5b3e74e1efd7f93638 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Fri, 7 Nov 2025 10:18:45 +0200 Subject: [PATCH 19/24] update module tests --- .../functional/model/config/ModuleName.groovy | 8 +- .../tests/module/ModuleBaseSpec.groovy | 86 +++++++++++-------- .../RuleEngineInfrastructureSpec.groovy | 7 +- .../server/functional/util/PBSUtils.groovy | 2 +- 4 files changed, 56 insertions(+), 47 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy b/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy index 3e5a8368928..9632eccbbfa 100644 --- a/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy +++ b/src/test/groovy/org/prebid/server/functional/model/config/ModuleName.groovy @@ -4,12 +4,12 @@ import com.fasterxml.jackson.annotation.JsonValue enum ModuleName { - PB_RICHMEDIA_FILTER("pb-richmedia-filter"), - PB_RESPONSE_CORRECTION ("pb-response-correction"), - ORTB2_BLOCKING("ortb2-blocking"), + PB_RICHMEDIA_FILTER('pb-richmedia-filter'), + PB_RESPONSE_CORRECTION ('pb-response-correction'), + ORTB2_BLOCKING('ortb2-blocking'), PB_REQUEST_CORRECTION('pb-request-correction'), OPTABLE_TARGETING('optable-targeting'), - PB_RULE_ENGINE('pb-rule-engine') + PB_RULE_ENGINE('pb-rule-engine'), @JsonValue final String code diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy index bf911d38e64..e2e08fd662e 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ModuleBaseSpec.groovy @@ -8,63 +8,69 @@ import org.prebid.server.functional.model.config.ModuleHookImplementation import org.prebid.server.functional.model.config.ModuleName import org.prebid.server.functional.model.config.PbsModulesConfig import org.prebid.server.functional.model.db.Account -import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.model.response.auction.AnalyticResult import org.prebid.server.functional.model.response.auction.BidResponse +import org.prebid.server.functional.service.PrebidServerService import org.prebid.server.functional.tests.BaseSpec -import spock.lang.Shared import org.prebid.server.functional.util.PBSUtils +import spock.lang.Shared import static org.prebid.server.functional.model.bidder.BidderName.AMX import static org.prebid.server.functional.model.bidder.BidderName.GENERIC +import static org.prebid.server.functional.model.bidder.BidderName.IX import static org.prebid.server.functional.model.bidder.BidderName.OPENX import static org.prebid.server.functional.model.bidder.BidderName.OPENX_ALIAS +import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.model.config.ModuleHookImplementation.PB_RICHMEDIA_FILTER_ALL_PROCESSED_RESPONSES import static org.prebid.server.functional.model.config.ModuleName.OPTABLE_TARGETING import static org.prebid.server.functional.model.config.ModuleName.ORTB2_BLOCKING +import static org.prebid.server.functional.model.config.ModuleName.PB_REQUEST_CORRECTION import static org.prebid.server.functional.model.config.ModuleName.PB_RESPONSE_CORRECTION import static org.prebid.server.functional.model.config.ModuleName.PB_RICHMEDIA_FILTER -import static org.prebid.server.functional.model.config.ModuleName.PB_REQUEST_CORRECTION import static org.prebid.server.functional.model.config.ModuleName.PB_RULE_ENGINE -import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer import static org.prebid.server.functional.util.privacy.TcfConsent.GENERIC_VENDOR_ID class ModuleBaseSpec extends BaseSpec { protected static final String WILDCARD = '*' - protected static final String CONFIG_DATA_CENTER = PBSUtils.randomString - protected final static Map EXTERNAL_MODULES_CONFIG = getModuleBaseSettings(PB_RICHMEDIA_FILTER) + - getModuleBaseSettings(PB_RESPONSE_CORRECTION) + - getModuleBaseSettings(ORTB2_BLOCKING) + - getModuleBaseSettings(PB_REQUEST_CORRECTION) + - getOptableTargetingSettings() + - getRulesEngineSettings() + protected static final String RANDOM_DATACENTER_REGION = PBSUtils.randomString + + protected static final Map GENERIC_CONFIG = [ + "adapters.${GENERIC.value}.usersync.redirect.url" : "$networkServiceContainer.rootUri/generic-usersync".toString(), + "adapters.${GENERIC.value}.usersync.redirect.support-cors": 'false', + "adapters.${GENERIC.value}.meta-info.vendor-id" : GENERIC_VENDOR_ID.toString()] + + protected static final Map IX_CONFIG = ["adapters.${IX}.enabled" : "true", + "adapters.${IX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + protected static final Map AMX_CONFIG = ["adapters.${AMX}.enabled" : "true", + "adapters.${AMX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + protected static final Map OPENX_CONFIG = ["adapters.${OPENX}.enabled" : "true", + "adapters.${OPENX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + + protected static final Map OPENX_ALIAS_CONFIG = ["adapters.${OPENX}.aliases.${OPENX_ALIAS}.enabled" : "true", + "adapters.${OPENX}.aliases.${OPENX_ALIAS}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] private static final Map ENABLED_DEBUG_LOG_MODE = ["logging.level.root": "debug"] + private static final Map ORTB_ADAPTER_CONFIG = ['adapter-defaults.ortb.multiformat-supported': 'false'] + private static final Map MODIFYING_VAST_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", "adapters.generic.modifying-vast-xml-allowed": "false"] + private static final Map CACHE_STORAGE_CONFIG = ['storage.pbc.path' : "$networkServiceContainer.rootUri/stored-cache".toString(), 'storage.pbc.call-timeout-ms': '1000', 'storage.pbc.enabled' : 'true', 'cache.module.enabled' : 'true', 'pbc.api.key' : PBSUtils.randomString, 'cache.api-key-secured' : 'false'] - private static final String USER_SYNC_URL = "$networkServiceContainer.rootUri/generic-usersync" - private static final Map GENERIC_CONFIG = [ - "adapters.${GENERIC.value}.usersync.redirect.url" : USER_SYNC_URL, - "adapters.${GENERIC.value}.usersync.redirect.support-cors": false as String, - "adapters.${GENERIC.value}.meta-info.vendor-id" : GENERIC_VENDOR_ID as String] - private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", - "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - private static final Map AMX_CONFIG = ["adapters.${AMX}.enabled" : "true", - "adapters.${AMX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - private static final Map OPENX_CONFIG = ["adapters.${OPENX}.enabled" : "true", - "adapters.${OPENX}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - - private static final Map OPENX_ALIAS_CONFIG = ["adapters.${OPENX}.aliases.${OPENX_ALIAS}.enabled" : "true", - "adapters.${OPENX}.aliases.${OPENX_ALIAS}.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + + protected final static Map EXTERNAL_MODULES_CONFIG = getModuleBaseSettings(PB_RICHMEDIA_FILTER) + + getModuleBaseSettings(PB_RESPONSE_CORRECTION) + + getModuleBaseSettings(ORTB2_BLOCKING) + + getModuleBaseSettings(PB_REQUEST_CORRECTION) + + getOptableTargetingSettings() + + getRulesEngineSettings() @Shared protected static PrebidServerService pbsServiceWithMultipleModules @@ -72,19 +78,7 @@ class ModuleBaseSpec extends BaseSpec { def setupSpec() { prebidCache.setResponse() bidder.setResponse() - pbsServiceWithMultipleModules = pbsServiceFactory.getService( - ['datacenter-region': CONFIG_DATA_CENTER] + - EXTERNAL_MODULES_CONFIG + - ENABLED_DEBUG_LOG_MODE + - ORTB_ADAPTER_CONFIG + - MODIFYING_VAST_CONFIG + - CACHE_STORAGE_CONFIG + - GENERIC_CONFIG + - IX_CONFIG + - AMX_CONFIG + - OPENX_CONFIG + - OPENX_ALIAS_CONFIG - ) + pbsServiceWithMultipleModules = pbsServiceFactory.getService(getDefaultMultipleModulesConfig()) } def cleanupSpec() { @@ -93,6 +87,21 @@ class ModuleBaseSpec extends BaseSpec { repository.removeAllDatabaseData() } + protected Map getDefaultMultipleModulesConfig() { + ['datacenter-region': RANDOM_DATACENTER_REGION] + + EMPTY_CACHE_TTL_CONFIG + + EXTERNAL_MODULES_CONFIG + + ENABLED_DEBUG_LOG_MODE + + ORTB_ADAPTER_CONFIG + + MODIFYING_VAST_CONFIG + + CACHE_STORAGE_CONFIG + + GENERIC_CONFIG + + IX_CONFIG + + AMX_CONFIG + + OPENX_CONFIG + + OPENX_ALIAS_CONFIG + } + protected static Map getModuleBaseSettings(ModuleName name, boolean isEnabled = true) { [("hooks.${name.code}.enabled".toString()): isEnabled as String] } @@ -124,6 +133,7 @@ class ModuleBaseSpec extends BaseSpec { "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-max-delay-millis" : "10000", "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-factor" : "1.2", "hooks.${PB_RULE_ENGINE.code}.rule-parsing.retry-exponential-jitter" : "1.2"] + .collectEntries { key, value -> [(key.toString()): value.toString()] } } protected static Account getAccountWithModuleConfig(String accountId, diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy index a312d9978ad..dd7dcd2bdc6 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/RuleEngineInfrastructureSpec.groovy @@ -2,7 +2,6 @@ package org.prebid.server.functional.tests.module.pbruleengine import org.prebid.server.functional.model.config.RuleEngineFunctionArgs import org.prebid.server.functional.model.config.RuleEngineModelSchema -import org.prebid.server.functional.model.response.auction.AnalyticTagStatus import org.prebid.server.functional.util.PBSUtils import java.time.Instant @@ -30,7 +29,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { def pbRuleEngine = createRulesEngineWithRule().tap { it.ruleSets[0].modelGroups[0].schema[0].tap { it.function = DATA_CENTER_IN - it.args = new RuleEngineFunctionArgs(countries: [CONFIG_DATA_CENTER]) + it.args = new RuleEngineFunctionArgs(countries: [RANDOM_DATACENTER_REGION]) } } @@ -73,7 +72,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { def pbRuleEngine = createRulesEngineWithRule().tap { it.ruleSets[0].modelGroups[0].schema[0].tap { it.function = DATA_CENTER_IN - it.args = new RuleEngineFunctionArgs(datacenters: [CONFIG_DATA_CENTER]) + it.args = new RuleEngineFunctionArgs(datacenters: [RANDOM_DATACENTER_REGION]) } } @@ -172,7 +171,7 @@ class RuleEngineInfrastructureSpec extends RuleEngineBaseSpec { def pbRuleEngine = createRulesEngineWithRule().tap { it.ruleSets[0].modelGroups[0].tap { schema = [new RuleEngineModelSchema(function: DATA_CENTER)] - rules[0].conditions = [CONFIG_DATA_CENTER] + rules[0].conditions = [RANDOM_DATACENTER_REGION] } } diff --git a/src/test/groovy/org/prebid/server/functional/util/PBSUtils.groovy b/src/test/groovy/org/prebid/server/functional/util/PBSUtils.groovy index 748071dd10f..46633e32453 100644 --- a/src/test/groovy/org/prebid/server/functional/util/PBSUtils.groovy +++ b/src/test/groovy/org/prebid/server/functional/util/PBSUtils.groovy @@ -48,7 +48,7 @@ class PBSUtils implements ObjectMapperWrapper { static String getRandomString(int stringLength = 20) { RandomStringUtils.randomAlphanumeric(stringLength) - } + } static String getRandomSpecialChars(int stringLength = 20) { RandomStringUtils.random(stringLength, "!@#\$%^&*()-_=+[]{}|;:'\",.<>/?") From 82c8a7d4d773614f5bbe334aef6b27ae00b22ece Mon Sep 17 00:00:00 2001 From: markiian Date: Tue, 2 Dec 2025 17:09:25 +0200 Subject: [PATCH 20/24] Move creation of local stack container --- .../server/functional/testcontainers/Dependencies.groovy | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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 70c99a2a833..7f0b697c1dc 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/Dependencies.groovy @@ -37,13 +37,12 @@ class Dependencies { static final NetworkServiceContainer networkServiceContainer = new NetworkServiceContainer(MOCKSERVER_VERSION) .withNetwork(network) - static LocalStackContainer localStackContainer + static LocalStackContainer localStackContainer = new LocalStackContainer(DockerImageName.parse("localstack/localstack:s3-latest")) + .withNetwork(network) + .withServices(S3) static void start() { if (IS_LAUNCH_CONTAINERS) { - localStackContainer = new LocalStackContainer(DockerImageName.parse("localstack/localstack:s3-latest")) - .withNetwork(network) - .withServices(S3) Startables.deepStart([networkServiceContainer, mysqlContainer, localStackContainer]).join() } } From 5761e58bd2122c1179c639283fec47e7481ff7e6 Mon Sep 17 00:00:00 2001 From: markiian Date: Wed, 3 Dec 2025 18:29:20 +0200 Subject: [PATCH 21/24] Removing duplication and add NOOP metrics --- .../tests/module/AbTestingModuleSpec.groovy | 53 +++++-------------- 1 file changed, 13 insertions(+), 40 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index fa45bb59ef2..6c8d05a76cb 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -34,6 +34,7 @@ import static org.prebid.server.functional.model.response.auction.ResponseAction class AbTestingModuleSpec extends ModuleBaseSpec { + private final static String NOOP_METRIC = "modules.module.%s.stage.%s.hook.%s.success.noop" private final static String NO_INVOCATION_METRIC = "modules.module.%s.stage.%s.hook.%s.success.no-invocation" private final static String CALL_METRIC = "modules.module.%s.stage.%s.hook.%s.call" private final static String EXECUTION_ERROR_METRIC = "modules.module.%s.stage.%s.hook.%s.execution-error" @@ -90,8 +91,9 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = ortbModulePbsService.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 + + assert metrics[NOOP_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 + assert metrics[NOOP_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] @@ -130,10 +132,8 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for specified module should be with error call" def metrics = prebidServerService.sendCollectedMetricsRequest() - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert metrics[EXECUTION_ERROR_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[EXECUTION_ERROR_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 @@ -174,8 +174,9 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for specified module should be as default call" def metrics = ortbModulePbsService.sendCollectedMetricsRequest() - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 + assert metrics[NOOP_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 + assert metrics[NOOP_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 + assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 @@ -242,9 +243,9 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for allowed to run response-correction module should be updated based on ab test config" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] + assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] + assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] } def "PBS should apply a/b test config for each module when multiple config are presents and set to skip modules"() { @@ -299,13 +300,12 @@ class AbTestingModuleSpec extends ModuleBaseSpec { assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 + assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 and: "Metric for skipped response-correction module should be updated based on ab test config" assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 + assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] + assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 } def "PBS should apply a/b test config for each module when multiple config are presents with different percentage"() { @@ -364,7 +364,7 @@ class AbTestingModuleSpec extends ModuleBaseSpec { assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] + assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] } def "PBS should ignore accounts property for a/b test config when ab test config specialize for specific account"() { @@ -440,8 +440,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = ortbModulePbsService.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] @@ -584,8 +582,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = ortbModulePbsService.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] @@ -720,8 +716,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = ortbModulePbsService.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] @@ -815,9 +809,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for non specified module should be as default call" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] cleanup: "Stop and remove pbs container" @@ -878,9 +869,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for non specified module should be as default call" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] cleanup: "Stop and remove pbs container" @@ -941,13 +929,9 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 and: "Metric for skipped response-correction module should be updated based on ab test config" assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 cleanup: "Stop and remove pbs container" @@ -999,17 +983,12 @@ class AbTestingModuleSpec extends ModuleBaseSpec { def metrics = pbsServiceWithMultipleModules.sendCollectedMetricsRequest() assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] == 1 - assert metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] and: "Metric for non specified module should be as default call" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] cleanup: "Stop and remove pbs container" @@ -1071,9 +1050,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for non specified module should be as default call" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 2 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 2 - - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] cleanup: "Stop and remove pbs container" @@ -1140,9 +1116,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for non specified module should be as default call" assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - - assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] cleanup: "Stop and remove pbs container" From ef7d3487d6ef7c1a3bfd8070534cf5d0d1b5b90f Mon Sep 17 00:00:00 2001 From: markiian Date: Wed, 3 Dec 2025 23:23:47 +0200 Subject: [PATCH 22/24] Resolve conflict --- .../server/functional/tests/module/AbTestingModuleSpec.groovy | 1 - 1 file changed, 1 deletion(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 6c8d05a76cb..a0b26584678 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -8,7 +8,6 @@ import org.prebid.server.functional.model.config.ExecutionPlan import org.prebid.server.functional.model.config.Stage import org.prebid.server.functional.model.db.Account import org.prebid.server.functional.model.request.auction.BidRequest -import org.prebid.server.functional.model.request.auction.FetchStatus import org.prebid.server.functional.model.request.auction.TraceLevel import org.prebid.server.functional.model.response.auction.AnalyticResult import org.prebid.server.functional.model.response.auction.AnalyticTagStatus From a091b96a0a5ab876a89c9798cc76d582afe55eee Mon Sep 17 00:00:00 2001 From: markiian Date: Thu, 4 Dec 2025 13:04:01 +0200 Subject: [PATCH 23/24] Update: Remove unnecessary metics checks --- .../server/functional/tests/module/AbTestingModuleSpec.groovy | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index a0b26584678..8e8f725fb57 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -244,7 +244,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] } def "PBS should apply a/b test config for each module when multiple config are presents and set to skip modules"() { @@ -303,7 +302,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { and: "Metric for skipped response-correction module should be updated based on ab test config" assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 } @@ -363,7 +361,6 @@ class AbTestingModuleSpec extends ModuleBaseSpec { assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 assert !metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert !metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] } def "PBS should ignore accounts property for a/b test config when ab test config specialize for specific account"() { From 4fb9287fd0306f40221763dfd75442478ad02ad0 Mon Sep 17 00:00:00 2001 From: markiian Date: Thu, 4 Dec 2025 13:19:33 +0200 Subject: [PATCH 24/24] Update: Remove unnecessary metics checks --- .../server/functional/tests/module/AbTestingModuleSpec.groovy | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 8e8f725fb57..1b3b4407b0b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -298,11 +298,9 @@ class AbTestingModuleSpec extends ModuleBaseSpec { assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, BIDDER_REQUEST.metricValue, ORTB2_BLOCKING_BIDDER_REQUEST.code)] assert !metrics[CALL_METRIC.formatted(ModuleName.ORTB2_BLOCKING.code, RAW_BIDDER_RESPONSE.metricValue, ORTB2_BLOCKING_RAW_BIDDER_RESPONSE.code)] assert metrics[NO_INVOCATION_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 - assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 and: "Metric for skipped response-correction module should be updated based on ab test config" assert !metrics[CALL_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] - assert metrics[NOOP_METRIC.formatted(PB_RESPONSE_CORRECTION.code, ALL_PROCESSED_BID_RESPONSES.metricValue, RESPONSE_CORRECTION_ALL_PROCESSED_RESPONSES.code)] == 1 } def "PBS should apply a/b test config for each module when multiple config are presents with different percentage"() {