Skip to content

Commit b97b0fb

Browse files
Fixed failed tests.
1 parent eedf1a5 commit b97b0fb

3 files changed

Lines changed: 11 additions & 18 deletions

File tree

dd-java-agent/instrumentation/java/java-concurrent/java-concurrent-1.8/src/test/groovy/executor/NettyExecutorInstrumentationTest.groovy

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
package executor
22

3-
3+
import static datadog.environment.OperatingSystem.arm64
4+
import static datadog.environment.OperatingSystem.linux
45
import static org.junit.jupiter.api.Assumptions.assumeTrue
56

6-
import datadog.environment.OperatingSystem
77
import datadog.trace.agent.test.InstrumentationSpecification
88
import datadog.trace.api.Trace
99
import datadog.trace.core.DDSpan
@@ -21,12 +21,9 @@ import runnable.JavaAsyncChild
2121
import spock.lang.Shared
2222

2323
class NettyExecutorInstrumentationTest extends InstrumentationSpecification {
24+
// TODO: check if arm64 can be supported too.
2425
@Shared
25-
boolean isLinux = OperatingSystem.isLinux()
26-
@Shared
27-
boolean isArm64 = OperatingSystem.isArm64() // TODO: check if arm64 can be supported too.
28-
@Shared
29-
EpollEventLoopGroup epollEventLoopGroup = isLinux && !isArm64 ? new EpollEventLoopGroup(4) : null
26+
EpollEventLoopGroup epollEventLoopGroup = (isLinux() && !isArm64()) ? new EpollEventLoopGroup(4) : null
3027
@Shared
3128
DefaultEventExecutorGroup defaultEventExecutorGroup = new DefaultEventExecutorGroup(4)
3229
@Shared
@@ -280,6 +277,6 @@ class NettyExecutorInstrumentationTest extends InstrumentationSpecification {
280277

281278
def epollExecutor() {
282279
// EPoll only works on linux
283-
isLinux ? epollEventLoopGroup.next() : null
280+
epollEventLoopGroup?.next()
284281
}
285282
}

dd-java-agent/instrumentation/java/java-lang/java-lang-9.0/src/test/groovy/datadog/trace/instrumentation/java/lang/invoke/StringConcatFactoryCallSiteTest.groovy

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ class StringConcatFactoryCallSiteTest extends InstrumentationSpecification {
147147
setup:
148148
StringModule iastModule = Mock(StringModule)
149149
InstrumentationBridge.registerIastModule(iastModule)
150-
// Explicit escape for non-ASCII symbol to make test independent of container settings.
151-
final utfConstant = '\uD840\uDDA2' // 𠆢
152-
final expected = "${utfConstant}Hello${utfConstant}\u0001${utfConstant}World!."
150+
// 𠆢Hello...
151+
final expected = '\uD840\uDDA2Hello\uD840\uDDA2\u0001\uD840\uDDA2World!.'
153152

154153
when:
155154
final result = TestStringConcatFactorySuite.plusWithUtfConstants('Hello', 'World!')
@@ -159,8 +158,8 @@ class StringConcatFactoryCallSiteTest extends InstrumentationSpecification {
159158
1 * iastModule.onStringConcatFactory(
160159
expected,
161160
['Hello', 'World!'] as String[],
162-
"${utfConstant}\u0001\u0002\u0001.",
163-
["${utfConstant}\u0001${utfConstant}"] as Object[],
161+
'\uD840\uDDA2\u0001\u0002\u0001.',
162+
['\uD840\uDDA2\u0001\uD840\uDDA2'] as Object[],
164163
[-2, 0, -5, 1, -1] as int[])
165164
0 * _
166165
}

dd-java-agent/instrumentation/java/java-lang/java-lang-9.0/src/test/java/foo/bar/TestStringConcatFactorySuite.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@
55
import org.slf4j.LoggerFactory;
66

77
public abstract class TestStringConcatFactorySuite {
8-
// Explicit escape for non-ASCII symbol to make test independent of container settings.
9-
private static final String UTF_CONSTANT = "\uD840\uDDA2"; // 𠆢
10-
118
private static final Logger LOGGER = LoggerFactory.getLogger(TestStringConcatFactorySuite.class);
129

1310
private TestStringConcatFactorySuite() {}
@@ -35,8 +32,8 @@ public static String plusWithConstantsAndTags(final String left, final String ri
3532

3633
public static String plusWithUtfConstants(final String left, final String right) {
3734
LOGGER.debug("Before string plus {} {}", left, right);
38-
final String result =
39-
UTF_CONSTANT + left + UTF_CONSTANT + "\u0001" + UTF_CONSTANT + right + ".";
35+
// 𠆢 + left + ...
36+
final String result = "\uD840\uDDA2" + left + "\uD840\uDDA2\u0001\uD840\uDDA2" + right + ".";
4037
LOGGER.debug("After string plus {}", result);
4138
return result;
4239
}

0 commit comments

Comments
 (0)