Skip to content

Commit efaec7c

Browse files
committed
Fix flakiness test issue
1 parent 3794dcd commit efaec7c

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/test/groovy/org/prebid/server/functional/tests/module/optabletargeting/CacheStorageSpec.groovy

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ class CacheStorageSpec extends ModuleBaseSpec {
110110
}
111111

112112
def "PBS should update metrics for new saved text storage cache when no cached requests"() {
113-
given: "Default BidRequest with cache and device info"
113+
given: "Current value of metric prebid cache"
114+
def okInitialValue = getCurrentMetricValue(prebidServerStoredCacheService, METRIC_CREATIVE_WRITE_OK)
115+
116+
and: "Default BidRequest with cache and device info"
114117
def randomIfa = PBSUtils.randomString
115118
def system = PBSUtils.getRandomEnum(OperatingSystem)
116119
def bidRequest = getBidRequestForModuleCacheStorage(randomIfa, system)
@@ -133,8 +136,10 @@ class CacheStorageSpec extends ModuleBaseSpec {
133136
then: "PBS should update metrics for new saved text storage cache"
134137
def metrics = prebidServerStoredCacheService.sendCollectedMetricsRequest()
135138
assert metrics[METRIC_CREATIVE_SIZE_TEXT] == new String(encodeBase64(encode(targetingResult).bytes)).size()
136-
assert metrics[METRIC_CREATIVE_WRITE_OK] == 1
137-
assert metrics[METRIC_CREATIVE_TTL_TEXT] == targetingConfig.cache.ttlSeconds
139+
assert metrics[METRIC_CREATIVE_WRITE_OK] == okInitialValue + 1
140+
141+
and: "PBS should include histogram metric"
142+
assert metrics[METRIC_CREATIVE_TTL_TEXT]
138143
}
139144

140145
def "PBS should update metrics for stored cached requests cache when proper record present"() {

0 commit comments

Comments
 (0)