Make tests pass on Windows
MODIFY
instrumentation/aws-sdk/aws-sdk-1.11/src/test/groovy/AWSClientTest.groovy
instrumentation/aws-sdk/aws-sdk-1.11/src/test/groovy/AWSClientTest.groovy
@@ -389,6 +389,9 @@ class AWSClientTest extends AgentTestRunner {
try {
errorTags SocketException, "Socket closed"
} catch (AssertionError e) {
+ try {
+ errorTags SocketException, "Socket Closed" // windows
+ } catch (AssertionError f) {
errorTags RequestAbortedException, "Request aborted"
}
}
@@ -396,6 +399,7 @@ class AWSClientTest extends AgentTestRunner {
}
}
}
+ }
cleanup:
server.close()

MODIFY
instrumentation/aws-sdk/aws-sdk-1.11/src/test_before_1_11_106/groovy/AWSClientTest.groovy
instrumentation/aws-sdk/aws-sdk-1.11/src/test_before_1_11_106/groovy/AWSClientTest.groovy
@@ -331,6 +331,9 @@ class AWSClientTest extends AgentTestRunner {
try {
errorTags SocketException, "Socket closed"
} catch (AssertionError e) {
+ try {
+ errorTags SocketException, "Socket Closed" // windows
+ } catch (AssertionError f) {
errorTags RequestAbortedException, "Request aborted"
}
}
@@ -338,6 +341,7 @@ class AWSClientTest extends AgentTestRunner {
}
}
}
+ }
cleanup:
server.close()

MODIFY
instrumentation/netty/netty-4.0/src/test/groovy/Netty40ClientTest.groovy
instrumentation/netty/netty-4.0/src/test/groovy/Netty40ClientTest.groovy
@@ -103,7 +103,10 @@ class Netty40ClientTest extends HttpClientTest<NettyHttpClientDecorator> {
} catch (ClassNotFoundException e) {
// Older versions use 'java.net.ConnectException' and do not have 'io.netty.channel.AbstractChannel$AnnotatedConnectException'
}
- errorTags errorClass, "Connection refused: /127.0.0.1:$UNUSABLE_PORT"
+ "error.type" errorClass.name
+ "error.stack" String
+ // slightly different message on windows
+ "error.msg" ~/Connection refused:( no further information:)? \/127.0.0.1:$UNUSABLE_PORT/
}
}
}

MODIFY
instrumentation/netty/netty-4.1/src/test/groovy/Netty41ClientTest.groovy
instrumentation/netty/netty-4.1/src/test/groovy/Netty41ClientTest.groovy
@@ -32,6 +32,7 @@ import spock.lang.Shared
import java.util.concurrent.ExecutionException
import java.util.concurrent.TimeUnit
+import java.util.concurrent.TimeoutException
import static io.opentelemetry.auto.test.utils.PortUtils.UNUSABLE_PORT
import static io.opentelemetry.auto.test.utils.TraceUtils.basicSpan
@@ -86,7 +87,7 @@ class Netty41ClientTest extends HttpClientTest<NettyHttpClientDecorator> {
then:
def ex = thrown(Exception)
- ex.cause instanceof ConnectException
+ ex.cause instanceof ConnectException || ex.cause instanceof TimeoutException
def thrownException = ex instanceof ExecutionException ? ex.cause : ex
and:
@@ -106,7 +107,8 @@ class Netty41ClientTest extends HttpClientTest<NettyHttpClientDecorator> {
"$Tags.COMPONENT" "netty"
"error.type" AbstractChannel.AnnotatedConnectException.name
"error.stack" String
- "error.msg" ~/Connection refused: localhost\/[0-9.:]+:$UNUSABLE_PORT/
+ // slightly different message on windows
+ "error.msg" ~/Connection refused:( no further information:)? localhost\/[0-9.:]+:$UNUSABLE_PORT/
}
}
}

MODIFY
smoke-tests/play/src/test/groovy/io/opentelemetry/smoketest/PlaySmokeTest.groovy
smoke-tests/play/src/test/groovy/io/opentelemetry/smoketest/PlaySmokeTest.groovy
@@ -27,8 +27,9 @@ class PlaySmokeTest extends AbstractServerSmokeTest {
@Override
ProcessBuilder createProcessBuilder() {
+ String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ""
ProcessBuilder processBuilder =
- new ProcessBuilder("${playDirectory}/bin/playBinary")
+ new ProcessBuilder("${playDirectory}/bin/playBinary" + ext)
processBuilder.directory(playDirectory)
processBuilder.environment().put("JAVA_OPTS",

MODIFY
smoke-tests/wildfly/src/test/groovy/io/opentelemetry/smoketest/WildflySmokeTest.groovy
smoke-tests/wildfly/src/test/groovy/io/opentelemetry/smoketest/WildflySmokeTest.groovy
@@ -30,8 +30,9 @@ class WildflySmokeTest extends AbstractServerSmokeTest {
@Override
ProcessBuilder createProcessBuilder() {
+ String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ".sh"
ProcessBuilder processBuilder =
- new ProcessBuilder("${wildflyDirectory}/bin/standalone.sh")
+ new ProcessBuilder("${wildflyDirectory}/bin/standalone" + ext)
processBuilder.directory(wildflyDirectory)
// We're installing a span exporter to make sure it doesn't blow anything up, but we're not
@@ -46,13 +47,15 @@ class WildflySmokeTest extends AbstractServerSmokeTest {
}
def cleanupSpec() {
+ String ext = System.getProperty("os.name").startsWith("Windows") ? ".bat" : ".sh"
ProcessBuilder processBuilder = new ProcessBuilder(
- "${wildflyDirectory}/bin/jboss-cli.sh",
+ "${wildflyDirectory}/bin/jboss-cli" + ext,
"--connect",
"--controller=localhost:${managementPort}",
"command=:shutdown")
processBuilder.directory(wildflyDirectory)
Process process = processBuilder.start()
+ process.getOutputStream().close() // otherwise .bat file waits at end with "Press any key to continue . . ."
process.waitFor()
}

Make tests pass on Windows (#217)