-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test: Price floors max rules dimensions #3646
Test: Price floors max rules dimensions #3646
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add test cases that cover the following:
- request-level
max-schema-dims
config cannot be passed in the request; it must be specified as part of the account config (i.e., ignoreext.prebid.floors.max-schema-dims
). - default value for
max-schema-dims
is 3. - What happens if both
fetch.max-schema-dims
andmax-schema-dims
are set with different values? Which one takes priority?
@@ -2046,6 +2046,91 @@ class PriceFloorsFetchingSpec extends PriceFloorsBaseSpec { | |||
} | |||
} | |||
|
|||
def "PBS should validate fetch.max-schema-dims from account config"() { | |||
given: "Default BidRequest" | |||
def bidRequest = BidRequest.getDefaultBidRequest(APP) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also why APP?
…les-dimensions' into tests/price-floors-max-rules-dimensions
import spock.lang.IgnoreRest | ||
|
||
import static org.mockserver.model.HttpStatusCode.BAD_REQUEST_400 | ||
import static org.prebid.server.functional.model.Currency.USD | ||
import static org.prebid.server.functional.model.bidder.BidderName.GENERIC | ||
import static org.prebid.server.functional.model.pricefloors.DeviceType.PHONE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
invalid imports
["Failed to parse price floors from request, with a reason: " + | ||
"Price floor rules number 2 exceeded its maximum number 1"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the proper way to configure tests. For any external viewer, it will be hard to understand why it is set to 2
and why we are using 1
. A person would be forced to look at the code and into PriceFloorSchema.groovy
for the request. This is not right. We should replace 2 with priceFloorSchema.fields.size
and 1 with priceFloorSchema.fields.size - 1
(as example). Same for others
PBSUtils.randomNegativeNumber | null | ||
} | ||
|
||
def "PBS should validate price-floor.max-schema-dims from account config"() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PBS should validate price-floor.max-schema-dims from account config and not reject entire auction
same for others
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, please add some privacy methods for these counts:
foo.ext.prebid.floors.data.modelGroups[0].values.size()
boo.ext.prebid.floors.data.modelGroups[0].schema.fields.size()
assert response.ext?.errors[PREBID]*.message == | ||
["Failed to parse price floors from request, with a reason: " + | ||
"Price floor rules number ${ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values.keySet().size()} " + | ||
"exceeded its maximum number 1"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace 1 with maxRules value. Same for others. Also maybe we can use ${ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values.size()}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can't just replace with maxRules, since
maxRules | maxRulesSnakeCase
1 | null
null | 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's then make it constant
def "PBS shouldn't emit errors when request schema.fields than floor-config.max-schema-dims"() { | ||
given: "Bid request with schema 2 fields" | ||
def bidRequest = bidRequestWithFloors.tap { | ||
ext.prebid.floors.maxSchemaDims = PBSUtils.randomNumber |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because it can be flaky, pls add:
ext.prebid.floors.maxSchemaDims = PBSUtils.getRandomNumber(2) 2 as example here
"'$BASIC_FETCH_URL$accountId', account = $accountId with a reason : Price floor schema dimensions 2 " + | ||
"exceeded its maximum number 1") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Price floor schema dimensions ${getSchemaSize(bidRequest)}
assert response.ext?.errors[PREBID]*.message == | ||
["Failed to parse price floors from request, with a reason: " + | ||
"Price floor rules number ${ampStoredRequest.ext.prebid.floors.data.modelGroups[0].values.keySet().size()} " + | ||
"exceeded its maximum number 1"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's then make it constant
config.auction.priceFloors.maxSchemaDims = 2 | ||
config.auction.priceFloors.fetch.maxSchemaDims = 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
config.auction.priceFloors.maxSchemaDims = getSchemaSize(bidRequest)
config.auction.priceFloors.fetch.maxSchemaDims = getSchemaSize(bidRequest) - 1
🔧 Type of changes
✨ What's the context?
What's the context for the changes?
🧠 Rationale behind the change
Why did you choose to make these changes? Were there any trade-offs you had to consider?
🔎 New Bid Adapter Checklist
🧪 Test plan
How do you know the changes are safe to ship to production?
🏎 Quality check