Skip to content

Commit d2c0357

Browse files
authored
Tests: Fix invalid functional tests (#3967)
1 parent b0fde77 commit d2c0357

4 files changed

Lines changed: 17 additions & 16 deletions

File tree

src/test/groovy/org/prebid/server/functional/tests/pricefloors/PriceFloorsRulesSpec.groovy

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import org.prebid.server.functional.model.config.AlternateBidderCodes
88
import org.prebid.server.functional.model.config.BidderConfig
99
import org.prebid.server.functional.model.db.StoredImp
1010
import org.prebid.server.functional.model.pricefloors.Country
11-
import org.prebid.server.functional.model.pricefloors.MediaType
1211
import org.prebid.server.functional.model.pricefloors.FloorModelGroup
12+
import org.prebid.server.functional.model.pricefloors.MediaType
1313
import org.prebid.server.functional.model.pricefloors.PriceFloorData
1414
import org.prebid.server.functional.model.pricefloors.PriceFloorSchema
1515
import org.prebid.server.functional.model.pricefloors.Rule
@@ -29,6 +29,8 @@ import org.prebid.server.functional.model.response.auction.BidExt
2929
import org.prebid.server.functional.model.response.auction.BidResponse
3030
import org.prebid.server.functional.util.PBSUtils
3131

32+
import java.time.Instant
33+
3234
import static org.prebid.server.functional.model.ChannelType.WEB
3335
import static org.prebid.server.functional.model.bidder.BidderName.ALIAS
3436
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
6163
import static org.prebid.server.functional.model.request.auction.Location.NO_DATA
6264
import static org.prebid.server.functional.model.request.auction.Prebid.Channel
6365
import static org.prebid.server.functional.model.response.auction.BidRejectionReason.RESPONSE_REJECTED_DUE_TO_PRICE_FLOOR
64-
import static org.prebid.server.functional.model.response.auction.ErrorType.PREBID
6566
import static org.prebid.server.functional.testcontainers.Dependencies.getNetworkServiceContainer
6667

6768
class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
@@ -177,7 +178,10 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
177178
}
178179

179180
def "PBS should consider rules file invalid when rules file contains an unrecognized dimension in the schema"() {
180-
given: "BidRequest with domain"
181+
given: "Test start time"
182+
def startTime = Instant.now()
183+
184+
and: "BidRequest with domain"
181185
def domain = PBSUtils.randomString
182186
def accountId = PBSUtils.randomString
183187
def bidRequest = BidRequest.defaultBidRequest.tap {
@@ -218,14 +222,15 @@ class PriceFloorsRulesSpec extends PriceFloorsBaseSpec {
218222
assert bidderRequest.ext?.prebid?.floors?.location == NO_DATA
219223
assert bidderRequest.ext?.prebid?.floors?.fetchStatus == ERROR
220224

221-
and: "PBS should not contain errors"
225+
and: "PBS should not contain errors or warnings"
222226
assert !response.ext?.errors
227+
assert !response.ext?.warnings
223228

224229
and: "PBS should log a warning"
225-
assert response.ext?.warnings[PREBID]*.code == [999]
226-
assert response.ext?.warnings[PREBID]*.message.first.contains("Cannot deserialize value of type " +
230+
def logs = floorsPbsService.getLogsByTime(startTime)
231+
assert getLogsByText(logs, "Cannot deserialize value of type " +
227232
"`org.prebid.server.floors.model.PriceFloorField` " +
228-
"from String \"bogus\": not one of the values accepted for Enum class")
233+
"from String \"bogus\": not one of the values accepted for Enum class").size() == 1
229234

230235
and: "PBS should not reject the entire auction"
231236
assert !response.seatbid.isEmpty()

src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec {
568568
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1
569569

570570
and: "Should add a warning when in debug mode"
571-
assert response.warnings == ["GPP string invalid: Unable to decode '$invalidGpp'"]
571+
assert response.warnings.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
572572
}
573573

574574
def "PBS cookie sync call when request have different gpp consent but match and rejecting should exclude bidders URLs"() {

src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitEidsActivitiesSpec.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -928,8 +928,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec {
928928
assert genericBidderRequest.user.eids[0].source == bidRequest.user.eids[0].source
929929

930930
and: "Should add a warning when in debug mode"
931-
assert response.ext.warnings[PREBID]?.code == [999]
932-
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
931+
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
933932

934933
and: "Response should not contain any errors"
935934
assert !response.ext.errors
@@ -2065,8 +2064,7 @@ class GppTransmitEidsActivitiesSpec extends PrivacyBaseSpec {
20652064
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_EIDS)] == 1
20662065

20672066
and: "Should add a warning when in debug mode"
2068-
assert response.ext.warnings[PREBID]?.code == [999]
2069-
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
2067+
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
20702068

20712069
and: "Response should contain consent_string errors"
20722070
assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"]

src/test/groovy/org/prebid/server/functional/tests/privacy/GppTransmitUfpdActivitiesSpec.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,8 +1232,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
12321232
assert bidderRequest.user.eids == bidRequest.user.eids
12331233

12341234
and: "Should add a warning when in debug mode"
1235-
assert response.ext.warnings[PREBID]?.code == [999]
1236-
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
1235+
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
12371236

12381237
and: "Response should not contain any errors"
12391238
assert !response.ext.errors
@@ -2712,8 +2711,7 @@ class GppTransmitUfpdActivitiesSpec extends PrivacyBaseSpec {
27122711
assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(ampStoredRequest, TRANSMIT_UFPD)] == 1
27132712

27142713
and: "Should add a warning when in debug mode"
2715-
assert response.ext.warnings[PREBID]?.code == [999]
2716-
assert response.ext.warnings[PREBID]?.message == ["GPP string invalid: Unable to decode '$invalidGpp'"]
2714+
assert response.ext.warnings[PREBID]?.message.contains("GPP string invalid: Unable to decode '$invalidGpp'".toString())
27172715

27182716
and: "Response should contain consent_string errors"
27192717
assert response.ext.errors[PREBID].message == ["Amp request parameter consent_string has invalid format: $invalidGpp"]

0 commit comments

Comments
 (0)