From 83f7d325436677df6839e214fe141e8cf2fce9c0 Mon Sep 17 00:00:00 2001 From: provenceee <83857838+provenceee@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:02:00 +0800 Subject: [PATCH] *Fix graceful shutdown notify failure Signed-off-by: provenceee <83857838+provenceee@users.noreply.github.com> --- .github/actions/scenarios/spring/graceful/action.yml | 8 ++++---- .../io/sermant/integration/graceful/GracefulTest.java | 8 ++++++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/actions/scenarios/spring/graceful/action.yml b/.github/actions/scenarios/spring/graceful/action.yml index b26db8787..1174a99c4 100644 --- a/.github/actions/scenarios/spring/graceful/action.yml +++ b/.github/actions/scenarios/spring/graceful/action.yml @@ -66,10 +66,9 @@ runs: bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8014/testGraceful 60 - name: test graceful up shell: bash - run: mvn test -Dsermant.integration.test.type=GRACEFUL_FEIGN -Dgraceful.test.type=up --file sermant-integration-tests/spring-test/pom.xml - - name: test graceful up - shell: bash - run: mvn test -Dsermant.integration.test.type=GRACEFUL_REST -Dgraceful.test.type=up --file sermant-integration-tests/spring-test/pom.xml + run: | + mvn test -Dsermant.integration.test.type=GRACEFUL_FEIGN -Dgraceful.test.type=up --file sermant-integration-tests/spring-test/pom.xml + mvn test -Dsermant.integration.test.type=GRACEFUL_REST -Dgraceful.test.type=up --file sermant-integration-tests/spring-test/pom.xml - name: test rest graceful down shell: bash run: | @@ -80,6 +79,7 @@ runs: - name: test feign graceful down shell: bash run: | + mvn test -Dsermant.integration.test.type=GRACEFUL_FEIGN -Ddown.request.count=10 -Dgraceful.test.type=down --file sermant-integration-tests/spring-test/pom.xml jps -l | grep graceful-feign-provider | awk '{print $1}' | xargs -n 1 kill echo "========start test graceful=======" jps -l diff --git a/sermant-integration-tests/spring-test/spring-integration-test/src/test/java/io/sermant/integration/graceful/GracefulTest.java b/sermant-integration-tests/spring-test/spring-integration-test/src/test/java/io/sermant/integration/graceful/GracefulTest.java index f1a00eb39..76b479685 100644 --- a/sermant-integration-tests/spring-test/spring-integration-test/src/test/java/io/sermant/integration/graceful/GracefulTest.java +++ b/sermant-integration-tests/spring-test/spring-integration-test/src/test/java/io/sermant/integration/graceful/GracefulTest.java @@ -51,7 +51,7 @@ public abstract class GracefulTest { private static final int UP_REQUEST_COUNT = 500; - private static final int DOWN_REQUEST_COUNT = 1000; + private static final String DOWN_REQUEST_COUNT = "1000"; private final String url = getBaseUrl(); @@ -104,7 +104,7 @@ public void testGracefulDown() { return; } try { - for (int i = 0; i < DOWN_REQUEST_COUNT; i++) { + for (int i = 0; i < getDownRequestCount(); i++) { RequestUtils.get(buildUrl("testGraceful"), Collections.emptyMap(), String.class); } } catch (Exception exception) { @@ -113,6 +113,10 @@ public void testGracefulDown() { } } + private int getDownRequestCount() { + return Integer.parseInt(EnvUtils.getEnv("down.request.count", DOWN_REQUEST_COUNT)); + } + private void statistic(Map statisticMap) { final String port = RequestUtils.get(buildUrl("testGraceful"), Collections.emptyMap(), String.class);