Skip to content
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c6ddf01
Refactoring functional tests
osulzhenko Jan 5, 2025
f10db31
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Jan 14, 2025
ec3b6a2
Refactoring functional tests
osulzhenko Jan 16, 2025
c83bc82
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Feb 4, 2025
a31c436
Resolve conflicts
osulzhenko Feb 4, 2025
ed705d0
update clean up for tests
osulzhenko Feb 5, 2025
92b055c
Fix invalid tests
osulzhenko Feb 12, 2025
479ab21
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Feb 12, 2025
fa6de4d
Update after review
osulzhenko Feb 21, 2025
dca221a
Update after review
osulzhenko Feb 21, 2025
72bb241
Update after review
osulzhenko Feb 21, 2025
e24537f
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Mar 7, 2025
229966e
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Apr 11, 2025
0b11156
update after review
osulzhenko Apr 11, 2025
430d0ac
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Apr 25, 2025
9db9b6a
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko May 9, 2025
4df5109
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko May 23, 2025
cc71627
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Jul 14, 2025
56b4c1e
Update functional tests
osulzhenko Jul 14, 2025
67c57c7
Fix module tests
osulzhenko Jul 14, 2025
b66572a
Fix module tests
osulzhenko Jul 16, 2025
ec1bcf1
Fix module tests
osulzhenko Jul 16, 2025
8af8749
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Oct 30, 2025
f5e6593
fix imports
osulzhenko Oct 31, 2025
d3371fb
fix imports
osulzhenko Oct 31, 2025
11f47a3
fix mr conflicts
osulzhenko Oct 31, 2025
8a4d564
Optimize module tests
osulzhenko Nov 3, 2025
de08366
fix gpp error
osulzhenko Nov 3, 2025
6f32685
update module tests
osulzhenko Nov 7, 2025
42acf18
Merge branch 'refs/heads/master' into refactoring-functional-tests
osulzhenko Nov 7, 2025
82c8a7d
Move creation of local stack container
marki1an Dec 2, 2025
5761e58
Removing duplication and add NOOP metrics
marki1an Dec 3, 2025
1b0aacc
Merge remote-tracking branch 'origin/master' into refactoring-functio…
marki1an Dec 3, 2025
ef7d348
Resolve conflict
marki1an Dec 3, 2025
a091b96
Update: Remove unnecessary metics checks
marki1an Dec 4, 2025
4fb9287
Update: Remove unnecessary metics checks
marki1an Dec 4, 2025
ae8d1d3
Merge remote-tracking branch 'origin/master' into refactoring-functio…
marki1an Dec 22, 2025
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 @@ -3,7 +3,6 @@ package org.prebid.server.functional.model.config
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package org.prebid.server.functional.model.config

import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName

@ToString(includeNames = true, ignoreNulls = true)
class EndpointExecutionPlan {

Map<Stage, StageExecutionPlan> stages

static EndpointExecutionPlan getModuleEndpointExecutionPlan(ModuleName name, List<Stage> stages) {
new EndpointExecutionPlan(stages: stages.collectEntries {
it -> [(it): StageExecutionPlan.getModuleStageExecutionPlan(name, it)] } as Map<Stage, StageExecutionPlan>)
new EndpointExecutionPlan(stages: stages.collectEntries {
it -> [(it): StageExecutionPlan.getModuleStageExecutionPlan(name, it)]
} as Map<Stage, StageExecutionPlan>)
}

static EndpointExecutionPlan getModulesEndpointExecutionPlan(Map<Stage, List<ModuleName>> modulesStages) {
Expand All @@ -24,4 +24,17 @@ class EndpointExecutionPlan {
} as Map<Stage, StageExecutionPlan>
)
}

static EndpointExecutionPlan getModuleEndpointExecutionPlan(List<ModuleHookImplementation> modulesHooks) {
Map<Stage, StageExecutionPlan> stages = [:]
modulesHooks.each { moduleHook ->
def stage = Stage.forValue(moduleHook)
if (!stages.containsKey(stage)) {
stages[stage] = StageExecutionPlan.getModuleStageExecutionPlan([moduleHook])
} else {
stages[stage].addGroup(moduleHook)
}
}
new EndpointExecutionPlan(stages: stages)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
Expand All @@ -16,6 +15,13 @@ class ExecutionGroup {
@JsonProperty("hook_sequence")
List<HookId> hookSequenceSnakeCase

static ExecutionGroup getModuleExecutionGroup(ModuleHookImplementation moduleHook) {
new ExecutionGroup().tap {
timeout = 100
hookSequence = [new HookId(moduleCode: ModuleName.forValue(moduleHook).code, hookImplCode: moduleHook.code)]
}
}

static ExecutionGroup getModuleExecutionGroup(ModuleName name, Stage stage) {
new ExecutionGroup().tap {
timeout = 100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@ package org.prebid.server.functional.model.config
import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName

import static org.prebid.server.functional.model.config.Endpoint.OPENRTB2_AUCTION

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.LowerCaseStrategy)
class ExecutionPlan {

List<AbTest> abTests
List<ModularityAbTest> abTests
Map<Endpoint, EndpointExecutionPlan> endpoints

static ExecutionPlan getSingleEndpointExecutionPlan(List<ModuleHookImplementation> moduleHook, Endpoint endpoint = OPENRTB2_AUCTION) {
new ExecutionPlan(endpoints: [(endpoint): EndpointExecutionPlan.getModuleEndpointExecutionPlan(moduleHook)])
}

static ExecutionPlan getSingleEndpointExecutionPlan(Endpoint endpoint, ModuleName moduleName, List<Stage> stage) {
new ExecutionPlan(endpoints: [(endpoint): EndpointExecutionPlan.getModuleEndpointExecutionPlan(moduleName, stage)])
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import groovy.transform.ToString

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
class AbTest {
class ModularityAbTest {

Boolean enabled
String moduleCode
Expand All @@ -21,8 +21,8 @@ class AbTest {
@JsonProperty("log_analytics_tag")
Boolean logAnalyticsTagSnakeCase

static AbTest getDefault(String moduleCode, List<Integer> accounts = null) {
new AbTest(enabled: true,
static ModularityAbTest getDefault(String moduleCode, List<Integer> accounts = null) {
new ModularityAbTest(enabled: true,
moduleCode: moduleCode,
accounts: accounts,
percentActive: 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.prebid.server.functional.model.config

import com.fasterxml.jackson.annotation.JsonValue
import org.prebid.server.functional.model.ModuleName

//TODO remove if module hooks implementation codes will become consistent
enum ModuleHookImplementation {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.prebid.server.functional.model
package org.prebid.server.functional.model.config

import com.fasterxml.jackson.annotation.JsonValue

Expand All @@ -15,4 +15,8 @@ enum ModuleName {
ModuleName(String code) {
this.code = code
}

static ModuleName forValue(ModuleHookImplementation moduleHook) {
values().find { moduleHook.code.contains(it.code) }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ enum Stage {
this.metricValue = metricValue
}

static Stage forValue(ModuleHookImplementation moduleHook) {
values()
.collect { [stage: it, matchLength: moduleHook.code.indexOf(it.value) >= 0 ? it.value.length() : -1] }
.findAll { it.matchLength > 0 }
.max { it.matchLength }
?.stage
}

@Override
String toString() {
value
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package org.prebid.server.functional.model.config

import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName

@ToString(includeNames = true, ignoreNulls = true)
class StageExecutionPlan {
Expand All @@ -11,4 +10,13 @@ class StageExecutionPlan {
static StageExecutionPlan getModuleStageExecutionPlan(ModuleName name, Stage stage) {
new StageExecutionPlan(groups: [ExecutionGroup.getModuleExecutionGroup(name, stage)])
}

static StageExecutionPlan getModuleStageExecutionPlan(List<ModuleHookImplementation> modulesHooks) {
new StageExecutionPlan(groups: modulesHooks.collect { ExecutionGroup.getModuleExecutionGroup(it) })
}

StageExecutionPlan addGroup(ModuleHookImplementation moduleHook) {
(groups ?: (groups = [])).add(ExecutionGroup.getModuleExecutionGroup(moduleHook))
this
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ import org.prebid.server.functional.util.PBSUtils
class UserExtData {

List<String> keywords
String buyeruid
List<String> buyeruids
String buyerUid
List<String> buyerUids
Geo geo

static UserExtData getFPDUserExtData() {
new UserExtData().tap {
keywords = [PBSUtils.randomString]
buyeruid = PBSUtils.randomString
buyeruids = [PBSUtils.randomString]
buyerUid = PBSUtils.randomString
buyerUids = [PBSUtils.randomString]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.prebid.server.functional.model.request.auction.FetchStatus
import org.prebid.server.functional.model.request.auction.Imp

import static org.prebid.server.functional.model.request.auction.FetchStatus.SUCCESS
Expand All @@ -15,12 +14,12 @@ import static org.prebid.server.functional.model.request.auction.FetchStatus.SUC
class AnalyticResult {

String name
FetchStatus status
String status
List<ImpResult> results

static AnalyticResult buildFromImp(Imp imp) {
def appliedTo = new AppliedTo(impIds: [imp.id], bidders: [imp.ext.prebid.bidder.configuredBidders.first()])
def impResult = new ImpResult(status: 'success-block', values: new ModuleValue(richmediaFormat: 'mraid'), appliedTo: appliedTo)
new AnalyticResult(name: 'reject-richmedia', status: SUCCESS, results: [impResult])
new AnalyticResult(name: 'reject-richmedia', status: SUCCESS.value, results: [impResult])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategies
import com.fasterxml.jackson.databind.annotation.JsonNaming
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.prebid.server.functional.model.ModuleName
import org.prebid.server.functional.model.config.ModuleName

@ToString(includeNames = true, ignoreNulls = true)
@JsonNaming(PropertyNamingStrategies.KebabCaseStrategy)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Bidder extends NetworkScaffolding {
request().withPath(AUCTION_ENDPOINT)
}

HttpRequest getRequest(String bidRequestId, String requestMatchPath) {
static HttpRequest getRequest(String bidRequestId, String requestMatchPath) {
request().withPath(AUCTION_ENDPOINT)
.withBody(jsonPath("\$[?(@.$requestMatchPath == '$bidRequestId')]"))
}
Expand Down Expand Up @@ -68,7 +68,7 @@ class Bidder extends NetworkScaffolding {
return getLastRecordedRequestHeaders(bidRequestId)
}

private String getBodyByRequest(HttpRequest request) {
private static String getBodyByRequest(HttpRequest request) {
def requestString = request.bodyAsString
def jsonNode = toJsonNode(requestString)
def id = jsonNode.get("id").asText()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class FloorsProvider extends NetworkScaffolding {
: HttpResponse.notFoundResponse()}
}

private String getDefaultResponse() {
private static String getDefaultResponse() {
encode(PriceFloorData.priceFloorData)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class PrebidCache extends NetworkScaffolding {
.withBody(jsonPath("\$.puts[?(@.value =~/^.*$payload.*\$/)]"))
}

private String getBodyByRequest(HttpRequest request) {
private static String getBodyByRequest(HttpRequest request) {
def requestString = request.bodyAsString
def jsonNode = toJsonNode(requestString)
def putsSize = jsonNode.get("puts").size()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class AliasSpec extends BaseSpec {
def "PBS should apply compression type for bidder alias when adapters.BIDDER.endpoint-compression = gzip"() {
given: "PBS with adapter configuration"
def compressionType = GZIP.value
def pbsService = pbsServiceFactory.getService(
["adapters.generic.endpoint-compression": compressionType])
def pbsConfig = ["adapters.generic.endpoint-compression": compressionType]
def pbsService = pbsServiceFactory.getService(pbsConfig)

and: "Default bid request with alias"
def bidRequest = BidRequest.defaultBidRequest.tap {
Expand All @@ -94,6 +94,9 @@ class AliasSpec extends BaseSpec {
then: "Bidder request should contain header Content-Encoding = gzip"
assert response.ext?.debug?.httpcalls?.get(ALIAS.value)?.requestHeaders?.first()
?.get(CONTENT_ENCODING_HEADER)?.first() == compressionType

cleanup: "Stop and remove pbs container"
pbsServiceFactory.removeContainer(pbsConfig)
}

def "PBS should return an error when GVL Id alias refers to unknown bidder alias"() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ class AmpFpdSpec extends BaseSpec {
ampStoredRequest.user.geo.zip == user.geo.zip
ampStoredRequest.user.geo.country == user.geo.country
ampStoredRequest.user.ext.data.keywords == user.ext.data.keywords
ampStoredRequest.user.ext.data.buyeruid == user.ext.data.buyeruid
ampStoredRequest.user.ext.data.buyeruids == user.ext.data.buyeruids
ampStoredRequest.user.ext.data.buyerUid == user.ext.data.buyerUid
ampStoredRequest.user.ext.data.buyerUids == user.ext.data.buyerUids
}

and: "Bidder request shouldn't contain imp[0].ext.rp"
Expand Down Expand Up @@ -196,8 +196,8 @@ class AmpFpdSpec extends BaseSpec {
ortb2.user.gender == user.gender
ortb2.user.keywords == user.keywords
ortb2.user.ext.data.keywords == user.ext.data.keywords
ortb2.user.ext.data.buyeruid == user.ext.data.buyeruid
ortb2.user.ext.data.buyeruids == user.ext.data.buyeruids
ortb2.user.ext.data.buyerUid == user.ext.data.buyerUid
ortb2.user.ext.data.buyerUids == user.ext.data.buyerUids
}

and: "Bidder request shouldn't contain imp[0].ext.rp"
Expand Down Expand Up @@ -290,8 +290,8 @@ class AmpFpdSpec extends BaseSpec {
ampStoredRequest.user.geo.zip == user.geo.zip
ampStoredRequest.user.geo.country == user.geo.country
ampStoredRequest.user.ext.data.keywords == user.ext.data.keywords
ampStoredRequest.user.ext.data.buyeruid == user.ext.data.buyeruid
ampStoredRequest.user.ext.data.buyeruids == user.ext.data.buyeruids
ampStoredRequest.user.ext.data.buyerUid == user.ext.data.buyerUid
ampStoredRequest.user.ext.data.buyerUids == user.ext.data.buyerUids
}
}

Expand Down Expand Up @@ -370,8 +370,8 @@ class AmpFpdSpec extends BaseSpec {
it.user.gender == fpdUser.gender
it.user.keywords == fpdUser.keywords
it.user.ext.data.keywords == fpdUser.ext.data.keywords
it.user.ext.data.buyeruid == fpdUser.ext.data.buyeruid
it.user.ext.data.buyeruids == fpdUser.ext.data.buyeruids
it.user.ext.data.buyerUid == fpdUser.ext.data.buyerUid
it.user.ext.data.buyerUids == fpdUser.ext.data.buyerUids
}

and: "Bidder request shouldn't contain imp[0].ext.rp"
Expand Down Expand Up @@ -455,8 +455,8 @@ class AmpFpdSpec extends BaseSpec {
it.user.gender == fpdUser.gender
it.user.keywords == fpdUser.keywords
it.user.ext.data.keywords == fpdUser.ext.data.keywords
it.user.ext.data.buyeruid == fpdUser.ext.data.buyeruid
it.user.ext.data.buyeruids == fpdUser.ext.data.buyeruids
it.user.ext.data.buyerUid == fpdUser.ext.data.buyerUid
it.user.ext.data.buyerUids == fpdUser.ext.data.buyerUids
}

and: "Should should ignore any non FPD data"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class AnalyticsSpec extends BaseSpec {
ENABLED_DEBUG_LOG_MODE + ['analytics.log.enabled' : 'true',
'analytics.global.adapters': ''])


@Shared
PubStackAnalytics analytics = new PubStackAnalytics(Dependencies.networkServiceContainer).tap {
it.setResponse(PubStackResponse.getDefaultPubStackResponse(SCOPE_ID, Dependencies.networkServiceContainer.rootUri))
Expand Down
Loading
Loading