Skip to content

Commit b04a38c

Browse files
authored
Remove flakiness from CustomLogManagerTest and CustomMBeanServerBuilder (#8241)
These tests historically set a dummy DD_API_KEY because that was required by the profiler. However setting DD_API_KEY will now result in these tests reaching out to the intake/backend because they won't be able to connect to an agent and the fallback for certain features like telemetry is to try and contact intake (these tests are not run alongside any test agent.) When the call to intake/backend stalls this can lead to flaky timeouts. We shouldn't be contacting the real intake during testing so this removes the dummy api-keys from CustomLogManagerTest and CustomMBeanServerBuilder. This is ok because profiling no longer needs DD_API_KEY set locally.
1 parent aa815e4 commit b04a38c

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

dd-java-agent/src/test/groovy/datadog/trace/agent/CustomLogManagerTest.groovy

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import spock.lang.Timeout
99
class CustomLogManagerTest extends Specification {
1010

1111
private static final String DEFAULT_LOG_LEVEL = "debug"
12-
private static final String API_KEY = "01234567890abcdef123456789ABCDEF"
1312

1413
// Run all tests using forked jvm because groovy has already set the global log manager
1514
def "agent services starts up in premain with no custom log manager set"() {
@@ -23,7 +22,7 @@ class CustomLogManagerTest extends Specification {
2322
"-Ddatadog.slf4j.simpleLogger.defaultLogLevel=$DEFAULT_LOG_LEVEL"
2423
] as String[]
2524
, "" as String[]
26-
, ["DD_API_KEY": API_KEY]
25+
, [:]
2726
, true) == 0
2827
}
2928

@@ -39,7 +38,7 @@ class CustomLogManagerTest extends Specification {
3938
"-Djava.util.logging.manager=jvmbootstraptest.CustomLogManager"
4039
] as String[]
4140
, "" as String[]
42-
, ["DD_API_KEY": API_KEY]
41+
, [:]
4342
, true) == 0
4443
}
4544

@@ -55,7 +54,7 @@ class CustomLogManagerTest extends Specification {
5554
"-Djava.util.logging.manager=jvmbootstraptest.MissingLogManager"
5655
] as String[]
5756
, "" as String[]
58-
, ["DD_API_KEY": API_KEY, "DD_SITE": ""]
57+
, [:]
5958
, true) == 0
6059
}
6160

@@ -71,7 +70,7 @@ class CustomLogManagerTest extends Specification {
7170
"-Ddd.app.customlogmanager=true"
7271
] as String[]
7372
, "" as String[]
74-
, ["DD_API_KEY": API_KEY]
73+
, [:]
7574
, true) == 0
7675
}
7776

@@ -87,7 +86,7 @@ class CustomLogManagerTest extends Specification {
8786
"-Ddd.app.customjmxbuilder=false"
8887
] as String[]
8988
, "" as String[]
90-
, ["JBOSS_HOME": "/", "DD_API_KEY": API_KEY, "DD_SITE": ""]
89+
, ["JBOSS_HOME": "/"]
9190
, true) == 0
9291
}
9392

@@ -105,7 +104,7 @@ class CustomLogManagerTest extends Specification {
105104
"-Djava.util.logging.manager=jvmbootstraptest.CustomLogManager"
106105
] as String[]
107106
, "" as String[]
108-
, ["JBOSS_HOME": "/", "DD_API_KEY": API_KEY]
107+
, ["JBOSS_HOME": "/"]
109108
, true) == 0
110109
}
111110
}

dd-java-agent/src/test/groovy/datadog/trace/agent/CustomMBeanServerBuilderTest.groovy

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import spock.lang.Timeout
99
class CustomMBeanServerBuilderTest extends Specification {
1010

1111
private static final String DEFAULT_LOG_LEVEL = "debug"
12-
private static final String API_KEY = "01234567890abcdef123456789ABCDEF"
1312

1413
// Run all tests using forked jvm so we try different JMX settings
1514
def "JMXFetch starts up in premain with no custom MBeanServerBuilder set"() {
@@ -24,7 +23,7 @@ class CustomMBeanServerBuilderTest extends Specification {
2423
"-Ddatadog.slf4j.simpleLogger.defaultLogLevel=$DEFAULT_LOG_LEVEL"
2524
] as String[]
2625
, "" as String[]
27-
, ["DD_API_KEY": API_KEY]
26+
, [:]
2827
, true) == 0
2928
}
3029

@@ -41,7 +40,7 @@ class CustomMBeanServerBuilderTest extends Specification {
4140
"-Djavax.management.builder.initial=jvmbootstraptest.CustomMBeanServerBuilder"
4241
] as String[]
4342
, "" as String[]
44-
, ["DD_API_KEY": API_KEY]
43+
, [:]
4544
, true) == 0
4645
}
4746

@@ -58,7 +57,7 @@ class CustomMBeanServerBuilderTest extends Specification {
5857
"-Djavax.management.builder.initial=jvmbootstraptest.MissingMBeanServerBuilder"
5958
] as String[]
6059
, "" as String[]
61-
, ["DD_API_KEY": API_KEY]
60+
, [:]
6261
, true) == 0
6362
}
6463

@@ -75,7 +74,7 @@ class CustomMBeanServerBuilderTest extends Specification {
7574
"-Ddd.app.customjmxbuilder=true"
7675
] as String[]
7776
, "" as String[]
78-
, ["DD_API_KEY": API_KEY]
77+
, [:]
7978
, true) == 0
8079
}
8180

@@ -93,7 +92,7 @@ class CustomMBeanServerBuilderTest extends Specification {
9392
"-Djavax.management.builder.initial=jvmbootstraptest.CustomMBeanServerBuilder"
9493
] as String[]
9594
, "" as String[]
96-
, ["DD_API_KEY": API_KEY]
95+
, [:]
9796
, true) == 0
9897
}
9998
}

0 commit comments

Comments
 (0)