mirror of
https://github.com/ReaJason/MemShellParty.git
synced 2026-09-21 22:50:42 +08:00
test: retry for tomcat test cases
This commit is contained in:
@@ -22,6 +22,7 @@ java-websocket = "1.6.0"
|
|||||||
mockito = "5.18.0"
|
mockito = "5.18.0"
|
||||||
hamcrest = "3.0"
|
hamcrest = "3.0"
|
||||||
junit-jupiter = "5.13.4"
|
junit-jupiter = "5.13.4"
|
||||||
|
junit-pioneer = "2.3.0"
|
||||||
junit-platform = "1.13.4"
|
junit-platform = "1.13.4"
|
||||||
testcontainers = "1.21.3"
|
testcontainers = "1.21.3"
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ mockito-core = { module = "org.mockito:mockito-core", version.ref = "mockito" }
|
|||||||
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
|
mockito-junit-jupiter = { module = "org.mockito:mockito-junit-jupiter", version.ref = "mockito" }
|
||||||
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
|
hamcrest = { module = "org.hamcrest:hamcrest", version.ref = "hamcrest" }
|
||||||
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" }
|
||||||
|
junit-pioneer = { module = "org.junit-pioneer:junit-pioneer", version.ref = "junit-pioneer" }
|
||||||
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
|
junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher", version.ref = "junit-platform" }
|
||||||
junit-platform-reporting = { module = "org.junit.platform:junit-platform-reporting", version.ref = "junit-platform" }
|
junit-platform-reporting = { module = "org.junit.platform:junit-platform-reporting", version.ref = "junit-platform" }
|
||||||
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
|
testcontainers = { module = "org.testcontainers:testcontainers", version.ref = "testcontainers" }
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ dependencies {
|
|||||||
testImplementation(libs.okhttp3)
|
testImplementation(libs.okhttp3)
|
||||||
testImplementation(libs.junit.platform.reporting)
|
testImplementation(libs.junit.platform.reporting)
|
||||||
testImplementation(libs.junit.jupiter)
|
testImplementation(libs.junit.jupiter)
|
||||||
|
testImplementation(libs.junit.pioneer)
|
||||||
testRuntimeOnly(libs.junit.platform.launcher)
|
testRuntimeOnly(libs.junit.platform.launcher)
|
||||||
testImplementation(libs.hamcrest)
|
testImplementation(libs.hamcrest)
|
||||||
testImplementation(libs.bundles.testcontainers)
|
testImplementation(libs.bundles.testcontainers)
|
||||||
|
|||||||
+3
-1
@@ -8,6 +8,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.jupiter.api.AfterAll;
|
import org.junit.jupiter.api.AfterAll;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junitpioneer.jupiter.RetryingTest;
|
||||||
import org.objectweb.asm.Opcodes;
|
import org.objectweb.asm.Opcodes;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
@@ -40,7 +41,8 @@ public class Tomcat5ContainerTest {
|
|||||||
System.out.println(container.getLogs());
|
System.out.println(container.getLogs());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
// 存在首次请求,Tomcat 无法通过 req.getParameter 拿到参数的情况,因此需要重试
|
||||||
|
@RetryingTest(3)
|
||||||
void testJDK() {
|
void testJDK() {
|
||||||
String url = getUrl(container);
|
String url = getUrl(container);
|
||||||
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.bytebuddy.jar.asm.Opcodes;
|
import net.bytebuddy.jar.asm.Opcodes;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junitpioneer.jupiter.RetryingTest;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -35,7 +36,7 @@ public class Tomcat7ContainerTest {
|
|||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@Test
|
@RetryingTest(3)
|
||||||
void testJDK() {
|
void testJDK() {
|
||||||
String url = getUrl(container);
|
String url = getUrl(container);
|
||||||
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
||||||
|
|||||||
+2
-1
@@ -8,6 +8,7 @@ import lombok.SneakyThrows;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.bytebuddy.jar.asm.Opcodes;
|
import net.bytebuddy.jar.asm.Opcodes;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junitpioneer.jupiter.RetryingTest;
|
||||||
import org.testcontainers.containers.GenericContainer;
|
import org.testcontainers.containers.GenericContainer;
|
||||||
import org.testcontainers.containers.wait.strategy.Wait;
|
import org.testcontainers.containers.wait.strategy.Wait;
|
||||||
import org.testcontainers.junit.jupiter.Container;
|
import org.testcontainers.junit.jupiter.Container;
|
||||||
@@ -34,7 +35,7 @@ public class Tomcat9ContainerTest {
|
|||||||
.waitingFor(Wait.forHttp("/app"))
|
.waitingFor(Wait.forHttp("/app"))
|
||||||
.withExposedPorts(8080);
|
.withExposedPorts(8080);
|
||||||
|
|
||||||
@Test
|
@RetryingTest(3)
|
||||||
void testJDK() {
|
void testJDK() {
|
||||||
String url = getUrl(container);
|
String url = getUrl(container);
|
||||||
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
String data = VulTool.post(url + "/b64", DetectionTool.getJdkDetection());
|
||||||
|
|||||||
Reference in New Issue
Block a user