-
Notifications
You must be signed in to change notification settings - Fork 167
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9bb2b8e
commit 0dc5e02
Showing
26 changed files
with
983 additions
and
97 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 Test" | ||
description: "Auto test for agent-core dynamic" | ||
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
38 changes: 38 additions & 0 deletions
38
...rc/test/java/com/huaweicloud/agentcore/test/request/dynamic/DynamicInstallPluginTest.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,38 @@ | ||
/* | ||
* 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.dynamic; | ||
|
||
import com.huaweicloud.agentcore.test.request.utils.RequestUtils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 动态安装插件测试方法,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-26 | ||
*/ | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "INSTALL_PLUGIN") | ||
public class DynamicInstallPluginTest { | ||
@Test | ||
public void testInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testInstallPlugin"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...c/test/java/com/huaweicloud/agentcore/test/request/dynamic/DynamicReInstallAgentTest.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,38 @@ | ||
/* | ||
* 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.dynamic; | ||
|
||
import com.huaweicloud.agentcore.test.request.utils.RequestUtils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 动态重装Agent测试方法,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-26 | ||
*/ | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "REINSTALL_AGENT") | ||
public class DynamicReInstallAgentTest { | ||
@Test | ||
public void testInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testReInstallAgent"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...c/test/java/com/huaweicloud/agentcore/test/request/dynamic/DynamicUninstallAgentTest.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,38 @@ | ||
/* | ||
* 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.dynamic; | ||
|
||
import com.huaweicloud.agentcore.test.request.utils.RequestUtils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 动态卸载Agent测试方法,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-26 | ||
*/ | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "UNINSTALL_AGENT") | ||
public class DynamicUninstallAgentTest { | ||
@Test | ||
public void testInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testUninstallAgent"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
.../test/java/com/huaweicloud/agentcore/test/request/dynamic/DynamicUninstallPluginTest.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,38 @@ | ||
/* | ||
* 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.dynamic; | ||
|
||
import com.huaweicloud.agentcore.test.request.utils.RequestUtils; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 动态卸载插件测试方法,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-26 | ||
*/ | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "UNINSTALL_PLUGIN") | ||
public class DynamicUninstallPluginTest { | ||
@Test | ||
public void testInstallPlugin() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testUninstallPlugin"); | ||
} | ||
} |
38 changes: 38 additions & 0 deletions
38
...src/test/java/com/huaweicloud/agentcore/test/request/dynamicconfig/DynamicConfigTest.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,38 @@ | ||
/* | ||
* 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.dynamicconfig; | ||
|
||
import com.huaweicloud.agentcore.test.request.utils.RequestUtils; | ||
|
||
import org.junit.jupiter.api.condition.EnabledIfSystemProperty; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* 动态配置测试方法,采用http请求调用方式测试 | ||
* | ||
* @author tangle | ||
* @since 2023-09-07 | ||
*/ | ||
@EnabledIfSystemProperty(named = "agentcore.test.type", matches = "DYNAMIC_CONFIG") | ||
public class DynamicConfigTest { | ||
@Test | ||
public void testDynamicConfig() throws IOException { | ||
RequestUtils.testRequest("http://127.0.0.1:8915/testDynamicConfig"); | ||
} | ||
} |
Oops, something went wrong.