Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ LIMIT 1
"metrics.prefix" : "prebid",
"status-response" : "ok",
"gdpr.default-value" : "0",
"gdpr.vendorlist.v2.http-endpoint-template" : "$networkServiceContainer.rootUri/v2/vendor-list.json".toString(),
"gdpr.vendorlist.v3.http-endpoint-template" : "$networkServiceContainer.rootUri/v3/vendor-list.json".toString(),
"settings.database.account-query" : DB_ACCOUNT_QUERY,
"settings.database.stored-requests-query" : "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%) UNION ALL SELECT accountId, impId, impData, 'imp' as dataType FROM stored_imps WHERE impId IN (%IMP_ID_LIST%)",
"settings.database.amp-stored-requests-query": "SELECT accountId, reqId, requestData, 'request' as dataType FROM stored_requests WHERE reqId IN (%REQUEST_ID_LIST%)",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.anyRequestedFor
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo
import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching
import static com.github.tomakehurst.wiremock.stubbing.Scenario.STARTED
import static org.apache.http.HttpStatus.SC_INTERNAL_SERVER_ERROR
import static org.apache.http.HttpStatus.SC_OK
import static org.prebid.server.functional.model.mock.services.vendorlist.GvlSpecificationVersion.V2
import static org.prebid.server.functional.model.mock.services.vendorlist.GvlSpecificationVersion.V3
Expand Down Expand Up @@ -83,4 +84,16 @@ class VendorList extends NetworkScaffolding {
)
}
}

void setErrorResponse(TcfPolicyVersion tcfPolicyVersion = TCF_POLICY_V2,
Integer status = SC_INTERNAL_SERVER_ERROR) {

def preparedEndpoint = endpoint.replace("{TCF_POLICY}", tcfPolicyVersion.vendorListVersion.toString())

wireMockClient.register(any(urlMatching(preparedEndpoint))
.atPriority(Integer.MAX_VALUE)
.willReturn(aResponse()
.withStatus(status))
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class CacheSpec extends BaseSpec {
and: "prebid_cache.creative_size.json metric should be updated"
def metrics = defaultPbsService.sendCollectedMetricsRequest()
assert metrics[REQUEST_OK_METRIC] == initialValue + 1
assert metrics[JSON_CREATIVE_SIZE_GLOBAL_METRIC] == creativeSize
assert metrics[JSON_CREATIVE_SIZE_GLOBAL_METRIC]

and: "account.<account-id>.prebid_cache.creative_size.json should be update"
assert metrics[ACCOUNT_REQUEST_OK_METRIC.formatted(bidRequest.accountId)] == 1
Expand Down Expand Up @@ -108,7 +108,7 @@ class CacheSpec extends BaseSpec {
and: "prebid_cache.creative_size.json metric should be updated"
def metrics = defaultPbsService.sendCollectedMetricsRequest()
assert metrics[REQUEST_OK_METRIC] == initialValue + 1
assert metrics[XML_CREATIVE_SIZE_GLOBAL_METRIC] == creativeSize
assert metrics[XML_CREATIVE_SIZE_GLOBAL_METRIC]

and: "account.<account-id>.prebid_cache.creative_size.json should be update"
assert metrics[ACCOUNT_REQUEST_OK_METRIC.formatted(bidRequest.accountId)] == 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,11 @@ class SecondaryBidderSpec extends BaseSpec {
when: "PBS processes auction request"
def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest)

then: "PBs should processed bidder call"
then: "PBS should process request for primary bidder"
assert bidder.getBidderRequests(bidRequest.id)

and: "PBS should process request for secondary bidder"
PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() })
assert openXBidder.getBidderRequest(bidRequest.id)

and: "PBs response shouldn't contain response body from openX bidder"
Expand Down Expand Up @@ -340,8 +343,11 @@ class SecondaryBidderSpec extends BaseSpec {
when: "PBS processes auction request"
def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest)

then: "PBs should processed bidder call"
then: "PBS should process request for primary bidder"
assert bidder.getBidderRequests(bidRequest.id)

and: "PBS should process request for secondary bidder"
PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() })
assert openXBidder.getBidderRequest(bidRequest.id)

and: "PBs response shouldn't contain response body from openX bidder"
Expand Down Expand Up @@ -376,9 +382,12 @@ class SecondaryBidderSpec extends BaseSpec {
when: "PBS processes auction request"
def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest)

then: "PBS should process bidder request"
assert bidder.getBidderRequest(bidRequest.id)
then: "PBS should process request for primary and secondary bidder"
assert bidder.getBidderRequests(bidRequest.id)
assert genericAliasBidder.getBidderRequest(bidRequest.id)

and: "PBS should process request for secondary bidder"
PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() })
assert openXBidder.getBidderRequest(bidRequest.id)

and: "PBs response should contain openX alias and generic"
Expand Down Expand Up @@ -424,8 +433,11 @@ class SecondaryBidderSpec extends BaseSpec {
when: "PBS processes auction request"
def bidResponse = pbsServiceWithOpenXBidder.sendAuctionRequest(bidRequest)

then: "PBs should processed bidder call"
then: "PBS should process request for primary bidder"
assert bidder.getBidderRequests(bidRequest.id)

and: "PBS should process request for secondary bidder"
PBSUtils.waitUntil({ !openXBidder.getBidderRequests(bidRequest.id).isEmpty() })
assert openXBidder.getBidderRequest(bidRequest.id)

and: "PBs response shouldn't contain response body from openX bidder"
Expand Down Expand Up @@ -461,6 +473,7 @@ class SecondaryBidderSpec extends BaseSpec {
if (bidderNames.contains(ALIAS)) {
it.imp[0]?.ext?.prebid?.bidder?.alias = new Generic()
}
it.tmax = 5_000
enabledReturnAllBidStatus()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import static org.prebid.server.functional.model.config.RuleEngineFunction.GPP_S
import static org.prebid.server.functional.model.config.RuleEngineFunction.GPP_SID_IN
import static org.prebid.server.functional.model.config.RuleEngineFunction.TCF_IN_SCOPE
import static org.prebid.server.functional.model.config.RuleEngineFunction.USER_FPD_AVAILABLE
import static org.prebid.server.functional.model.request.GppSectionId.TCF_EU_V2
import static org.prebid.server.functional.model.request.auction.DistributionChannel.APP
import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS
import static org.prebid.server.functional.model.response.auction.BidRejectionReason.REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE
Expand All @@ -39,6 +40,14 @@ import static org.prebid.server.functional.util.privacy.TcfConsent.PurposeId.BAS

class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec {

def setupSpec() {
vendorList.setErrorResponse()
}

def cleanupSpec() {
vendorList.reset()
}

def "PBS should exclude bidder when eidAvailable match with condition"() {
given: "Bid request with multiply bidders"
def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap {
Expand Down Expand Up @@ -538,7 +547,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec {
def "PBS should exclude bidder when gppSidAvailable match with condition"() {
given: "Default bid request with multiply bidder"
def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap {
regs = new Regs(gppSid: [PBSUtils.getRandomEnum(GppSectionId).getIntValue()])
regs = new Regs(gppSid: [PBSUtils.getRandomEnum(GppSectionId, [TCF_EU_V2]).getIntValue()])
}

and: "Account with rule engine config"
Expand Down Expand Up @@ -641,7 +650,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec {

and: "Default bid request with multiply bidders"
def bidRequest = getDefaultBidRequestWithMultiplyBidders().tap {
regs = new Regs(gdpr: 0, gppSid: [PBSUtils.getRandomEnum(GppSectionId, [GppSectionId.TCF_EU_V2]).getIntValue()])
regs = new Regs(gdpr: 0, gppSid: [PBSUtils.getRandomEnum(GppSectionId, [TCF_EU_V2]).getIntValue()])
}

and: "Account with rule engine config"
Expand Down Expand Up @@ -745,7 +754,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec {
assert seatNonBid.nonBid[0].statusCode == REQUEST_BIDDER_REMOVED_BY_RULE_ENGINE_MODULE

where:
gppSectionId << GppSectionId.values() - GppSectionId.TCF_EU_V2
gppSectionId << GppSectionId.values() - TCF_EU_V2
}

def "PBS shouldn't exclude bidder when gppSidIn not match with condition"() {
Expand Down Expand Up @@ -789,7 +798,7 @@ class PbRuleEnginePrivacySpec extends PbRuleEngineBaseSpec {
assert !getAnalyticResults(bidResponse)

where:
gppSectionId << GppSectionId.values() - GppSectionId.TCF_EU_V2
gppSectionId << GppSectionId.values() - TCF_EU_V2
}

def "PBS should exclude bidder when tcfInScope match with condition"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1148,6 +1148,6 @@ class PriceFloorsSignalingSpec extends PriceFloorsBaseSpec {
}

private static BigDecimal getAdjustedValue(BigDecimal floorValue, BigDecimal bidAdjustment) {
floorValue.divide(bidAdjustment, FLOOR_VALUE_PRECISION, RoundingMode.HALF_UP)
floorValue.divide(bidAdjustment, FLOOR_VALUE_PRECISION, RoundingMode.HALF_EVEN)
}
}
Loading