diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginCases.java index 8655e193b5aa..a9c419c369a9 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginCases.java @@ -94,7 +94,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -132,7 +132,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addExists(Method.PUT, "/dubbo/demo/findAll") .addExists(Method.DELETE, "/dubbo/demo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/demo/findAll")).build()) .build(); } @@ -170,7 +170,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addExists(Method.PUT, "/dubbo/findAll") .addExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -208,7 +208,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addExists(Method.PUT, "/dubbo/findAll") .addExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -252,7 +252,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/dubbo/findAll")).build()) .build(); } @@ -296,7 +296,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/dubbo/findAll")).build()) .build(); } @@ -340,7 +340,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/dubbo/findAll")).build()) .build(); } @@ -384,7 +384,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/dubbo/findAll") .addNotExists(Method.PUT, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/dubbo/findAll")).build()) .build(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginTest.java index 13d565154148..b228152ea59d 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-alibaba-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/alibabadubbo/AlibabaDubboPluginTest.java @@ -125,7 +125,7 @@ void testSpringCloud(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginCases.java index db18238f44ca..9b9a6fd39540 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginCases.java @@ -94,7 +94,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -132,7 +132,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addExists(Method.PUT, "/dubbo/findAll") .addExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -170,7 +170,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addExists(Method.PUT, "/dubbo/findAll") .addExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -208,7 +208,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addExists(Method.PUT, "/dubbo/findAll") .addExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/dubbo/findAll")).build()) .build(); } @@ -252,7 +252,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/dubbo/findAll")).build()) .build(); } @@ -296,7 +296,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/dubbo/findAll")).build()) .build(); } @@ -340,7 +340,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/dubbo/findAll") .addNotExists(Method.DELETE, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/dubbo/findAll")).build()) .build(); } @@ -384,7 +384,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/dubbo/findAll") .addNotExists(Method.PUT, "/dubbo/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/dubbo/findAll")).build()) .build(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginTest.java index d8d60d270f36..1c52b01848d2 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-apache-dubbo/src/test/java/org/apache/shenyu/e2e/testcase/apachedubbo/ApacheDubboPluginTest.java @@ -126,7 +126,7 @@ void testSpringCloud(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginCases.java index c3c3fac4ab49..38de2dc9f84c 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginCases.java @@ -85,7 +85,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/brpc/testchecker")).build()) .build(); } @@ -119,7 +119,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addNotExists(Method.PUT, "/brpc/testP") .addNotExists(Method.DELETE, "/brpc/testD") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/brpc/testchecker")).build()) .build(); } @@ -155,7 +155,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addNotExists(Method.PUT, "/brpc/testput") .addNotExists(Method.DELETE, "/brpc/tesdelete") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/brpc/testcheck")).build()) .build(); } @@ -191,7 +191,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addNotExists(Method.PUT, "/brpc/testPut") .addNotExists(Method.DELETE, "/brpc/testDelete") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/brpc/testcheck")).build()) .build(); } @@ -233,7 +233,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/brpc/testput") .addNotExists(Method.DELETE, "/brpc/testdelete") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/brpc/tesget")).build()) .build(); } @@ -274,7 +274,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/brpc/testput") .addNotExists(Method.DELETE, "/brpc/testdelete") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/brpc/testpost")).build()) .build(); } @@ -313,7 +313,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/brpc/testpost") .addNotExists(Method.DELETE, "/brpc/testdelete") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/brpc/testput")).build()) .build(); } @@ -352,7 +352,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/brpc/testpost") .addNotExists(Method.PUT, "/brpc/testput") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/brpc/testdelete")).build()) .build(); } } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginTest.java index f688992c5701..f1245502ee98 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-brpc/src/test/java/org/apache/shenyu/e2e/testcase/brpc/BrpcPluginTest.java @@ -119,7 +119,7 @@ void testBrpc(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java index de2182ac61c1..7d585a7c98c1 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-grpc/src/test/java/org/apache/shenyu/e2e/testcase/grpc/GrpcPluginCases.java @@ -92,7 +92,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) .build(); } @@ -135,7 +135,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addNotExists(Method.PUT, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/grpc/findAll")).build()) .build(); } @@ -177,7 +177,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addNotExists(Method.PUT, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/grpc/findAll")).build()) .build(); } @@ -217,7 +217,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addNotExists(Method.PUT, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/grpc/findAll")).build()) .build(); } @@ -264,7 +264,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/grpc/findAll")).build()) .build(); } @@ -311,7 +311,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/grpc/findAll")).build()) .build(); } @@ -358,7 +358,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/grpc/findAll") .addNotExists(Method.DELETE, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/grpc/findAll")).build()) .build(); } @@ -405,7 +405,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/grpc/findAll") .addNotExists(Method.PUT, "/grpc/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/grpc/findAll")).build()) .build(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginCases.java index 7ada273eaed1..1c43c26f7ca9 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginCases.java @@ -85,7 +85,7 @@ private ShenYuScenarioSpec testDivideWithUriEquals() { .addNotExists("/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(ANYTHING)).build()) .build(); } @@ -123,7 +123,7 @@ public ShenYuScenarioSpec testDivideWithUriPathPattern() { .addExists(Method.DELETE, ANYTHING + "/xx/yy") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(ANYTHING + "/xx/yyy")).build()) .build(); } @@ -160,7 +160,7 @@ public ShenYuScenarioSpec testDivideWithUriStartWith() { .addExists(Method.DELETE, ANYTHING + "/xx/yy") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(ANYTHING + "/xx")).build()) .build(); } @@ -199,7 +199,7 @@ public ShenYuScenarioSpec testDivideWithEndWith() { .addVerifier(Method.DELETE, "/status/200", isEmptyOrNullString()) .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(ANYTHING + "/200")).build()) .build(); } @@ -243,7 +243,7 @@ public ShenYuScenarioSpec testDivideWithMethodGet() { .addNotExists(Method.GET, "/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, ANYTHING)).build()) .build(); } @@ -287,7 +287,7 @@ public ShenYuScenarioSpec testDivideWithMethodPost() { .addNotExists(Method.POST, "/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, ANYTHING)).build()) .build(); } @@ -331,7 +331,7 @@ public ShenYuScenarioSpec testDivideWithMethodPut() { .addNotExists(Method.PUT, "/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, ANYTHING)).build()) .build(); } @@ -375,7 +375,7 @@ public ShenYuScenarioSpec testDivideWithMethodDelete() { .addNotExists(Method.DELETE, "/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, ANYTHING)).build()) .build(); } } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginTest.java index dd3b2c23c808..efbbc6c29594 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-http/src/test/java/org/apache/shenyu/e2e/testcase/divide/DividePluginTest.java @@ -90,7 +90,7 @@ void before(final AdminClient client, final GatewayClient gateway, final BeforeE @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java index 86d090169614..ff9793a2ecab 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginCases.java @@ -85,7 +85,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) .build(); } @@ -118,7 +118,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addExists(Method.PUT, "/motan/demo/hi") .addExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) .build(); } @@ -152,7 +152,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addExists(Method.PUT, "/motan/demo/hi") .addExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) .build(); } @@ -186,7 +186,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addExists(Method.PUT, "/motan/demo/hi") .addExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/motan/demo/hi")).build()) .build(); } @@ -226,7 +226,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/motan/demo/hi") .addNotExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/motan/demo/hi")).build()) .build(); } @@ -266,7 +266,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/motan/demo/hi") .addNotExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/motan/demo/hi")).build()) .build(); } @@ -306,7 +306,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/motan/demo/hi") .addNotExists(Method.DELETE, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/motan/demo/hi")).build()) .build(); } @@ -347,7 +347,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/motan/demo/hi") .addNotExists(Method.PUT, "/motan/demo/hi") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/motan/demo/hi")).build()) .build(); } } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java index fe81822b9e47..3ff640708e44 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-motan/src/test/java/org/apache/shenyu/e2e/testcase/motan/MotanPluginTest.java @@ -121,7 +121,7 @@ void testMotan(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java index c4fa9da3cbda..db70e92fc611 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginCases.java @@ -82,7 +82,7 @@ public ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/put") .addNotExists("/get") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) .build(); } @@ -115,7 +115,7 @@ public ShenYuScenarioSpec testWithUriPathPattern() { .addExists(Method.PUT, "/sofa/findAll") .addExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) .build(); } @@ -149,7 +149,7 @@ public ShenYuScenarioSpec testWithUriStartWith() { .addExists(Method.PUT, "/sofa/findAll") .addExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) .build(); } @@ -183,7 +183,7 @@ public ShenYuScenarioSpec testWithEndWith() { .addExists(Method.PUT, "/sofa/findAll") .addExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists("/sofa/findAll")).build()) .build(); } @@ -223,7 +223,7 @@ public ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.PUT, "/sofa/findAll") .addNotExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, "/sofa/findAll")).build()) .build(); } @@ -263,7 +263,7 @@ public ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.PUT, "/sofa/findAll") .addNotExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, "/sofa/findAll")).build()) .build(); } @@ -303,7 +303,7 @@ public ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.POST, "/sofa/findAll") .addNotExists(Method.DELETE, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, "/sofa/findAll")).build()) .build(); } @@ -343,7 +343,7 @@ public ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.POST, "/sofa/findAll") .addNotExists(Method.PUT, "/sofa/findAll") .build()) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, "/sofa/findAll")).build()) .build(); } } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java index 1a3d53334d43..d8b83f8d3ebd 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-sofa/src/test/java/org/apache/shenyu/e2e/testcase/sofa/SofaPluginTest.java @@ -118,7 +118,7 @@ void testSofa(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginCases.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginCases.java index 3fc16b6605ca..5173b419d3d9 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginCases.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginCases.java @@ -101,7 +101,7 @@ private ShenYuScenarioSpec testWithUriEquals() { .addNotExists("/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(TEST)).build()) .build(); } @@ -138,7 +138,7 @@ private ShenYuScenarioSpec testWithUriPathPattern() { .addExists(Method.DELETE, TEST + "/xx") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(TEST + "/xx")).build()) .build(); } @@ -174,7 +174,7 @@ private ShenYuScenarioSpec testWithUriStartWith() { .addExists(Method.DELETE, TEST + "/xx") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(TEST)).build()) .build(); } @@ -207,7 +207,7 @@ private ShenYuScenarioSpec testWithEndWith() { .addNotExists("/springcloud/tested") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(TEST)).build()) .build(); } @@ -250,7 +250,7 @@ private ShenYuScenarioSpec testWithMethodGet() { .addNotExists(Method.GET, "/get") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.GET, TEST)).build()) .build(); } @@ -293,7 +293,7 @@ private ShenYuScenarioSpec testWithMethodPost() { .addNotExists(Method.POST, "/post") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.POST, TEST)).build()) .build(); } @@ -336,7 +336,7 @@ private ShenYuScenarioSpec testWithMethodPut() { .addNotExists(Method.PUT, "/put") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.PUT, TEST)).build()) .build(); } @@ -379,7 +379,7 @@ private ShenYuScenarioSpec testWithMethodDelete() { .addNotExists(Method.DELETE, "/delete") .build() ) - .afterEachSpec(ShenYuAfterEachSpec.DEFAULT) + .afterEachSpec(ShenYuAfterEachSpec.builder().deleteWaiting(notExists(Method.DELETE, TEST)).build()) .build(); } diff --git a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginTest.java b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginTest.java index 4e69cda82984..19a3d840bd64 100644 --- a/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginTest.java +++ b/shenyu-e2e/shenyu-e2e-case/shenyu-e2e-case-spring-cloud/src/test/java/org/apache/shenyu/e2e/testcase/springcloud/SpringCloudPluginTest.java @@ -122,7 +122,7 @@ void testSpringCloud(final GatewayClient gateway, final CaseSpec spec) { @AfterEach void after(final AdminClient client, final GatewayClient gateway, final AfterEachSpec spec) { spec.getDeleter().delete(client, selectorIds); - spec.getPostChecker().check(gateway); + spec.deleteWaiting().waitFor(gateway); selectorIds = Lists.newArrayList(); } diff --git a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/AfterEachSpec.java b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/AfterEachSpec.java index 6b75b2fa6206..048f4e1ce4f5 100644 --- a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/AfterEachSpec.java +++ b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/AfterEachSpec.java @@ -20,6 +20,7 @@ import org.apache.shenyu.e2e.engine.annotation.ShenYuScenarioParameter; import org.apache.shenyu.e2e.engine.scenario.function.Checker; import org.apache.shenyu.e2e.engine.scenario.function.Deleter; +import org.apache.shenyu.e2e.engine.scenario.function.Waiting; @ShenYuScenarioParameter public interface AfterEachSpec { @@ -34,6 +35,11 @@ public Deleter getDeleter() { public Checker getPostChecker() { return Checker.DEFAULT; } + + @Override + public Waiting deleteWaiting() { + return Waiting.DEFAULT; + } }; /** @@ -47,5 +53,11 @@ public Checker getPostChecker() { * @return Checker */ Checker getPostChecker(); + + /** + * deleteWaiting. + * @return Checker + */ + Waiting deleteWaiting(); } diff --git a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ScenarioSpecLogProxy.java b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ScenarioSpecLogProxy.java index 0ed1488c413a..0bbc75721db3 100644 --- a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ScenarioSpecLogProxy.java +++ b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ScenarioSpecLogProxy.java @@ -93,6 +93,12 @@ public Checker getPostChecker() { MDC.put("operate", "postCheck"); return spec.getPostChecker(); } + + @Override + public Waiting deleteWaiting() { + MDC.put("operate", "deleteWaiting"); + return spec.deleteWaiting(); + } }; } diff --git a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ShenYuAfterEachSpec.java b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ShenYuAfterEachSpec.java index 41c38b019819..d03030cca21c 100644 --- a/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ShenYuAfterEachSpec.java +++ b/shenyu-e2e/shenyu-e2e-engine/src/main/java/org/apache/shenyu/e2e/engine/scenario/specification/ShenYuAfterEachSpec.java @@ -19,38 +19,101 @@ import org.apache.shenyu.e2e.engine.scenario.function.Checker; import org.apache.shenyu.e2e.engine.scenario.function.Deleter; +import org.apache.shenyu.e2e.engine.scenario.function.HttpChecker; +import org.apache.shenyu.e2e.engine.scenario.function.HttpWaiting; +import org.apache.shenyu.e2e.engine.scenario.function.WaitForHelper; +import org.apache.shenyu.e2e.engine.scenario.function.Waiting; +import org.jetbrains.annotations.NotNull; /** * ShenYu after each specification. */ public class ShenYuAfterEachSpec implements AfterEachSpec { - public static final ShenYuAfterEachSpec DEFAULT = new ShenYuAfterEachSpec(Deleter.DEFAULT, Checker.DEFAULT); + public static final ShenYuAfterEachSpec DEFAULT = new ShenYuAfterEachSpec(Deleter.DEFAULT, Checker.DEFAULT, Waiting.DEFAULT); private final Deleter deleter; private final Checker postChecker; + + private final Waiting deleteWaiting; - public ShenYuAfterEachSpec(final Deleter deleter, final Checker postChecker) { + public ShenYuAfterEachSpec(final Deleter deleter, final Checker postChecker, final Waiting deleteWaiting) { this.deleter = deleter; this.postChecker = postChecker; + this.deleteWaiting = deleteWaiting; } /** - * get deleter. + * builder. * - * @return deleter + * @return {@link ShenYuAfterEachSpecBuilder} */ + public static ShenYuAfterEachSpec.ShenYuAfterEachSpecBuilder builder() { + return new ShenYuAfterEachSpec.ShenYuAfterEachSpecBuilder(); + } + + @Override public Deleter getDeleter() { return deleter; } - /** - * get postChecker. - * - * @return postChecker - */ + @Override public Checker getPostChecker() { return postChecker; } + + @Override + public Waiting deleteWaiting() { + return deleteWaiting; + } + + public static class ShenYuAfterEachSpecBuilder { + + private Deleter deleter = Deleter.DEFAULT; + + private Checker checker = Checker.DEFAULT; + + private Waiting deleteWaiting = Waiting.DEFAULT; + + /** + * builder set checker. + * @param checker checker + * @return ShenYuAfterEachSpecBuilder + */ + public ShenYuAfterEachSpecBuilder checker(final @NotNull Checker checker) { + this.checker = checker; + return this; + } + + /** + * builder set waiting with checker. + * @param checker checker + * @return ShenYuAfterEachSpecBuilder + */ + public ShenYuAfterEachSpecBuilder deleteWaiting(final @NotNull Checker checker) { + this.deleteWaiting = (HttpWaiting) supplier -> { + WaitForHelper.waitForEffecting(supplier, (HttpChecker) checker); + }; + return this; + } + + /** + * builder set deleter. + * @param deleter deleter + * @return ShenYuAfterEachSpecBuilder + */ + public ShenYuAfterEachSpecBuilder deleter(final @NotNull Deleter deleter) { + this.deleter = deleter; + return this; + } + + /** + * builder build before each spec. + * @return ShenYuAfterEachSpec + */ + public ShenYuAfterEachSpec build() { + return new ShenYuAfterEachSpec(deleter, checker, deleteWaiting); + } + } }