Skip to content

Commit 546f797

Browse files
authored
Fail smoke tests if received traces cannot be decoded (#7520)
1 parent 115998f commit 546f797

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

dd-smoke-tests/src/main/groovy/datadog/smoketest/AbstractSmokeTest.groovy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ abstract class AbstractSmokeTest extends ProcessManager {
3434
@Shared
3535
private String remoteConfigResponse
3636

37+
@Shared
38+
private Throwable traceDecodingFailure = null
39+
3740
@Shared
3841
@AutoCleanup
3942
protected TestHttpServer server = httpServer {
@@ -74,6 +77,7 @@ abstract class AbstractSmokeTest extends ProcessManager {
7477
} catch (Throwable t) {
7578
println("=== Failure during message v0.4 decoding ===")
7679
t.printStackTrace(System.out)
80+
traceDecodingFailure = t
7781
throw t
7882
}
7983
}
@@ -95,6 +99,7 @@ abstract class AbstractSmokeTest extends ProcessManager {
9599
} catch (Throwable t) {
96100
println("=== Failure during message v0.5 decoding ===")
97101
t.printStackTrace(System.out)
102+
traceDecodingFailure = t
98103
throw t
99104
}
100105
}
@@ -163,10 +168,14 @@ abstract class AbstractSmokeTest extends ProcessManager {
163168
traceCount.set(0)
164169
decodeTraces.clear()
165170
remoteConfigResponse = "{}"
171+
traceDecodingFailure = null
166172
}
167173

168174
def cleanup() {
169175
decodeTraces.clear()
176+
if (traceDecodingFailure != null) {
177+
throw traceDecodingFailure
178+
}
170179
}
171180

172181
def setupSpec() {
@@ -229,6 +238,9 @@ abstract class AbstractSmokeTest extends ProcessManager {
229238

230239
int waitForTraceCount(int count, PollingConditions conditions) {
231240
conditions.eventually {
241+
if (traceDecodingFailure != null) {
242+
throw traceDecodingFailure
243+
}
232244
assert traceCount.get() >= count
233245
}
234246
traceCount.get()
@@ -237,6 +249,9 @@ abstract class AbstractSmokeTest extends ProcessManager {
237249
void waitForTrace(final PollingConditions poll, final Function<DecodedTrace, Boolean> predicate) {
238250
assert decode != null // override decodedTracesCallback to avoid this and enable trace decoding
239251
poll.eventually {
252+
if (traceDecodingFailure != null) {
253+
throw traceDecodingFailure
254+
}
240255
assert decodeTraces.find { predicate.apply(it) } != null
241256
}
242257
}

0 commit comments

Comments
 (0)