Skip to content

Commit a1c2f48

Browse files
authored
Add unit test for unix domain socket support (#7766)
1 parent c757878 commit a1c2f48

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

dd-java-agent/agent-debugger/src/test/java/com/datadog/debugger/uploader/BatchUploaderTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ public void tearDown() throws IOException {
7171
}
7272
}
7373

74+
@Test
75+
void testUnixDomainSocket() {
76+
when(config.getAgentUnixDomainSocket()).thenReturn("/tmp/ddagent/agent.sock");
77+
uploader = new BatchUploader(config, "http://localhost:8126");
78+
assertEquals(
79+
"datadog.common.socket.UnixDomainSocketFactory",
80+
uploader.getClient().socketFactory().getClass().getTypeName());
81+
}
82+
7483
@Test
7584
void testOkHttpClientForcesCleartextConnspecWhenNotUsingTLS() {
7685
uploader = new BatchUploader(config, "http://example.com");

internal-api/src/test/groovy/datadog/trace/api/ConfigTest.groovy

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,4 +2465,18 @@ class ConfigTest extends DDSpecification {
24652465
"auto" | true | PROFILING_START_DELAY_DEFAULT | PROFILING_START_FORCE_FIRST_DEFAULT
24662466
// spotless:on
24672467
}
2468+
2469+
def "url for debugger with unix domain socket"() {
2470+
when:
2471+
def prop = new Properties()
2472+
prop.setProperty(AGENT_HOST, "myhost")
2473+
prop.setProperty(TRACE_AGENT_PORT, "1234")
2474+
prop.setProperty(TRACE_AGENT_URL, "unix:///path/to/socket")
2475+
2476+
Config config = Config.get(prop)
2477+
2478+
then:
2479+
config.finalDebuggerSnapshotUrl == "http://localhost:8126/debugger/v1/input"
2480+
config.finalDebuggerSymDBUrl == "http://localhost:8126/symdb/v1/input"
2481+
}
24682482
}

0 commit comments

Comments
 (0)