Skip to content

Commit cc53a84

Browse files
authored
Fix test on Windows (#435)
1 parent 18be4f3 commit cc53a84

File tree

1 file changed

+6
-5
lines changed
  • static-instrumenter/agent-instrumenter/src/integrationTest/java

1 file changed

+6
-5
lines changed

static-instrumenter/agent-instrumenter/src/integrationTest/java/JarTest.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55

66
import static org.assertj.core.api.Assertions.assertThat;
77

8-
import java.io.IOException;
8+
import java.io.File;
99
import java.io.InputStream;
10+
import java.net.URISyntaxException;
1011
import java.net.URL;
1112
import java.nio.charset.StandardCharsets;
1213
import java.nio.file.Files;
@@ -24,7 +25,7 @@ final class JarTest {
2425
@TempDir public Path outPath;
2526

2627
@Test
27-
void testSampleJar() throws IOException, InterruptedException {
28+
void testSampleJar() throws Exception {
2829
Path agentPath = Path.of(System.getProperty("agent"));
2930
Path noInstAgentPath = Path.of(System.getProperty("no.inst.agent"));
3031
// jar created in test-app module
@@ -57,7 +58,7 @@ void testSampleJar() throws IOException, InterruptedException {
5758
"-Dotel.traces.exporter=logging",
5859
"-Dio.opentelemetry.javaagent.shaded.io.opentelemetry.context.contextStorageProvider=default",
5960
"-cp",
60-
String.format("%s:%s", resultAppPath, noInstAgentPath),
61+
resultAppPath + File.pathSeparator + noInstAgentPath,
6162
APP_MAIN);
6263

6364
Process runtimeProcess = runtimeProcessBuilder.start();
@@ -70,9 +71,9 @@ void testSampleJar() throws IOException, InterruptedException {
7071
"[main] INFO io.opentelemetry.exporter.logging.LoggingSpanExporter - 'HTTP GET'");
7172
}
7273

73-
private static Path getPath(String resourceName) {
74+
private static Path getPath(String resourceName) throws URISyntaxException {
7475
URL resourceURL = JarTest.class.getResource(resourceName);
7576
assertThat(resourceURL).isNotNull();
76-
return Path.of(resourceURL.getPath());
77+
return Path.of(resourceURL.toURI());
7778
}
7879
}

0 commit comments

Comments
 (0)