@@ -126,6 +126,7 @@ class CacheSpec extends BaseSpec {
126126 def " PBS should cache bids without api-key header when targeting is specified and api-key-secured disabled" () {
127127 given : " Pbs config with disabled api-key-secured and pbc.api.key"
128128 def apiKey = PBSUtils . randomString
129+ def pbsConfig = [' pbc.api.key' : apiKey, ' cache.api-key-secured' : ' false' ]
129130 def pbsService = pbsServiceFactory. getService([' pbc.api.key' : apiKey, ' cache.api-key-secured' : ' false' ])
130131
131132 and : " Default BidRequest with cache, targeting"
@@ -142,12 +143,16 @@ class CacheSpec extends BaseSpec {
142143
143144 and : " PBS call shouldn't include api-key"
144145 assert ! prebidCache. getRequestHeaders(bidRequest. imp[0 ]. id)[PBS_API_HEADER ]
146+
147+ cleanup : " Stop and remove pbs container"
148+ pbsServiceFactory. removeContainer(pbsConfig)
145149 }
146150
147151 def " PBS should cache bids with api-key header when targeting is specified and api-key-secured enabled" () {
148152 given : " Pbs config with api-key-secured and pbc.api.key"
149153 def apiKey = PBSUtils . randomString
150- def pbsService = pbsServiceFactory. getService([' pbc.api.key' : apiKey, ' cache.api-key-secured' : ' true' ])
154+ def pbsConfig = [' pbc.api.key' : apiKey, ' cache.api-key-secured' : ' true' ]
155+ def pbsService = pbsServiceFactory. getService(pbsConfig)
151156
152157 and : " Default BidRequest with cache, targeting"
153158 def bidRequest = BidRequest . defaultBidRequest. tap {
@@ -163,6 +168,9 @@ class CacheSpec extends BaseSpec {
163168
164169 and : " PBS call should include api-key"
165170 assert prebidCache. getRequestHeaders(bidRequest. imp[0 ]. id)[PBS_API_HEADER ] == [apiKey]
171+
172+ cleanup : " Stop and remove pbs container"
173+ pbsServiceFactory. removeContainer(pbsConfig)
166174 }
167175
168176 def " PBS should cache banner bids with cache key that include account and datacenter short name when append-trace-info-to-cache-id enabled" () {
0 commit comments