Skip to content

Tests: Increase coverage for floors logs tests#3952

Merged
osulzhenko merged 13 commits into
price-floors-logsfrom
functional-tests/price-floors-logs
May 19, 2025
Merged

Tests: Increase coverage for floors logs tests#3952
osulzhenko merged 13 commits into
price-floors-logsfrom
functional-tests/price-floors-logs

Conversation

@osulzhenko
Copy link
Copy Markdown
Collaborator

@osulzhenko osulzhenko commented May 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 requested a review from marki1an May 7, 2025 20:04
@osulzhenko osulzhenko self-assigned this May 7, 2025
@osulzhenko osulzhenko added the tests Functional or other tests label May 7, 2025
assert response.ext?.warnings[PREBID]*.message == [WARNING_MESSAGE(message)]
}

def "PBS shouldn't emit error in log and response when floors is not in request and floors fetching disabled for account"() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Please add account with disabled fetching

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

it's right under comment

requestFloors << [null, true]
}

def "PBS shouldn't emit error in log and response when floor data is empty and floors fetching disabled for account and disabled for request"() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

PBS shouldn't emit error in log and response when floor data is empty and floors fetching disabled for account and request

assert metrics[ALERT_GENERAL] == 1

where:
requestFloors << [null, true]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

requestEnabledFloors << [null, true]

Comment on lines +1852 to +1853
config.auction.priceFloors.enabled = true
config.auction.priceFloors.fetch.enabled = true
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

it's enabled by default in getAccountWithEnabledFetch method

assert !metrics[ALERT_GENERAL]

where:
requestFloors << [null, true]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

requestFloorEnabled

requestFloors << [null, true]
}

def "PBS shouldn't emit error in log and response when data is invalid and floors disabled for request"() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This one looks like the same as PBS shouldn't emit error in log and response when floor data is empty and floors fetching disabled for account and disabled for request

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Or it can be merged

assert !bidResponse.ext?.errors

and: "PBS shouldn't log a errors"
def message = 'Price floor rules data must be present'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Suggested change
def message = 'Price floor rules data must be present'
def message = "Price floor rules data must be present"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Also check other cases

requestFloors << [null, true]
}

def "PBS shouldn't emit error in log and response when data is invalid and floors disabled for request"() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Or it can be merged

@osulzhenko osulzhenko requested a review from marki1an May 18, 2025 21:19
def response = floorsPbsService.sendAuctionRequest(bidRequest)

then: "PBS should log a warning"
def message = 'Price floor rules data must be present'
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Minor

Suggested change
def message = 'Price floor rules data must be present'
def message = "Price floor rules data must be present"

@osulzhenko osulzhenko requested a review from marki1an May 19, 2025 10:22
@osulzhenko osulzhenko merged commit 20b3465 into price-floors-logs May 19, 2025
1 check passed
@osulzhenko osulzhenko deleted the functional-tests/price-floors-logs branch May 19, 2025 10:47
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.

2 participants