-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1322 from TangLeDaily/install_action_1
AgentCore动态安装卸载测试:测试插件、测试应用、流水线
- Loading branch information
Showing
23 changed files
with
965 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
name: "Agent-core Dynamic Install/Uninstall Test" | ||
description: "Auto test for agent-core dynamic install/uninstall" | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: entry | ||
uses: ./.github/actions/common/entry | ||
with: | ||
log-dir: ./logs/agentcore-test/dynamic | ||
- name: compile AgentLoader | ||
shell: bash | ||
run: | | ||
cp sermant-integration-tests/scripts/AgentLoader.java ./ | ||
javac -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader.java | ||
- name: start applications | ||
shell: bash | ||
env: | ||
dynamic.config.serverAddress: 127.0.0.1:2181 | ||
dynamic.config.dynamicConfigType: ZOOKEEPER | ||
service.meta.project: TestAgentCore | ||
run: | | ||
nohup java -jar \ | ||
sermant-agent-${{ env.sermantVersion }}/agent/agentcore-test-application-1.0.0-jar-with-dependencies.jar > ${{ env.logDir | ||
}}/agentcore-test.log 2>&1 & | ||
- name: waiting for agentcore services start | ||
shell: bash | ||
run: | | ||
bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8915/ping 120 | ||
- name: (install agent) modify plugins file | ||
shell: bash | ||
run: | | ||
sed -i '/dynamic-test-first-plugin/d' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
sed -i '/dynamic-test-second-plugin/d' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
sed -i '/ passive:/a \ - dynamic-test-first-plugin' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
sed -i '/ passive:/a \ - dynamic-test-second-plugin' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml | ||
- name: (install agent) dynamic install agent | ||
shell: bash | ||
run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar | ||
- name: Sleep for 5 Seconds | ||
shell: bash | ||
run: sleep 5 | ||
- name: (install plugin) dynamic install plugin | ||
shell: bash | ||
run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar command=INSTALL-PLUGINS:dynamic-test-first-plugin/dynamic-test-second-plugin | ||
- name: Sleep for 5 Seconds | ||
shell: bash | ||
run: sleep 5 | ||
- name: (install plugin) test install plugin | ||
shell: bash | ||
run: mvn test -Dagentcore.test.type=INSTALL_PLUGIN --file sermant-integration-tests/agentcore-test/agentcore-integration-test/pom.xml | ||
- name: (uninstall plugin) dynamic uninstall plugin | ||
shell: bash | ||
run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar command=UNINSTALL-PLUGINS:dynamic-test-first-plugin | ||
- name: Sleep for 5 Seconds | ||
shell: bash | ||
run: sleep 5 | ||
- name: (uninstall plugin) test uninstall plugin | ||
shell: bash | ||
run: mvn test -Dagentcore.test.type=UNINSTALL_PLUGIN --file sermant-integration-tests/agentcore-test/agentcore-integration-test/pom.xml | ||
- name: (uninstall agent) dynamic uninstall agent | ||
shell: bash | ||
run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar command=UNINSTALL-AGENT | ||
- name: Sleep for 5 Seconds | ||
shell: bash | ||
run: sleep 5 | ||
- name: (uninstall agent) test uninstall agent | ||
shell: bash | ||
run: mvn test -Dagentcore.test.type=UNINSTALL_AGENT --file sermant-integration-tests/agentcore-test/agentcore-integration-test/pom.xml | ||
- name: (reinstall agent) dynamic reinstall agent | ||
shell: bash | ||
run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar command=INSTALL-PLUGINS:dynamic-test-first-plugin/dynamic-test-second-plugin | ||
- name: Sleep for 5 Seconds | ||
shell: bash | ||
run: sleep 5 | ||
- name: (reinstall agent) test reinstall agent | ||
shell: bash | ||
run: mvn test -Dagentcore.test.type=REINSTALL_AGENT --file sermant-integration-tests/agentcore-test/agentcore-integration-test/pom.xml | ||
- name: exit | ||
if: always() | ||
uses: ./.github/actions/common/exit | ||
with: | ||
processor-keyword: agentcore | ||
- name: if failure then upload error log | ||
uses: actions/upload-artifact@v3 | ||
if: ${{ failure() || cancelled() }} | ||
with: | ||
name: agentcore-test-logs | ||
path: | | ||
./*.log | ||
./logs/** | ||
if-no-files-found: warn | ||
retention-days: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
...re-integration-test/src/test/java/com/huaweicloud/agentcore/test/request/RequestTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* | ||
* Copyright (C) 2023-2023 Huawei Technologies Co., Ltd. All rights reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.huaweicloud.agentcore.test.request; | ||
|
||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 请求测试类,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-07 | ||
*/ | ||
public class RequestTest { | ||
/** | ||
* 动态配置测试方法 | ||
*/ | ||
@Test | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "DYNAMIC_CONFIG") | ||
public void testDynamicConfig() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testDynamicConfig"); | ||
} | ||
|
||
/** | ||
* 动态卸载插件测试方法 | ||
*/ | ||
@Test | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "UNINSTALL_PLUGIN") | ||
public void testUninstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testUninstallPlugin"); | ||
} | ||
|
||
/** | ||
* 动态卸载Agent测试方法 | ||
*/ | ||
@Test | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "UNINSTALL_AGENT") | ||
public void testUninstallAgent() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testUninstallAgent"); | ||
} | ||
|
||
/** | ||
* 动态重装Agent测试方法 | ||
*/ | ||
@Test | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "REINSTALL_AGENT") | ||
public void testReInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testReInstallAgent"); | ||
} | ||
|
||
/** | ||
* 动态安装插件测试方法 | ||
*/ | ||
@Test | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "INSTALL_PLUGIN") | ||
public void testInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testInstallPlugin"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.