Skip to content

Commit 80e554e

Browse files
committed
fix: assertion failed
1 parent 487911e commit 80e554e

4 files changed

Lines changed: 25 additions & 1 deletion

File tree

integration-test/docker-compose/websphere/docker-compose-700.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ services:
22
was700:
33
image: reajason/websphere:7.0.0.21
44
container_name: was700
5+
environment:
6+
JAVA_OPTS: -Xshareclasses:none
57
ports:
68
- "9080:9080"
79
- "9060:9060"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
was905:
3+
image: reajason/websphere:9.0.5.17
4+
container_name: was905
5+
ports:
6+
- "9080:9080"
7+
- "9060:9060"
8+
- "5005:5005"
9+
environment:
10+
JAVA_OPTS: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
11+
volumes:
12+
- ../../../vul/vul-webapp/build/libs/vul-webapp.war:/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war

integration-test/src/test/java/com/reajason/javaweb/integration/ShellAssertion.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,10 @@ public static void testListProcessAndAttachAll(String url, ContainerTestConfig c
530530
if (listStdout.contains("executable file not found")) {
531531
listResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath);
532532
listStdout = listResult.getStdout();
533+
if (listStdout.contains("no such file or directory")) {
534+
listResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/8.0/jre/bin/java", "-jar", jarPath);
535+
listStdout = listResult.getStdout();
536+
}
533537
}
534538
log.info("list processes output:\n{}", listStdout);
535539
System.out.println("list stderr: " + listResult.getStderr());
@@ -542,10 +546,14 @@ public static void testListProcessAndAttachAll(String url, ContainerTestConfig c
542546
if (attachStdout.contains("executable file not found")) {
543547
attachResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/bin/java", "-jar", jarPath, "all");
544548
attachStdout = attachResult.getStdout();
549+
if (attachStdout.contains("no such file or directory")) {
550+
attachResult = appContainer.execInContainer("/opt/IBM/WebSphere/AppServer/java/8.0/jre/bin/java", "-jar", jarPath, "all");
551+
attachStdout = attachResult.getStdout();
552+
}
545553
}
546554
log.info("attach all output:\n{}", attachStdout);
547555
System.out.println("attach all stderr: " + attachResult.getStderr());
548-
assertThat("Attach all should complete with ok", attachStdout, containsString("ok"));
556+
assertThat("Attach all should complete with Success", attachStdout, containsString("Success"));
549557

550558
// Test 3: Verify shell injection was successful
551559
String paramName = ((CommandConfig) shellToolConfig).getParamName();

integration-test/src/test/java/com/reajason/javaweb/integration/memshell/websphere7/WebSphere700ContainerTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import java.time.Duration;
1717
import java.util.List;
18+
import java.util.Map;
1819

1920
/**
2021
* @author ReaJason
@@ -28,6 +29,7 @@ public class WebSphere700ContainerTest extends AbstractContainerTest {
2829
"reajason/websphere:7.0.0.21",
2930
"/opt/IBM/WebSphere/AppServer/profiles/AppSrv01/monitoredDeployableApps/servers/server1/app.war")
3031
.targetJdkVersion(Opcodes.V1_6)
32+
.env(Map.of("JAVA_OPTS", "-Xshareclasses:none"))
3133
.waitStrategy(Wait.forHttp("/app/").forPort(9080).withStartupTimeout(Duration.ofMinutes(5)))
3234
.supportedShellTypes(List.of(
3335
ShellType.SERVLET,

0 commit comments

Comments
 (0)