Skip to content

Commit 7a45f18

Browse files
committed
Fix possible source of flakiness
1 parent 7179094 commit 7a45f18

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

appsec/tests/integration/src/main/groovy/com/datadog/appsec/php/docker/AppSecContainer.groovy

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain
5656
.connectTimeout(Duration.ofSeconds(5))
5757
.build()
5858

59-
private MockDatadogAgent mockDatadogAgent = new MockDatadogAgent()
59+
private MockDatadogAgent mockDatadogAgent = new MockDatadogAgent()
6060

6161
AppSecContainer(Map options) {
6262
super(imageNameFuture(options))
@@ -191,7 +191,7 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain
191191
JsonOutput.toJson(it.value).getBytes(StandardCharsets.UTF_8)
192192
]
193193
}
194-
long newVersion = Instant.now().epochSecond
194+
long newVersion = nextRCVersion
195195
def rcr = new RemoteConfigResponse()
196196
rcr.clientConfigs = files.keySet() as List
197197
rcr.targetFiles = encodedFiles.collect {
@@ -244,7 +244,7 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain
244244
*/
245245
Supplier<RemoteConfigRequest> applyRemoteConfigRaw(Target target, Map<String, byte[]> files) {
246246
Map<String, byte[]> encodedFiles = files.findAll { it.value != null }
247-
long newVersion = Instant.now().epochSecond
247+
long newVersion = nextRCVersion
248248
def rcr = new RemoteConfigResponse()
249249
rcr.clientConfigs = files.keySet() as List
250250
rcr.targetFiles = encodedFiles.collect {
@@ -287,6 +287,11 @@ class AppSecContainer<SELF extends AppSecContainer<SELF>> extends GenericContain
287287
5_000 - (Math.max(0, System.currentTimeMillis() - start))) }
288288
}
289289

290+
// The next version number for the new RC. Using the timestamp helpers troubleshooting
291+
private static long getNextRCVersion() {
292+
Instant.now().toEpochMilli()
293+
}
294+
290295
void flushProfilingData() {
291296
if (!System.getProperty('USE_HELPER_RUST_COVERAGE')) {
292297
return

0 commit comments

Comments
 (0)