diff --git a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy index fcb735d7186..63ba2516ff4 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/BaseSpec.groovy @@ -43,7 +43,7 @@ abstract class BaseSpec extends Specification implements ObjectMapperWrapper { protected static final Map GENERIC_ALIAS_CONFIG = ["adapters.generic.aliases.alias.enabled" : "true", "adapters.generic.aliases.alias.endpoint": "$networkServiceContainer.rootUri/auction".toString()] - protected final PrebidServerService defaultPbsService = pbsServiceFactory.getService([:]) + protected static final PrebidServerService defaultPbsService = pbsServiceFactory.getService([:]) def setupSpec() { prebidCache.setResponse() diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy index 9ca353e0088..73e44cc3232 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/AbTestingModuleSpec.groovy @@ -48,8 +48,13 @@ class AbTestingModuleSpec extends ModuleBaseSpec { private final static Map MULTI_MODULE_CONFIG = getResponseCorrectionConfig() + getOrtb2BlockingSettings() + ['hooks.host-execution-plan': null] - private final static PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getOrtb2BlockingSettings()) - private final static PrebidServerService pbsServiceWithMultipleModules = pbsServiceFactory.getService(MULTI_MODULE_CONFIG) + private static final PrebidServerService ortbModulePbsService = pbsServiceFactory.getService(getOrtb2BlockingSettings()) + private static final PrebidServerService pbsServiceWithMultipleModules = pbsServiceFactory.getService(MULTI_MODULE_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(getOrtb2BlockingSettings()) + pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG) + } def "PBS shouldn't apply a/b test config when config of ab test is disabled"() { given: "Default bid request with verbose trace" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy index 82727b16a56..23316766a7d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/GeneralModuleSpec.groovy @@ -45,8 +45,13 @@ class GeneralModuleSpec extends ModuleBaseSpec { getOrtb2BlockingSettings() + ['hooks.host-execution-plan': encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, MODULES_STAGES))] - private final static PrebidServerService pbsServiceWithMultipleModule = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) - private final static PrebidServerService pbsServiceWithMultipleModuleWithRequireInvoke = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + private static final PrebidServerService pbsServiceWithMultipleModule = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) + private static final PrebidServerService pbsServiceWithMultipleModuleWithRequireInvoke = pbsServiceFactory.getService(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG + DISABLED_INVOKE_CONFIG) + pbsServiceFactory.removeContainer(MULTI_MODULE_CONFIG + ENABLED_INVOKE_CONFIG) + } def "PBS should call all modules and traces response when account config is empty and require-config-to-invoke is disabled"() { given: "Default bid request with verbose trace" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy index 8a99628b70c..82355a47996 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/analyticstag/AnalyticsTagsModuleSpec.groovy @@ -30,7 +30,11 @@ import static org.prebid.server.functional.model.response.auction.ErrorType.PREB class AnalyticsTagsModuleSpec extends ModuleBaseSpec { - private final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(ortb2BlockingSettings) + private static final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(getOrtb2BlockingSettings()) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(getOrtb2BlockingSettings()) + } def "PBS should include analytics tag for ortb2-blocking module in response when request and account allow client details"() { given: "Default account with module config" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy index bb644508090..2b2de98750b 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/ortb2blocking/Ortb2BlockingSpec.groovy @@ -59,9 +59,14 @@ class Ortb2BlockingSpec extends ModuleBaseSpec { private static final String WILDCARD = '*' private static final Map IX_CONFIG = ["adapters.ix.enabled" : "true", "adapters.ix.endpoint": "$networkServiceContainer.rootUri/auction".toString()] + private static final Map PBS_CONFIG = getOrtb2BlockingSettings() + IX_CONFIG + + ['adapter-defaults.ortb.multiformat-supported': 'false'] - private final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(ortb2BlockingSettings + IX_CONFIG + - ['adapter-defaults.ortb.multiformat-supported': 'false']) + private static final PrebidServerService pbsServiceWithEnabledOrtb2Blocking = pbsServiceFactory.getService(PBS_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(PBS_CONFIG) + } def "PBS should send original array ortb2 attribute to bidder when enforce blocking is disabled"() { given: "Default bid request with proper ortb attribute" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy index 68b00bdd0d1..1f6bbcaf13d 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/pbrequestcorrection/PbRequestCorrectionSpec.groovy @@ -27,7 +27,11 @@ class PbRequestCorrectionSpec extends ModuleBaseSpec { private static final String ANDROID = "android" private static final String IOS = "IOS" - private PrebidServerService pbsServiceWithRequestCorrectionModule = pbsServiceFactory.getService(requestCorrectionSettings) + private static final PrebidServerService pbsServiceWithRequestCorrectionModule = pbsServiceFactory.getService(getRequestCorrectionSettings()) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(getRequestCorrectionSettings()) + } def "PBS should remove positive instl from imps for android app when request correction is enabled for account"() { given: "Android APP bid request with version lover then version threshold" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy index c848c30e2e4..1694a17dbaf 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/responsecorrenction/ResponseCorrectionSpec.groovy @@ -32,12 +32,16 @@ import static org.prebid.server.functional.model.response.auction.MediaType.VIDE class ResponseCorrectionSpec extends ModuleBaseSpec { - private final PrebidServerService pbsServiceWithResponseCorrectionModule = pbsServiceFactory.getService( - ["adapter-defaults.modifying-vast-xml-allowed": "false", - "adapters.generic.modifying-vast-xml-allowed": "false"] + - responseCorrectionConfig) - private final static int OPTIMAL_MAX_LENGTH = 20 + private static final Map PBS_CONFIG = ["adapter-defaults.modifying-vast-xml-allowed": "false", + "adapters.generic.modifying-vast-xml-allowed": "false"] + + getResponseCorrectionConfig() + + private static final PrebidServerService pbsServiceWithResponseCorrectionModule = pbsServiceFactory.getService(PBS_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(PBS_CONFIG) + } def "PBS shouldn't modify response when in account correction module disabled"() { given: "Start up time" diff --git a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy index c49743b275b..7c6e90d263e 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/module/richmedia/RichMediaFilterSpec.groovy @@ -27,13 +27,22 @@ class RichMediaFilterSpec extends ModuleBaseSpec { private static final String PATTERN_NAME = PBSUtils.randomString private static final String PATTERN_NAME_ACCOUNT = PBSUtils.randomString - private final PrebidServerService pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(getRichMediaFilterSettings(PATTERN_NAME)) - private final PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService( - (getRichMediaFilterSettings(PATTERN_NAME) + ["hooks.host-execution-plan": encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, PB_RICHMEDIA_FILTER, [ALL_PROCESSED_BID_RESPONSES]).tap { + private static final Map DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG = getRichMediaFilterSettings(PATTERN_NAME, false) + private static final Map SPECIFIC_PATTERN_NAME_CONFIG = getRichMediaFilterSettings(PATTERN_NAME) + private static final Map SNAKE_SPECIFIC_PATTERN_NAME_CONFIG = (getRichMediaFilterSettings(PATTERN_NAME) + + ["hooks.host-execution-plan": encode(ExecutionPlan.getSingleEndpointExecutionPlan(OPENRTB2_AUCTION, PB_RICHMEDIA_FILTER, [ALL_PROCESSED_BID_RESPONSES]).tap { endpoints.values().first().stages.values().first().groups.first.hookSequenceSnakeCase = [new HookId(moduleCodeSnakeCase: PB_RICHMEDIA_FILTER.code, hookImplCodeSnakeCase: "${PB_RICHMEDIA_FILTER.code}-${ALL_PROCESSED_BID_RESPONSES.value}-hook")] - })]) - .collectEntries { key, value -> [(key.toString()): value.toString()] }) - private final PrebidServerService pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(getRichMediaFilterSettings(PATTERN_NAME, false)) + })]).collectEntries { key, value -> [(key.toString()): value.toString()] } + + private static final PrebidServerService pbsServiceWithDisabledMediaFilter = pbsServiceFactory.getService(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) + private static final PrebidServerService pbsServiceWithEnabledMediaFilter = pbsServiceFactory.getService(SPECIFIC_PATTERN_NAME_CONFIG) + private static final PrebidServerService pbsServiceWithEnabledMediaFilterAndDifferentCaseStrategy = pbsServiceFactory.getService(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(DISABLED_FILTER_SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceFactory.removeContainer(SPECIFIC_PATTERN_NAME_CONFIG) + pbsServiceFactory.removeContainer(SNAKE_SPECIFIC_PATTERN_NAME_CONFIG) + } def "PBS should process request without rich media module when host config have empty settings"() { given: "Prebid server with empty settings for module" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprSetUidSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprSetUidSpec.groovy index ce8d308c3a2..fa4c833baf2 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprSetUidSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GdprSetUidSpec.groovy @@ -41,6 +41,10 @@ class GdprSetUidSpec extends PrivacyBaseSpec { private static final PrebidServerService prebidServerService = pbsServiceFactory.getService(VENDOR_GENERIC_PBS_CONFIG) + def cleanupSpec() { + pbsServiceFactory.removeContainer(VENDOR_GENERIC_PBS_CONFIG) + } + def "PBS setuid shouldn't failed with tcf when purpose access device not enforced"() { given: "Default setuid request with account" def setuidRequest = SetuidRequest.defaultSetuidRequest.tap { diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy index c200c154bab..a462e91a1ba 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppCookieSyncSpec.groovy @@ -33,7 +33,11 @@ class GppCookieSyncSpec extends BaseSpec { "adapters.${GENERIC.value}.usersync.${USER_SYNC_TYPE.value}.url" : USER_SYNC_URL, "adapters.${GENERIC.value}.usersync.${USER_SYNC_TYPE.value}.support-cors": CORS_SUPPORT.toString()] - private PrebidServerService prebidServerService = pbsServiceFactory.getService(GENERIC_CONFIG) + private static PrebidServerService prebidServerService = pbsServiceFactory.getService(GENERIC_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(GENERIC_CONFIG) + } def "PBS cookie sync request should set GDPR to 1 when gpp_sid contains 2"() { given: "Request without GDPR and GPP SID" @@ -204,9 +208,9 @@ class GppCookieSyncSpec extends BaseSpec { def "PBS should return empty gpp and gppSid in usersync url when gpp and gppSid is not present in request"() { given: "Pbs config with usersync.#userSyncFormat.url" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"]) + def pbsConfig = ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default CookieSyncRequest without gpp and gppSid" def cookieSyncRequest = CookieSyncRequest.defaultCookieSyncRequest.tap { @@ -222,15 +226,18 @@ class GppCookieSyncSpec extends BaseSpec { assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "gpp").isEmpty() assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "gpp_sid").isEmpty() + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: userSyncFormat << [REDIRECT, IFRAME] } def "PBS should populate gpp and gppSid in usersync url when gpp and gppSid is present in request"() { given: "Pbs config with usersync.#userSyncFormat.url" - def prebidServerService = pbsServiceFactory.getService( - ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), - "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"]) + def pbsConfig = ["adapters.generic.usersync.${userSyncFormat.value}.url" : "$networkServiceContainer.rootUri/generic-usersync&redir={{redirect_url}}".toString(), + "adapters.generic.usersync.${userSyncFormat.value}.support-cors": "false"] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default CookieSyncRequest with gpp and gppSid" def gpp = PBSUtils.randomString @@ -248,6 +255,9 @@ class GppCookieSyncSpec extends BaseSpec { assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "gpp") == gpp assert HttpUtil.findUrlParameterValue(bidderStatus.userSync?.url, "gpp_sid") == gppSid + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: userSyncFormat << [REDIRECT, IFRAME] } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy index f684cb10313..8d358306721 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/GppSyncUserActivitiesSpec.groovy @@ -1778,9 +1778,10 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should process rule when geo doesn't intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + + def pbsConfig = GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.geo-info.[0].country": countyConfig, - "geolocation.configurations.geo-info.[0].region" : regionConfig]) + "geolocation.configurations.geo-info.[0].region" : regionConfig] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with account connection" def accountId = PBSUtils.randomNumber as String @@ -1819,6 +1820,9 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def metrics = prebidServerService.sendCollectedMetricsRequest() assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1 + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: countyConfig | regionConfig | conditionGeo null | null | ["$USA.ISOAlpha3".toString()] @@ -1830,9 +1834,10 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS setuid should process rule when geo doesn't intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + + def pbsConfig = GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, - "geolocation.configurations.[0].geo-info.region" : regionConfig]) + "geolocation.configurations.[0].geo-info.region" : regionConfig] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default set uid request" def accountId = PBSUtils.randomString @@ -1875,6 +1880,9 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def metrics = prebidServerService.sendCollectedMetricsRequest() assert metrics[PROCESSED_ACTIVITY_RULES_COUNT.getValue(setuidRequest, SYNC_USER)] == 1 + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: countyConfig | regionConfig | conditionGeo null | null | [USA.ISOAlpha3] @@ -1885,9 +1893,10 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should disallowed rule when device.geo intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + + def pbsConfig = GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, - "geolocation.configurations.[0].geo-info.region" : regionConfig]) + "geolocation.configurations.[0].geo-info.region" : regionConfig] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with account connection" def accountId = PBSUtils.randomNumber as String @@ -1928,6 +1937,9 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { assert metrics[TEMPLATE_REQUEST_DISALLOWED_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1 assert metrics[TEMPLATE_ADAPTER_DISALLOWED_COUNT.getValue(cookieSyncRequest, SYNC_USER)] == 1 + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: countyConfig | regionConfig | conditionGeo USA.ISOAlpha3 | null | [USA.ISOAlpha3] @@ -1936,9 +1948,10 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS setuid should disallowed rule when device.geo intersection"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + + def pbsConfig = GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": countyConfig, - "geolocation.configurations.[0].geo-info.region" : regionConfig]) + "geolocation.configurations.[0].geo-info.region" : regionConfig] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Default set uid request" def accountId = PBSUtils.randomString @@ -1978,6 +1991,9 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { assert exception.statusCode == INVALID_STATUS_CODE assert exception.responseBody == INVALID_STATUS_MESSAGE + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) + where: countyConfig | regionConfig | conditionGeo USA.ISOAlpha3 | null | [USA.ISOAlpha3] @@ -1986,9 +2002,10 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { def "PBS cookie sync should fetch geo once when gpp sync user and account require geo look up"() { given: "Pbs config with geo location" - def prebidServerService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GEO_LOCATION + + def pbsConfig = GENERAL_PRIVACY_CONFIG + GEO_LOCATION + ["geolocation.configurations.[0].geo-info.country": USA.ISOAlpha3, - "geolocation.configurations.[0].geo-info.region" : ALABAMA.abbreviation]) + "geolocation.configurations.[0].geo-info.region" : ALABAMA.abbreviation] + def prebidServerService = pbsServiceFactory.getService(pbsConfig) and: "Cookie sync request with account connection" def accountId = PBSUtils.randomNumber as String @@ -2034,5 +2051,8 @@ class GppSyncUserActivitiesSpec extends PrivacyBaseSpec { and: "Metrics processed across activities should be updated" assert metrics[GEO_LOCATION_REQUESTS] == 1 assert metrics[GEO_LOCATION_SUCCESSFUL] == 1 + + cleanup: "Stop and remove pbs container" + pbsServiceFactory.removeContainer(pbsConfig) } } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy index d4cbf17e2dd..ed633ec5316 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/PrivacyBaseSpec.groovy @@ -34,7 +34,6 @@ import org.prebid.server.functional.util.privacy.ConsentString import org.prebid.server.functional.util.privacy.TcfConsent import org.prebid.server.functional.util.privacy.gpp.GppConsent import org.prebid.server.functional.util.privacy.gpp.UsNatV1Consent -import spock.lang.Shared import static org.prebid.server.functional.model.bidder.BidderName.GENERIC import static org.prebid.server.functional.model.bidder.BidderName.OPENX @@ -78,13 +77,9 @@ abstract class PrivacyBaseSpec extends BaseSpec { "gdpr.host-vendor-id" : GENERIC_VENDOR_ID as String, "adapters.generic.ccpa-enforced" : "true"] - @Shared protected static final int PURPOSES_ONLY_GVL_VERSION = PBSUtils.getRandomNumber(0, 4095) - @Shared protected static final int LEG_INT_PURPOSES_ONLY_GVL_VERSION = PBSUtils.getRandomNumberWithExclusion(PURPOSES_ONLY_GVL_VERSION, 0, 4095) - @Shared protected static final int LEG_INT_AND_FLEXIBLE_PURPOSES_GVL_VERSION = PBSUtils.getRandomNumberWithExclusion([PURPOSES_ONLY_GVL_VERSION, LEG_INT_PURPOSES_ONLY_GVL_VERSION], 0, 4095) - @Shared protected static final int PURPOSES_AND_LEG_INT_PURPOSES_GVL_VERSION = PBSUtils.getRandomNumberWithExclusion([PURPOSES_ONLY_GVL_VERSION, LEG_INT_PURPOSES_ONLY_GVL_VERSION, LEG_INT_AND_FLEXIBLE_PURPOSES_GVL_VERSION], 0, 4095) protected static final int EXPONENTIAL_BACKOFF_MAX_DELAY = 1 @@ -109,13 +104,12 @@ abstract class PrivacyBaseSpec extends BaseSpec { protected static final Map GENERAL_PRIVACY_CONFIG = GENERIC_CONFIG + GDPR_VENDOR_LIST_CONFIG + GENERIC_VENDOR_CONFIG + RETRY_POLICY_EXPONENTIAL_CONFIG - @Shared - protected final PrebidServerService privacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GDPR_EEA_COUNTRY) - - @Shared - protected final PrebidServerService activityPbsService = pbsServiceFactory.getService(OPENX_CONFIG + SETTING_CONFIG + GENERAL_PRIVACY_CONFIG) + protected static PrebidServerService privacyPbsService + protected static PrebidServerService activityPbsService def setupSpec() { + privacyPbsService = pbsServiceFactory.getService(GENERAL_PRIVACY_CONFIG + GDPR_EEA_COUNTRY) + activityPbsService = pbsServiceFactory.getService(OPENX_CONFIG + SETTING_CONFIG + GENERAL_PRIVACY_CONFIG) vendorListResponse.setResponse() } diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfBasicTransmitEidsActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfBasicTransmitEidsActivitiesSpec.groovy index 882595060fa..924ee285661 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfBasicTransmitEidsActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/TcfBasicTransmitEidsActivitiesSpec.groovy @@ -30,7 +30,11 @@ class TcfBasicTransmitEidsActivitiesSpec extends PrivacyBaseSpec { private static final Map PBS_CONFIG = SETTING_CONFIG + GENERIC_VENDOR_CONFIG + GENERIC_CONFIG + ["gdpr.vendorlist.v2.http-endpoint-template": null, "gdpr.vendorlist.v3.http-endpoint-template": null] - private final PrebidServerService activityPbsServiceExcludeGvl = pbsServiceFactory.getService(PBS_CONFIG) + private static final PrebidServerService activityPbsServiceExcludeGvl = pbsServiceFactory.getService(PBS_CONFIG) + + def cleanupSpec() { + pbsServiceFactory.removeContainer(PBS_CONFIG) + } def "PBS should leave the original request with eids data when requireConsent is enabled and #enforcementRequirements.purpose have any basic consent"() { given: "Default Generic BidRequests with Eid field" diff --git a/src/test/groovy/org/prebid/server/functional/tests/privacy/TransmitEidsOrtbConverterActivitiesSpec.groovy b/src/test/groovy/org/prebid/server/functional/tests/privacy/TransmitEidsOrtbConverterActivitiesSpec.groovy index d0fa0583685..e5534476613 100644 --- a/src/test/groovy/org/prebid/server/functional/tests/privacy/TransmitEidsOrtbConverterActivitiesSpec.groovy +++ b/src/test/groovy/org/prebid/server/functional/tests/privacy/TransmitEidsOrtbConverterActivitiesSpec.groovy @@ -54,6 +54,7 @@ class TransmitEidsOrtbConverterActivitiesSpec extends PrivacyBaseSpec { def cleanupSpec() { privacyPbsContainerWithMultipleGvlWithElderOrtb.stop() + pbsServiceFactory.removeContainer(PBS_CONFIG + ["adapters.generic.ortb-version": "2.5"]) } def "PBS should leave the original request with ext.eids data for elder ortb when requireConsent is enabled and #enforcementRequirements.purpose have any basic consent"() {