|
| 1 | +name: "Test the configuration management of Backend" |
| 2 | +description: "Auto test for Backend" |
| 3 | +runs: |
| 4 | + using: "composite" |
| 5 | + steps: |
| 6 | + - name: compile AgentLoader |
| 7 | + shell: bash |
| 8 | + run: | |
| 9 | + cp sermant-integration-tests/scripts/AgentLoader.java ./ |
| 10 | + javac -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader.java |
| 11 | + - name: start backend with zookeeper |
| 12 | + shell: bash |
| 13 | + env: |
| 14 | + DYNAMIC_CONFIG_SERVERADDRESS: 127.0.0.1:2181 |
| 15 | + DYNAMIC_CONFIG_DYNAMICCONFIGTYPE: ZOOKEEPER |
| 16 | + DYNAMIC_CONFIG_ENABLE: true |
| 17 | + NETTY_PORT: 6893 |
| 18 | + SERVER_PORT: 8910 |
| 19 | + run: | |
| 20 | + nohup java -jar sermant-agent-${{ env.sermantVersion }}/server/sermant/sermant-backend-${{ env.sermantVersion }}.jar & |
| 21 | + sleep 20 |
| 22 | + - name: start applications |
| 23 | + shell: bash |
| 24 | + env: |
| 25 | + dynamic.config.serverAddress: 127.0.0.1:2181 |
| 26 | + dynamic.config.dynamicConfigType: ZOOKEEPER |
| 27 | + service.meta.project: TestAgentCore |
| 28 | + run: | |
| 29 | + nohup java -jar \ |
| 30 | + sermant-agent-${{ env.sermantVersion }}/agent/agentcore-test-application-1.0.0-jar-with-dependencies.jar > ${{ env.logDir |
| 31 | + }}/agentcore-test.log 2>&1 & |
| 32 | + - name: waiting for agentcore services start |
| 33 | + shell: bash |
| 34 | + run: | |
| 35 | + bash ./sermant-integration-tests/scripts/checkService.sh http://127.0.0.1:8915/ping 120 |
| 36 | + - name: (install agent) modify plugins file |
| 37 | + shell: bash |
| 38 | + run: | |
| 39 | + sed -i '/dynamic-test-first-plugin/d' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml |
| 40 | + sed -i '/dynamic-test-second-plugin/d' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml |
| 41 | + sed -i '/ passive:/a \ - dynamic-test-first-plugin' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml |
| 42 | + sed -i '/ passive:/a \ - dynamic-test-second-plugin' sermant-agent-${{ env.sermantVersion }}/agent/config/plugins.yaml |
| 43 | + - name: dynamic install agent |
| 44 | + shell: bash |
| 45 | + run: java -classpath ./:${{ env.JAVA_HOME}}/lib/tools.jar AgentLoader sermant-agent-${{ env.sermantVersion }}/agent/sermant-agent.jar \ |
| 46 | + agent.service.hot.plugging.service.enable=true,agent.service.heartbeat.enable=true,agent.service.gateway.enable=true,event.enable=true,gateway.nettyPort=6893 |
| 47 | + - name: Sleep for 5 Seconds |
| 48 | + shell: bash |
| 49 | + run: sleep 20 |
| 50 | + - name: test install plugin |
| 51 | + shell: bash |
| 52 | + run: | |
| 53 | + export TEST_MODE=install |
| 54 | + python -m unittest ./sermant-integration-tests/scripts/test_backend_hot_plugging.py |
| 55 | + - name: test update plugin |
| 56 | + shell: bash |
| 57 | + run: | |
| 58 | + export TEST_MODE=update |
| 59 | + rm -rf sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-first-plugin/plugin/dynamic-test-first-plugin-1.0.0.jar |
| 60 | + rm -rf sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-second-plugin/plugin/dynamic-test-second-plugin-1.0.0.jar |
| 61 | + mv sermant-agent-${{ env.sermantVersion }}/dynamic-test-first-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-first-plugin/plugin |
| 62 | + mv sermant-agent-${{ env.sermantVersion }}/dynamic-test-second-plugin-1.0.0.jar sermant-agent-${{ env.sermantVersion }}/agent/pluginPackage/dynamic-test-second-plugin/plugin |
| 63 | + python -m unittest ./sermant-integration-tests/scripts/test_backend_hot_plugging.py |
| 64 | + - name: test uninstall plugin |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + export TEST_MODE=unInstall |
| 68 | + python -m unittest ./sermant-integration-tests/scripts/test_backend_hot_plugging.py |
| 69 | + - name: exit |
| 70 | + if: always() |
| 71 | + uses: ./.github/actions/common/exit |
| 72 | + with: |
| 73 | + processor-keyword: agentcore|backend |
| 74 | + - name: if failure then upload error log |
| 75 | + uses: actions/upload-artifact@v3 |
| 76 | + if: ${{ failure() || cancelled() }} |
| 77 | + with: |
| 78 | + name: (${{ github.job }})-backend-logs |
| 79 | + path: | |
| 80 | + ./*.log |
| 81 | + ./logs/** |
| 82 | + if-no-files-found: warn |
| 83 | + retention-days: 2 |
0 commit comments