Skip to content

Commit 780d92c

Browse files
committed
Optimize SentinelPluginTest to reduce cleanPlugin calls and prevent timeout issues
1 parent 9317522 commit 780d92c

File tree

1 file changed

+7
-6
lines changed
  • shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination

1 file changed

+7
-6
lines changed

shenyu-integrated-test/shenyu-integrated-test-http/src/test/java/org/apache/shenyu/integrated/test/http/combination/SentinelPluginTest.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
import org.apache.shenyu.integratedtest.common.helper.HttpHelper;
3030
import org.apache.shenyu.integratedtest.common.result.ResultBean;
3131
import org.apache.shenyu.web.controller.LocalPluginController.RuleLocalData;
32-
import org.junit.jupiter.api.AfterEach;
33-
import org.junit.jupiter.api.BeforeEach;
32+
import org.junit.jupiter.api.AfterAll;
33+
import org.junit.jupiter.api.BeforeAll;
3434
import org.junit.jupiter.api.Test;
3535

3636
import java.io.IOException;
@@ -50,8 +50,9 @@ public final class SentinelPluginTest extends AbstractPluginDataInit {
5050

5151
private static final String TEST_SENTINEL_FALLBACK_PATH = "/http/test/request/accepted";
5252

53-
@BeforeEach
54-
public void setup() throws IOException {
53+
@BeforeAll
54+
public static void globalSetup() throws IOException {
55+
cleanPluginData(PluginEnum.SENTINEL.getName());
5556
String pluginResult = initPlugin(PluginEnum.SENTINEL.getName(), "{\"model\":\"black\"}");
5657
assertThat(pluginResult, is("success"));
5758
}
@@ -122,8 +123,8 @@ private static List<RuleLocalData> buildRuleLocalDataList(final String fallbackU
122123
return Lists.newArrayList(ruleLocalData);
123124
}
124125

125-
@AfterEach
126-
public void clean() throws IOException {
126+
@AfterAll
127+
public static void clean() throws IOException {
127128
cleanPluginData(PluginEnum.SENTINEL.getName());
128129
}
129130
}

0 commit comments

Comments
 (0)