From efaab6ce33d568ddbb59dfc498ef343972a79173 Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Tue, 20 May 2025 14:39:31 +0300 Subject: [PATCH 1/2] Tests: Fix invalid functional tests --- .../pricefloors/PriceFloorsRulesSpec.groovy | 20 ++++++++++++------- .../privacy/GppSyncUserActivitiesSpec.groovy | 2 +- .../GppTransmitEidsActivitiesSpec.groovy | 6 ++---- .../GppTransmitUfpdActivitiesSpec.groovy | 6 ++---- 4 files changed, 18 insertions(+), 16 deletions(-) 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 96247fe0157..d2fc175ad53 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 @@ -8,8 +8,8 @@ import org.prebid.server.functional.model.config.AlternateBidderCodes import org.prebid.server.functional.model.config.BidderConfig import org.prebid.server.functional.model.db.StoredImp import org.prebid.server.functional.model.pricefloors.Country -import org.prebid.server.functional.model.pricefloors.MediaType import org.prebid.server.functional.model.pricefloors.FloorModelGroup +import org.prebid.server.functional.model.pricefloors.MediaType import org.prebid.server.functional.model.pricefloors.PriceFloorData import org.prebid.server.functional.model.pricefloors.PriceFloorSchema import org.prebid.server.functional.model.pricefloors.Rule @@ -29,6 +29,8 @@ import org.prebid.server.functional.model.response.auction.BidExt import org.prebid.server.functional.model.response.auction.BidResponse 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.bidder.BidderName.ALIAS import static org.prebid.server.functional.model.bidder.BidderName.AMX @@ -61,7 +63,6 @@ import static org.prebid.server.functional.model.request.auction.FetchStatus.ERR import static org.prebid.server.functional.model.request.auction.Location.NO_DATA import static org.prebid.server.functional.model.request.auction.Prebid.Channel import static org.prebid.server.functional.model.response.auction.BidRejectionReason.RESPONSE_REJECTED_DUE_TO_PRICE_FLOOR -import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { @@ -177,7 +178,10 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { } def "PBS should consider rules file invalid when rules file contains an unrecognized dimension in the schema"() { - given: "BidRequest with domain" + given: "Test start time" + def startTime = Instant.now() + + and: "BidRequest with domain" def domain = PBSUtils.randomString def accountId = PBSUtils.randomString def bidRequest = BidRequest.defaultBidRequest.tap { @@ -218,17 +222,19 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { assert bidderRequest.ext?.prebid?.floors?.location == NO_DATA assert bidderRequest.ext?.prebid?.floors?.fetchStatus == ERROR - and: "PBS should not contain errors" + and: "PBS should not contain errors or warnings" assert !response.ext?.errors + assert !response.ext?.warnings and: "PBS should log a warning" - assert response.ext?.warnings[PREBID]*.code == [999] - assert response.ext?.warnings[PREBID]*.message.first.contains("Cannot deserialize value of type " + + def logs = floorsPbsService.getLogsByTime(startTime) + assert getLogsByText(logs, "Cannot deserialize value of type " + "`org.prebid.server.floors.model.PriceFloorField` " + - "from String \"bogus\": not one of the values accepted for Enum class") + "from String \"bogus\": not one of the values accepted for Enum class").size() == 1 and: "PBS should not reject the entire auction" assert !response.seatbid.isEmpty() + assert response.seatbid.bid.flatten().size() == 1 } def "PBS should round floor value to 4-digits of precision"() { 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 baac79520c3..2303bfc9e5f 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 @@ -568,7 +568,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1 and: "Should add a warning when in debug mode" - assert response.warnings == ["GPP string invalid: Unable to decode '$invalidGpp'"] + assert response.warnings.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString()) } def "PBS cookie sync call when request have different gpp consent but match and rejecting should exclude bidders URLs"() { 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 3d595ab0612..41e1079986d 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 @@ -928,8 +928,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { assert genericBidderRequest.user.eids[0].source == bidRequest.user.eids[0].source and: "Should add a warning when in debug mode" - assert response.ext.warnings[PREBID]?.code == [999] - assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"] + assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString()) and: "Response should not contain any errors" assert !response.ext.errors @@ -2065,8 +2064,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec { assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_EIDS)] == 1 and: "Should add a warning when in debug mode" - assert response.ext.warnings[PREBID]?.code == [999] - assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"] + assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString()) and: "Response should contain consent_string errors" assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"] 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 dab901bd93d..25f18381131 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 @@ -1232,8 +1232,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { assert bidderRequest.user.eids == bidRequest.user.eids and: "Should add a warning when in debug mode" - assert response.ext.warnings[PREBID]?.code == [999] - assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"] + assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString()) and: "Response should not contain any errors" assert !response.ext.errors @@ -2712,8 +2711,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec { assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_UFPD)] == 1 and: "Should add a warning when in debug mode" - assert response.ext.warnings[PREBID]?.code == [999] - assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"] + assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString()) and: "Response should contain consent_string errors" assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"] From 6367c42d755796419a644fde6d92012baf87e2aa Mon Sep 17 00:00:00 2001 From: osulzhenko Date: Tue, 20 May 2025 14:58:48 +0300 Subject: [PATCH 2/2] minor update --- .../functional/tests/pricefloors/PriceFloorsRulesSpec.groovy | 1 - 1 file changed, 1 deletion(-) 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 d2fc175ad53..c5404290135 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 @@ -234,7 +234,6 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec { and: "PBS should not reject the entire auction" assert !response.seatbid.isEmpty() - assert response.seatbid.bid.flatten().size() == 1 } def "PBS should round floor value to 4-digits of precision"() {