Skip to content

Commit 81322a4

Browse files
committed
fix
1 parent 476b78c commit 81322a4

File tree

5 files changed

+22
-21
lines changed

5 files changed

+22
-21
lines changed

instrumentation/akka/akka-http-10.0/javaagent/src/test/scala/io/opentelemetry/javaagent/instrumentation/akkahttp/AkkaHttpClientInstrumentationTest.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ class AkkaHttpClientInstrumentationTest
120120
): Unit = {
121121
options.disableTestRedirects()
122122
options.disableTestNonStandardHttpMethod()
123-
// On Windows, non-routable addresses timeout instead of failing fast, causing the test to timeout
124-
// before the HTTP client can create a span, resulting in only the parent span being captured.
123+
// On Windows, non-routable addresses timeout instead of failing fast, causing test timeout
124+
// before the HTTP client can create a span, resulting in only the parent span.
125125
if (OS.WINDOWS.isCurrentOs()) {
126126
options.disableTestRemoteConnection()
127127
}

instrumentation/async-http-client/async-http-client-2.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/asynchttpclient/v2_0/AsyncHttpClientTest.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,8 @@ public void onThrowable(Throwable throwable) {
9898
protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
9999
optionsBuilder.disableTestRedirects();
100100
optionsBuilder.spanEndsAfterBody();
101-
// On Windows, non-routable addresses timeout instead of failing fast, causing the test to
102-
// timeout
103-
// before the HTTP client can create a span, resulting in only the parent span being captured.
101+
// On Windows, non-routable addresses timeout instead of failing fast, causing test timeout
102+
// before the HTTP client can create a span, resulting in only the parent span.
104103
if (OS.WINDOWS.isCurrentOs()) {
105104
optionsBuilder.disableTestRemoteConnection();
106105
}

instrumentation/netty/netty-3.8/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v3_8/client/Netty38ClientTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
140140
optionsBuilder.disableTestHttps();
141141
optionsBuilder.disableTestReadTimeout();
142142

143-
// On Windows, non-routable addresses behave differently, causing platform-specific test
144-
// failures.
143+
// On Windows, non-routable addresses behave differently, causing test failures.
145144
if (OS.WINDOWS.isCurrentOs()) {
146145
optionsBuilder.disableTestRemoteConnection();
147146
}

instrumentation/netty/netty-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/netty/v4_0/client/Netty40ClientTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ protected void configure(HttpClientTestOptions.Builder optionsBuilder) {
142142

143143
optionsBuilder.setExpectedClientSpanNameMapper(Netty40ClientTest::expectedClientSpanName);
144144
optionsBuilder.setHttpAttributes(Netty40ClientTest::httpAttributes);
145-
// On Windows, non-routable addresses behave differently, causing platform-specific test
146-
// failures.
145+
// On Windows, non-routable addresses behave differently, causing test failures.
147146
if (OS.WINDOWS.isCurrentOs()) {
148147
optionsBuilder.disableTestRemoteConnection();
149148
}

instrumentation/powerjob-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/powerjob/v4_0/PowerJobBasicProcessorTest.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import io.opentelemetry.api.common.AttributeKey;
1717
import io.opentelemetry.api.internal.StringUtils;
1818
import io.opentelemetry.api.trace.SpanKind;
19-
import io.opentelemetry.api.trace.StatusCode;
2019
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
2120
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
2221
import io.opentelemetry.sdk.testing.assertj.AttributeAssertion;
@@ -26,12 +25,15 @@
2625
import javax.sql.DataSource;
2726
import org.junit.jupiter.api.Test;
2827
import org.junit.jupiter.api.extension.RegisterExtension;
28+
import org.junit.jupiter.api.condition.DisabledOnOs;
29+
import org.junit.jupiter.api.condition.OS;
2930
import tech.powerjob.official.processors.impl.FileCleanupProcessor;
3031
import tech.powerjob.official.processors.impl.HttpProcessor;
3132
import tech.powerjob.official.processors.impl.script.PythonProcessor;
3233
import tech.powerjob.official.processors.impl.script.ShellProcessor;
3334
import tech.powerjob.official.processors.impl.sql.DynamicDatasourceSqlProcessor;
3435
import tech.powerjob.official.processors.impl.sql.SpringDatasourceSqlProcessor;
36+
import tech.powerjob.worker.core.processor.ProcessResult;
3537
import tech.powerjob.worker.core.processor.TaskContext;
3638
import tech.powerjob.worker.core.processor.WorkflowContext;
3739
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
@@ -174,32 +176,34 @@ void testMapReduceProcessor() throws Exception {
174176
});
175177
}
176178

179+
// ShellProcessor relies on /bin/sh so skip on Windows where that binary is unavailable.
180+
@DisabledOnOs(value = OS.WINDOWS, disabledReason = "ShellProcessor requires /bin/sh")
177181
@Test
178182
void testShellProcessor() throws Exception {
179183
long jobId = 1;
180-
// Use platform-appropriate command: echo works on both Windows and Unix-like systems
184+
// echo works on both Linux and Windows
181185
String jobParam = "echo test";
182186
TaskContext taskContext = genTaskContext(jobId, jobParam);
183187
taskContext.setWorkflowContext(new WorkflowContext(jobId, ""));
184188
taskContext.setOmsLogger(new TestOmsLogger());
185189
BasicProcessor shellProcessor = new ShellProcessor();
186-
shellProcessor.process(taskContext);
190+
Class<?> shellProcessorClass = shellProcessor.getClass();
191+
ProcessResult result = shellProcessor.process(taskContext);
192+
assertThat(result.isSuccess())
193+
.as(
194+
"shell processor result on %s: %s",
195+
System.getProperty("os.name"), result.getMsg())
196+
.isTrue();
187197
testing.waitAndAssertTraces(
188198
trace -> {
189199
trace.hasSpansSatisfyingExactly(
190200
span -> {
191-
span.hasName(String.format("%s.process", ShellProcessor.class.getSimpleName()))
201+
span.hasName(String.format("%s.process", shellProcessorClass.getSimpleName()))
192202
.hasKind(SpanKind.INTERNAL)
193-
// On Windows, shell command execution may fail if the shell is not available
194-
// or configured correctly, so accept both UNSET and ERROR status
195-
.satisfies(
196-
spanData -> {
197-
StatusCode code = spanData.getStatus().getStatusCode();
198-
assertThat(code).isIn(StatusCode.UNSET, StatusCode.ERROR);
199-
})
203+
.hasStatus(StatusData.unset())
200204
.hasAttributesSatisfyingExactly(
201205
attributeAssertions(
202-
ShellProcessor.class.getName(), jobId, jobParam, SHELL_PROCESSOR));
206+
shellProcessorClass.getName(), jobId, jobParam, SHELL_PROCESSOR));
203207
});
204208
});
205209
}

0 commit comments

Comments
 (0)