diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy index 1163c070e1e..c873c1a03f3 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/PbsConfig.groovy @@ -36,6 +36,8 @@ LIMIT 1 "metrics.prefix" : "prebid", "status-response" : "ok", "gdpr.default-value" : "0", + "gdpr.vendorlist.v2.http-endpoint-template" : "$networkServiceContainer.rootUri/v2/vendor-list.json".toString(), + "gdpr.vendorlist.v3.http-endpoint-template" : "$networkServiceContainer.rootUri/v3/vendor-list.json".toString(), "settings.database.account-query" : DB_ACCOUNT_QUERY, "settings.database.stored-requests-query" : "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%) UNION ALL SELECT accountId, impId, impData, 'imp' as dataType FROM stored_imps WHERE impId IN (%IMP_ID_LIST%)", "settings.database.amp-stored-requests-query": "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%)", diff --git a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/VendorList.groovy b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/VendorList.groovy index ec561b073b7..7e1d1e3db07 100644 --- a/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/VendorList.groovy +++ b/src/test/groovy/org/prebid/server/functional/testcontainers/scaffolding/VendorList.groovy @@ -11,6 +11,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.anyRequestedFor import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED +import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR import static org.apache.http.HttpStatus.SC_OK import static org.prebid.server.functional.model.mock.services.vendorlist.GvlSpecificationVersion.V2 import static org.prebid.server.functional.model.mock.services.vendorlist.GvlSpecificationVersion.V3 @@ -83,4 +84,16 @@ class VendorList extends NetworkScaffolding { ) } } + + void setErrorResponse(TcfPolicyVersion tcfPolicyVersion = TCF_POLICY_V2, + Integer status = SC_INTERNAL_SERVER_ERROR) { + + def preparedEndpoint = endpoint.replace("{TCF_POLICY}", tcfPolicyVersion.vendorListVersion.toString()) + + wireMockClient.register(any(urlMatching(preparedEndpoint)) + .atPriority(Integer.MAX_VALUE) + .willReturn(aResponse() + .withStatus(status)) + ) + } } 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 c5974022061..372d5045817 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/CacheSpec.groovy @@ -72,7 +72,7 @@ class CacheSpec extends BaseSpec { and: "prebid_cache.creative_size.json metric should be updated" def metrics = defaultPbsService.sendCollectedMetricsRequest() assert metrics[REQUEST_OK_METRIC] == initialValue + 1 - assert metrics[JSON_CREATIVE_SIZE_GLOBAL_METRIC] == creativeSize + assert metrics[JSON_CREATIVE_SIZE_GLOBAL_METRIC] and: "account..prebid_cache.creative_size.json should be update" assert metrics[ACCOUNT_REQUEST_OK_METRIC.formatted(bidRequest.accountId)] == 1 @@ -108,7 +108,7 @@ class CacheSpec extends BaseSpec { and: "prebid_cache.creative_size.json metric should be updated" def metrics = defaultPbsService.sendCollectedMetricsRequest() assert metrics[REQUEST_OK_METRIC] == initialValue + 1 - assert metrics[XML_CREATIVE_SIZE_GLOBAL_METRIC] == creativeSize + assert metrics[XML_CREATIVE_SIZE_GLOBAL_METRIC] and: "account..prebid_cache.creative_size.json should be update" assert metrics[ACCOUNT_REQUEST_OK_METRIC.formatted(bidRequest.accountId)] == 1 diff --git a/src/test/groovy/org/prebid/server/functional/tests/SecondaryBidderSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/SecondaryBidderSpec.groovy index b38b1c18794..706e5a9d648 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/SecondaryBidderSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/SecondaryBidderSpec.groovy @@ -129,8 +129,11 @@ class SecondaryBidderSpec extends BaseSpec { when: "PBS processes auction request" def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest) - then: "PBs should processed bidder call" + then: "PBS should process request for primary bidder" assert bidder.getBidderRequests(bidRequest.id) + + and: "PBS should process request for secondary bidder" + PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() }) assert openXBidder.getBidderRequest(bidRequest.id) and: "PBs response shouldn't contain response body from openX bidder" @@ -340,8 +343,11 @@ class SecondaryBidderSpec extends BaseSpec { when: "PBS processes auction request" def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest) - then: "PBs should processed bidder call" + then: "PBS should process request for primary bidder" assert bidder.getBidderRequests(bidRequest.id) + + and: "PBS should process request for secondary bidder" + PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() }) assert openXBidder.getBidderRequest(bidRequest.id) and: "PBs response shouldn't contain response body from openX bidder" @@ -376,9 +382,12 @@ class SecondaryBidderSpec extends BaseSpec { when: "PBS processes auction request" def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest) - then: "PBS should process bidder request" - assert bidder.getBidderRequest(bidRequest.id) + then: "PBS should process request for primary and secondary bidder" + assert bidder.getBidderRequests(bidRequest.id) assert genericAliasBidder.getBidderRequest(bidRequest.id) + + and: "PBS should process request for secondary bidder" + PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() }) assert openXBidder.getBidderRequest(bidRequest.id) and: "PBs response should contain openX alias and generic" @@ -424,8 +433,11 @@ class SecondaryBidderSpec extends BaseSpec { when: "PBS processes auction request" def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest) - then: "PBs should processed bidder call" + then: "PBS should process request for primary bidder" assert bidder.getBidderRequests(bidRequest.id) + + and: "PBS should process request for secondary bidder" + PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() }) assert openXBidder.getBidderRequest(bidRequest.id) and: "PBs response shouldn't contain response body from openX bidder" @@ -461,6 +473,7 @@ class SecondaryBidderSpec extends BaseSpec { if (bidderNames.contains(ALIAS)) { it.imp[0]?.ext?.prebid?.bidder?.alias = new Generic() } + it.tmax = 5_000 enabledReturnAllBidStatus() } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/PbRuleEnginePrivacySpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/PbRuleEnginePrivacySpec.groovy index 25804dc614e..64106286821 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/PbRuleEnginePrivacySpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbruleengine/PbRuleEnginePrivacySpec.groovy @@ -31,6 +31,7 @@ import static org.prebid.server.functional.model.config.RuleEngineFunction.GPP_S import static org.prebid.server.functional.model.config.RuleEngineFunction.GPP_SID_IN 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.GppSectionId.TCF_EU_V2 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.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE @@ -39,6 +40,14 @@ import static org.prebid.server.functional.util.privacy.TcfConsent.PurposeId.BAS class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec { + def setupSpec() { + vendorList.setErrorResponse() + } + + def cleanupSpec() { + vendorList.reset() + } + def "PBS should exclude bidder when eidAvailable match with condition"() { given: "Bid request with multiply bidders" def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap { @@ -538,7 +547,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec { def "PBS should exclude bidder when gppSidAvailable match with condition"() { given: "Default bid request with multiply bidder" def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap { - regs = new Regs(gppSid: [PBSUtils.getRandomEnum(GppSectionId).getIntValue()]) + regs = new Regs(gppSid: [PBSUtils.getRandomEnum(GppSectionId, [TCF_EU_V2]).getIntValue()]) } and: "Account with rule engine config" @@ -641,7 +650,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec { and: "Default bid request with multiply bidders" def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap { - regs = new Regs(gdpr: 0, gppSid: [PBSUtils.getRandomEnum(GppSectionId, [GppSectionId.TCF_EU_V2]).getIntValue()]) + regs = new Regs(gdpr: 0, gppSid: [PBSUtils.getRandomEnum(GppSectionId, [TCF_EU_V2]).getIntValue()]) } and: "Account with rule engine config" @@ -745,7 +754,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec { assert seatNonBid.nonBid[0].statusCode == REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE where: - gppSectionId << GppSectionId.values() - GppSectionId.TCF_EU_V2 + gppSectionId << GppSectionId.values() - TCF_EU_V2 } def "PBS shouldn't exclude bidder when gppSidIn not match with condition"() { @@ -789,7 +798,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec { assert !getAnalyticResults(bidResponse) where: - gppSectionId << GppSectionId.values() - GppSectionId.TCF_EU_V2 + gppSectionId << GppSectionId.values() - TCF_EU_V2 } def "PBS should exclude bidder when tcfInScope match with condition"() { 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 e9b819d23fa..74fec42e556 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 @@ -1148,6 +1148,6 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec { } private static BigDecimal getAdjustedValue(BigDecimal floorValue, BigDecimal bidAdjustment) { - floorValue.divide(bidAdjustment, FLOOR_VALUE_PRECISION, RoundingMode.HALF_UP) + floorValue.divide(bidAdjustment, FLOOR_VALUE_PRECISION, RoundingMode.HALF_EVEN) } }