@@ -13,8 +13,6 @@ import org.prebid.server.functional.model.request.auction.BidRequest
1313import org.prebid.server.functional.model.request.auction.DistributionChannel
1414import org.prebid.server.functional.model.request.auction.Regs
1515import org.prebid.server.functional.model.request.auction.RegsExt
16- import org.prebid.server.functional.service.PrebidServerService
17- import org.prebid.server.functional.testcontainers.container.PrebidServerContainer
1816import org.prebid.server.functional.util.PBSUtils
1917import org.prebid.server.functional.util.privacy.BogusConsent
2018import org.prebid.server.functional.util.privacy.CcpaConsent
@@ -320,10 +318,8 @@ class GdprAmpSpec extends PrivacyBaseSpec {
320318 def startTime = Instant . now()
321319
322320 and : " Create new container"
323- def serverContainer = new PrebidServerContainer (GDPR_VENDOR_LIST_CONFIG +
324- [" adapters.generic.meta-info.vendor-id" : GENERIC_VENDOR_ID as String ])
325- serverContainer. start()
326- def privacyPbsService = new PrebidServerService (serverContainer)
321+ def config = GDPR_VENDOR_LIST_CONFIG + [" adapters.generic.meta-info.vendor-id" : GENERIC_VENDOR_ID as String ]
322+ def defaultPrivacyPbsService = pbsServiceFactory. getService(config)
327323
328324 and : " Prepare tcf consent string"
329325 def tcfConsent = new TcfConsent.Builder ()
@@ -347,21 +343,21 @@ class GdprAmpSpec extends PrivacyBaseSpec {
347343 vendorListResponse. setResponse(tcfPolicyVersion)
348344
349345 when : " PBS processes amp request"
350- privacyPbsService . sendAmpRequest(ampRequest)
346+ defaultPrivacyPbsService . sendAmpRequest(ampRequest)
351347
352348 then : " Used vendor list have proper specification version of GVL"
353349 def properVendorListPath = VENDOR_LIST_PATH . replace(" {VendorVersion}" , tcfPolicyVersion. vendorListVersion. toString())
354- PBSUtils . waitUntil { privacyPbsService . isFileExist(properVendorListPath) }
355- def vendorList = privacyPbsService . getValueFromContainer(properVendorListPath, VendorListConsent . class)
350+ PBSUtils . waitUntil { defaultPrivacyPbsService . isFileExist(properVendorListPath) }
351+ def vendorList = defaultPrivacyPbsService . getValueFromContainer(properVendorListPath, VendorListConsent . class)
356352 assert vendorList. tcfPolicyVersion == tcfPolicyVersion. vendorListVersion
357353
358354 and : " Logs should contain proper vendor list version"
359- def logs = privacyPbsService . getLogsByTime(startTime)
355+ def logs = defaultPrivacyPbsService . getLogsByTime(startTime)
360356 assert getLogsByText(logs, " Created new TCF 2 vendor list for version " +
361357 " v${ tcfPolicyVersion.vendorListVersion} .${ tcfPolicyVersion.vendorListVersion} " )
362358
363- cleanup : " Stop container with default request "
364- serverContainer . stop( )
359+ cleanup : " Stop and remove pbs container "
360+ pbsServiceFactory . removeContainer(config )
365361
366362 where :
367363 tcfPolicyVersion << [TCF_POLICY_V2 , TCF_POLICY_V4 , TCF_POLICY_V5 ]
@@ -410,7 +406,10 @@ class GdprAmpSpec extends PrivacyBaseSpec {
410406 }
411407
412408 def " PBS amp should emit the same error without a second GVL list request if a retry is too soon for the exponential-backoff" () {
413- given : " Test start time"
409+ given : " Prebid server with privacy settings"
410+ def defaultPrivacyPbsService = pbsServiceFactory. getService(GENERAL_PRIVACY_CONFIG )
411+
412+ and : " Test start time"
414413 def startTime = Instant . now()
415414
416415 and : " Prepare tcf consent string"
@@ -438,33 +437,36 @@ class GdprAmpSpec extends PrivacyBaseSpec {
438437 vendorListResponse. setResponse(tcfPolicyVersion, Delay . seconds(EXPONENTIAL_BACKOFF_MAX_DELAY + 3 ))
439438
440439 when : " PBS processes amp request"
441- privacyPbsService . sendAmpRequest(ampRequest)
440+ defaultPrivacyPbsService . sendAmpRequest(ampRequest)
442441
443442 then : " PBS shouldn't fetch vendor list"
444443 def vendorListPath = VENDOR_LIST_PATH . replace(" {VendorVersion}" , tcfPolicyVersion. vendorListVersion. toString())
445- assert ! privacyPbsService . isFileExist(vendorListPath)
444+ assert ! defaultPrivacyPbsService . isFileExist(vendorListPath)
446445
447446 and : " Logs should contain proper vendor list version"
448- def logs = privacyPbsService . getLogsByTime(startTime)
447+ def logs = defaultPrivacyPbsService . getLogsByTime(startTime)
449448 def tcfError = " TCF 2 vendor list for version v${ tcfPolicyVersion.vendorListVersion} .${ tcfPolicyVersion.vendorListVersion} not found, started downloading."
450449 assert getLogsByText(logs, tcfError)
451450
452451 and : " Second start for fetch second round of logs"
453452 def secondStartTime = Instant . now()
454453
455454 when : " PBS processes amp request"
456- privacyPbsService . sendAmpRequest(ampRequest)
455+ defaultPrivacyPbsService . sendAmpRequest(ampRequest)
457456
458457 then : " PBS shouldn't fetch vendor list"
459- assert ! privacyPbsService . isFileExist(vendorListPath)
458+ assert ! defaultPrivacyPbsService . isFileExist(vendorListPath)
460459
461460 and : " Logs should contain proper vendor list version"
462- def logsSecond = privacyPbsService . getLogsByTime(secondStartTime)
461+ def logsSecond = defaultPrivacyPbsService . getLogsByTime(secondStartTime)
463462 assert getLogsByText(logsSecond, tcfError)
464463
465464 and : " Reset vendor list response"
466465 vendorListResponse. reset()
467466
467+ cleanup : " Stop and remove pbs container"
468+ pbsServiceFactory. removeContainer(GENERAL_PRIVACY_CONFIG )
469+
468470 where :
469471 tcfPolicyVersion << [TCF_POLICY_V2 , TCF_POLICY_V4 , TCF_POLICY_V5 ]
470472 }
@@ -659,7 +661,10 @@ class GdprAmpSpec extends PrivacyBaseSpec {
659661 }
660662
661663 def " PBS amp should set 3 for tcfPolicyVersion when tcfPolicyVersion is #tcfPolicyVersion" () {
662- given : " Tcf consent setup"
664+ given : " Prebid server with privacy settings"
665+ def defaultPrivacyPbsService = pbsServiceFactory. getService(GENERAL_PRIVACY_CONFIG )
666+
667+ and : " Tcf consent setup"
663668 def tcfConsent = new TcfConsent.Builder ()
664669 .setPurposesLITransparency(BASIC_ADS )
665670 .setTcfPolicyVersion(tcfPolicyVersion. value)
@@ -681,14 +686,17 @@ class GdprAmpSpec extends PrivacyBaseSpec {
681686 vendorListResponse. setResponse(tcfPolicyVersion)
682687
683688 when : " PBS processes amp request"
684- privacyPbsService . sendAmpRequest(ampRequest)
689+ defaultPrivacyPbsService . sendAmpRequest(ampRequest)
685690
686691 then : " Used vendor list have proper specification version of GVL"
687692 def properVendorListPath = VENDOR_LIST_PATH . replace(" {VendorVersion}" , tcfPolicyVersion. vendorListVersion. toString())
688- PBSUtils . waitUntil { privacyPbsService . isFileExist(properVendorListPath) }
689- def vendorList = privacyPbsService . getValueFromContainer(properVendorListPath, VendorListConsent . class)
693+ PBSUtils . waitUntil { defaultPrivacyPbsService . isFileExist(properVendorListPath) }
694+ def vendorList = defaultPrivacyPbsService . getValueFromContainer(properVendorListPath, VendorListConsent . class)
690695 assert vendorList. gvlSpecificationVersion == V3
691696
697+ cleanup : " Stop and remove pbs container"
698+ pbsServiceFactory. removeContainer(GENERAL_PRIVACY_CONFIG )
699+
692700 where :
693701 tcfPolicyVersion << [TCF_POLICY_V4 , TCF_POLICY_V5 ]
694702 }
0 commit comments