Skip to content

Conversation

@osulzhenko
Copy link
Collaborator

@osulzhenko osulzhenko commented Feb 7, 2025

🔧 Type of changes

  • new bid adapter
  • bid adapter update
  • new feature
  • new analytics adapter
  • new module
  • module update
  • bugfix
  • documentation
  • configuration
  • dependency update
  • tech debt (test coverage, refactorings, etc.)

✨ 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

  • verify email contact works
  • NO fully dynamic hostnames
  • geographic host parameters are NOT required
  • direct use of HTTP is prohibited - implement an existing Bidder interface that will do all the job
  • if the ORTB is just forwarded to the endpoint, use the generic adapter - define the new adapter as the alias of the generic adapter
  • cover an adapter configuration with an integration test

🧪 Test plan

How do you know the changes are safe to ship to production?

🏎 Quality check

  • Are your changes following our code style guidelines?
  • Are there any breaking changes in your code?
  • Does your test coverage exceed 90%?
  • Are there any erroneous console logs, debuggers or leftover code in your changes?

@osulzhenko osulzhenko added work in progress Signals not finished work tests Functional or other tests labels Feb 7, 2025
@osulzhenko osulzhenko requested a review from marki1an February 7, 2025 19:25
@osulzhenko osulzhenko self-assigned this Feb 7, 2025
@osulzhenko osulzhenko removed the work in progress Signals not finished work label Feb 10, 2025
@osulzhenko osulzhenko marked this pull request as ready for review February 10, 2025 12:05
@osulzhenko osulzhenko changed the title Increase coverage for floors validation Tests: Increase coverage for floors validation Feb 28, 2025
@osulzhenko osulzhenko changed the base branch from master to price-floors-logs April 27, 2025 16:16

and: "PBS fetch rules from floors provider"
cacheFloorsProviderRules(bidRequest, floorsPbsService)
cacheFloorsProviderRules(bidRequest, floorsPbsService, BidderName.GENERIC, NONE)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add import static org.prebid.server.functional.model.bidder.BidderName.GENERIC

and: "Metric alerts.account_config.ACCOUNT.price-floors should be update"
def metrics = floorsPbsService.sendCollectedMetricsRequest()
assert metrics[INVALID_CONFIG_METRIC(bidRequest.accountId) as String] == 1
assert !metrics[ALERT_GENERAL]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add separate "and" section for this assert

and: "Metric alerts.account_config.ACCOUNT.price-floors should be update"
def metrics = floorsPbsService.sendCollectedMetricsRequest()
assert metrics[INVALID_CONFIG_METRIC(bidRequest.accountId) as String] == 1
assert !metrics[ALERT_GENERAL]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

given: "Test start time"
def startTime = Instant.now()

and: "Bid request with floors"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bid request without floors?

Comment on lines 1178 to 1179
given: "Test start time"
def startTime = Instant.now()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a global startTime variable

@osulzhenko osulzhenko requested a review from marki1an April 29, 2025 23:36
then: "PBS should log a warning"
def message = "Using dynamic data is not allowed"
assert response.ext?.warnings[PREBID]*.code == [999]
assert response.ext?.warnings[PREBID]*.message == [message]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be in line:
assert response.ext?.warnings[PREBID]*.message == ["Using dynamic data is not allowed"]

Comment on lines 925 to 928
and: "Account with invalid floors config"
def account = getAccountWithEnabledFetch(bidRequest.accountId).tap {
config.auction.priceFloors.fetch.enabled = true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why invalid?
And getAccountWithEnabledFetch is creating to fetch.enabled = true

}

def "PBS should emit errors when stored request has more rules than price-floor.max-rules for amp request"() {
// @IgnoreRest
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove comment

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check other occurrences

assert metrics[FETCH_FAILURE_METRIC] == 1

and: "PBS log should contain error"
def message = "Price floor modelGroup skipRate must be in range(0-100), but was $invalidSkipRate"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Message can be global constant for FetchingSpec

["Failed to parse price floors from request, with a reason: Price floor modelGroup modelWeight " +
"must be in range(1-100), but was $invalidModelWeight"]
and: "Response should contain warning"
def message = "Price floor modelGroup modelWeight must be in range(1-100), but was $invalidModelWeight"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as previous

assert metrics[FETCH_FAILURE_METRIC] == 1

and: "PBS log should contain error"
def message = "Price floor rules values can't be null or empty, but were null"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

@osulzhenko osulzhenko requested a review from marki1an April 30, 2025 10:56
Comment on lines 1183 to 1185
def bidRequest = bidRequestWithFloors.tap {
ext.prebid.floors = null
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't we use getDefaultBidRequest()?

Comment on lines 1159 to 1161
and: "Set bidder response"
def bidResponse = BidResponse.getDefaultBidResponse(bidRequest)
bidder.setResponse(bidRequest.id, bidResponse)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need here bidder response

Comment on lines 1193 to 1195
and: "Set bidder response"
def bidResponse = BidResponse.getDefaultBidResponse(bidRequest)
bidder.setResponse(bidRequest.id, bidResponse)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment on lines 1193 to 1195
and: "Set bidder response"
def bidResponse = BidResponse.getDefaultBidResponse(bidRequest)
bidder.setResponse(bidRequest.id, bidResponse)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

bidder.setResponse(bidRequest.id, bidResponse)

and: "PBS fetch rules from floors provider"
cacheFloorsProviderRules(bidRequest, floorsPbsService, GENERIC, SUCCESS)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just cacheFloorsProviderRules(bidRequest)

Comment on lines 985 to 988
and: "PBS request status shouldn't be in progress"
def bidderRequest = bidder.getBidderRequests(bidRequest.id)
assert getRequests(bidResponse)[GENERIC.value]?.first?.ext?.prebid?.floors?.fetchStatus == NONE
assert bidderRequest.ext.prebid.floors.fetchStatus == [NONE]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split these two assertions by and: sections


and: "Account with enabled fetching"
def account = getAccountWithEnabledFetch(bidRequest.accountId).tap {
config.auction.priceFloors.fetch.enabled = true
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getAccountWithEnabledFetch() already setup enabled to true

@osulzhenko osulzhenko merged commit 8377468 into price-floors-logs Apr 30, 2025
1 check passed
@osulzhenko osulzhenko deleted the functional-tests/floors-validation branch April 30, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Functional or other tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants