Skip to content

Commit 8c7b630

Browse files
committed
Revert "Check logs for errors at smoke tests cleanup (#8111)"
This reverts commit ab205f6.
1 parent a3e9bda commit 8c7b630

File tree

17 files changed

+134
-156
lines changed

17 files changed

+134
-156
lines changed

dd-smoke-tests/armeria-grpc/src/test/groovy/datadog/smoketest/ArmeriaSmokeTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class ArmeriaSmokeTest extends AbstractServerSmokeTest {
5757
})
5858
waitForTraceCount(totalInvocations) >= totalInvocations
5959
validateLogInjection() == totalInvocations
60+
checkLogPostExit()
61+
!logHasErrors
6062
}
6163

6264
void doAndValidateRequest(int id) {

dd-smoke-tests/asm-standalone-billing/src/test/groovy/datadog/smoketest/asmstandalonebilling/AsmStandaloneBillingSmokeTest.groovy

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ class AsmStandaloneBillingSmokeTest extends AbstractAsmStandaloneBillingSmokeTes
6464
def computedStatsHeader = lastTraceRequestHeaders.get('Datadog-Client-Computed-Stats')
6565
assert computedStatsHeader != null && computedStatsHeader == 'true'
6666

67-
then: 'metrics should be disabled'
68-
isLogPresent { it.contains('datadog.trace.agent.common.metrics.MetricsAggregatorFactory - tracer metrics disabled') }
67+
then:'metrics should be disabled'
68+
checkLogPostExit { log ->
69+
return log.contains('datadog.trace.agent.common.metrics.MetricsAggregatorFactory - tracer metrics disabled')
70+
}
6971
}
7072

7173
void 'test _dd.p.appsec propagation for appsec event'() {

dd-smoke-tests/custom-systemloader/src/test/groovy/datadog/smoketest/CustomSystemLoaderSmokeTest.groovy

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@ class CustomSystemLoaderSmokeTest extends AbstractSmokeTest {
3030
def "resource types loaded by custom system class-loader are transformed"() {
3131
when:
3232
testedProcess.waitFor(TIMEOUT_SECS, SECONDS)
33-
34-
then:
35-
testedProcess.exitValue() == 0
3633
int loadedResources = 0
3734
int transformedResources = 0
38-
forEachLogLine { String it ->
35+
checkLogPostExit {
3936
if (it =~ /Loading sample.app.Resource[$]Test[1-3] from TestLoader/) {
4037
loadedResources++
4138
}
4239
if (it =~ /Transformed.*class=sample.app.Resource[$]Test[1-3].*classloader=datadog.smoketest.systemloader.TestLoader/) {
4340
transformedResources++
4441
}
4542
}
43+
then:
44+
testedProcess.exitValue() == 0
4645
loadedResources == 3
4746
transformedResources == 3
47+
!logHasErrors
4848
}
4949
}

dd-smoke-tests/iast-util/src/main/java/datadog/smoketest/springboot/controller/SsrfController.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,7 @@ public String okHttp2(@RequestParam(value = "url") final String url) {
8080
} catch (final Exception e) {
8181
}
8282
client.getDispatcher().getExecutorService().shutdown();
83-
com.squareup.okhttp.ConnectionPool pool = client.getConnectionPool();
84-
if (pool != null) {
85-
pool.evictAll();
86-
}
83+
client.getConnectionPool().evictAll();
8784
return "ok";
8885
}
8986

dd-smoke-tests/iast-util/src/testFixtures/groovy/datadog/smoketest/AbstractIastServerSmokeTest.groovy

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ abstract class AbstractIastServerSmokeTest extends AbstractServerSmokeTest {
5454
try {
5555
processTestLogLines(closure)
5656
} catch (TimeoutException toe) {
57-
assert found, "No matching tainted found. Tainteds found: ${new JsonBuilder(tainteds).toPrettyString()}"
57+
checkLogPostExit(closure)
58+
if (!found) {
59+
throw new AssertionError("No matching tainted found. Tainteds found: ${new JsonBuilder(tainteds).toPrettyString()}")
60+
}
5861
}
5962
}
6063

@@ -80,7 +83,10 @@ abstract class AbstractIastServerSmokeTest extends AbstractServerSmokeTest {
8083
try {
8184
processTestLogLines(closure)
8285
} catch (TimeoutException toe) {
83-
assert found, "No matching vulnerability found. Vulnerabilities found: ${new JsonBuilder(vulnerabilities).toPrettyString()}"
86+
checkLogPostExit(closure)
87+
if (!found) {
88+
throw new AssertionError("No matching vulnerability found. Vulnerabilities found: ${new JsonBuilder(vulnerabilities).toPrettyString()}")
89+
}
8490
}
8591
}
8692

dd-smoke-tests/iast-util/src/testFixtures/groovy/datadog/smoketest/AbstractIastSpringBootTest.groovy

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,33 @@ abstract class AbstractIastSpringBootTest extends AbstractIastServerSmokeTest {
4141
]
4242
}
4343

44-
@Override
45-
boolean isErrorLog(String log) {
46-
if (log.contains('no such algorithm: DES for provider SUN')) {
47-
return false
48-
}
44+
void 'IAST subsystem starts'() {
45+
given: 'an initial request has succeeded'
46+
String url = "http://localhost:${httpPort}/greeting"
47+
def request = new Request.Builder().url(url).get().build()
48+
client.newCall(request).execute()
4949

50-
if (super.isErrorLog(log) || log.contains('Not starting IAST subsystem')) {
51-
return true
52-
}
53-
// Check that there's no logged exception about missing classes from Datadog.
54-
// We had this problem before with JDK9StackWalker.
55-
if (log.contains('java.lang.ClassNotFoundException: datadog/')) {
56-
return true
50+
when: 'logs are read'
51+
String startMsg = null
52+
String errorMsg = null
53+
checkLogPostExit {
54+
if (it.contains('Not starting IAST subsystem')) {
55+
errorMsg = it
56+
}
57+
if (it.contains('IAST is starting')) {
58+
startMsg = it
59+
}
60+
// Check that there's no logged exception about missing classes from Datadog.
61+
// We had this problem before with JDK9StackWalker.
62+
if (it.contains('java.lang.ClassNotFoundException: datadog/')) {
63+
errorMsg = it
64+
}
5765
}
5866

59-
return false
67+
then: 'there are no errors in the log and IAST has started'
68+
errorMsg == null
69+
startMsg != null
70+
!logHasErrors
6071
}
6172

6273
void 'default home page without errors'() {
@@ -73,6 +84,9 @@ abstract class AbstractIastSpringBootTest extends AbstractIastServerSmokeTest {
7384
responseBodyStr.contains('Sup Dawg')
7485
response.body().contentType().toString().contains('text/plain')
7586
response.code() == 200
87+
88+
checkLogPostExit()
89+
!logHasErrors
7690
}
7791

7892
void 'Multipart Request parameters'() {
@@ -317,21 +331,13 @@ abstract class AbstractIastSpringBootTest extends AbstractIastServerSmokeTest {
317331
def request = new Request.Builder().url(url).get().build()
318332

319333
when: 'ensure the controller is loaded'
320-
def resp = client.newCall(request).execute()
321-
322-
then:
323-
resp.code() == 200
324-
resp.close()
334+
client.newCall(request).execute()
325335

326-
and: 'a vulnerability pops in the logs (startup traces might not always be available)'
327-
boolean found = false
328-
isLogPresent { String log ->
329-
def vulns = parseVulnerabilitiesLog(log)
330-
vulns.any { vul ->
331-
vul.type == 'WEAK_HASH' &&
332-
vul.evidence.value == 'SHA1' &&
333-
vul.location.spanId > 0
334-
}
336+
then: 'a vulnerability pops in the logs (startup traces might not always be available)'
337+
hasVulnerabilityInLogs { vul ->
338+
vul.type == 'WEAK_HASH' &&
339+
vul.evidence.value == 'SHA1' &&
340+
vul.location.spanId > 0
335341
}
336342
}
337343

@@ -1056,10 +1062,8 @@ abstract class AbstractIastSpringBootTest extends AbstractIastServerSmokeTest {
10561062

10571063
then:
10581064
response.successful
1059-
// Vulnerability may have been detected in a previous request instead, check the full logs.
1060-
isLogPresent { String log ->
1061-
def vulns = parseVulnerabilitiesLog(log)
1062-
vulns.any { it.type == 'SESSION_REWRITING' }
1065+
hasVulnerabilityInLogs { vul ->
1066+
vul.type == 'SESSION_REWRITING'
10631067
}
10641068
}
10651069

dd-smoke-tests/java9-modules/src/test/groovy/datadog/smoketest/Java9ModulesSmokeTest.groovy

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@ class Java9ModulesSmokeTest extends AbstractSmokeTest {
2323
processBuilder.directory(new File(buildDirectory))
2424
}
2525

26-
@Override
27-
boolean isErrorLog(String line) {
28-
// FIXME: Too many bootstrap errors.
29-
return false
30-
}
31-
3226
def "Module application runs correctly"() {
3327
expect:
3428
assert testedProcess.waitFor(TIMEOUT_SECS, SECONDS)

dd-smoke-tests/jboss-modules/src/test/groovy/datadog/smoketest/AbstractModulesSmokeTest.groovy

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,27 @@ abstract class AbstractModulesSmokeTest extends AbstractSmokeTest {
2828
return processBuilder
2929
}
3030

31-
@Override
32-
boolean isErrorLog(String log) {
33-
super.isErrorLog(log) || log.contains("Cannot resolve type description") || log.contains("Instrumentation muzzled")
34-
}
35-
3631
def "example application runs without errors"() {
3732
when:
3833
testedProcess.waitFor()
34+
boolean instrumentedMessageClient = false
35+
checkLogPostExit {
36+
// check for additional OSGi class-loader issues
37+
if (it.contains("Cannot resolve type description") ||
38+
it.contains("Instrumentation muzzled")) {
39+
println it
40+
logHasErrors = true
41+
}
42+
if (it.contains("Transformed - instrumentation.target.class=datadog.smoketest.jbossmodules.client.MessageClient")) {
43+
println it
44+
instrumentedMessageClient = true
45+
}
46+
}
3947

40-
then: 'MessageClient is transformed'
48+
then:
4149
testedProcess.exitValue() == 0
42-
processTestLogLines {
43-
it.contains("Transformed - instrumentation.target.class=datadog.smoketest.jbossmodules.client.MessageClient")
44-
}
50+
instrumentedMessageClient
51+
!logHasErrors
4552
}
4653

4754
@Override

dd-smoke-tests/log-injection/src/test/groovy/datadog/smoketest/LogInjectionSmokeTest.groovy

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,21 +104,6 @@ abstract class LogInjectionSmokeTest extends AbstractSmokeTest {
104104
return processBuilder
105105
}
106106

107-
@Override
108-
boolean isErrorLog(String log) {
109-
// Exclude some errors that we consistently get because of the logging setups used here:
110-
if (log.contains('no applicable action for [immediateFlush]')) {
111-
return false
112-
}
113-
if (log.contains('JSONLayout contains an invalid element or attribute')) {
114-
return false
115-
}
116-
if (log.contains('JSONLayout has no parameter that matches element')) {
117-
return false
118-
}
119-
return super.isErrorLog(log)
120-
}
121-
122107
@Override
123108
def logLevel() {
124109
return "debug"

dd-smoke-tests/osgi/src/test/groovy/datadog/smoketest/AbstractOSGiSmokeTest.groovy

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,27 @@ abstract class AbstractOSGiSmokeTest extends AbstractSmokeTest {
3737

3838
abstract List<String> frameworkArguments()
3939

40-
@Override
41-
boolean isErrorLog(String log) {
42-
super.isErrorLog(log) || log.contains("Cannot resolve type description") || log.contains("Instrumentation muzzled")
43-
}
44-
4540
def "example application runs without errors"() {
4641
when:
4742
testedProcess.waitFor()
43+
boolean instrumentedMessageClient = false
44+
checkLogPostExit {
45+
// check for additional OSGi class-loader issues
46+
if (it.contains("Cannot resolve type description") ||
47+
it.contains("Instrumentation muzzled")) {
48+
println it
49+
logHasErrors = true
50+
}
51+
if (it.contains("Transformed - instrumentation.target.class=datadog.smoketest.osgi.client.MessageClient")) {
52+
println it
53+
instrumentedMessageClient = true
54+
}
55+
}
4856

4957
then:
5058
testedProcess.exitValue() == 0
51-
processTestLogLines {
52-
it.contains("Transformed - instrumentation.target.class=datadog.smoketest.osgi.client.MessageClient")
53-
}
59+
instrumentedMessageClient
60+
!logHasErrors
5461
}
5562

5663
@Override

0 commit comments

Comments
 (0)