chore(autotest): add broker 5.0 performance test suite

This commit is contained in:
mengzhenyu 2021-11-18 15:06:12 +08:00
parent 3c966d77ca
commit efa7560a15
5 changed files with 3774 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,142 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="xmeter_runtime_vars" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="emqx_ip1" elementType="Argument">
<stringProp name="Argument.name">emqx_ip1</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip1,,)}</stringProp>
<stringProp name="Argument.desc">emqx server ip</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip2" elementType="Argument">
<stringProp name="Argument.name">emqx_ip2</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip2,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip3" elementType="Argument">
<stringProp name="Argument.name">emqx_ip3</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip3,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_user" elementType="Argument">
<stringProp name="Argument.name">emqx_user</stringProp>
<stringProp name="Argument.value">admin</stringProp>
<stringProp name="Argument.desc">emqx account</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_pwd" elementType="Argument">
<stringProp name="Argument.name">emqx_pwd</stringProp>
<stringProp name="Argument.value">public</stringProp>
<stringProp name="Argument.desc">emqx password</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="mqtt_username" elementType="Argument">
<stringProp name="Argument.name">mqtt_username</stringProp>
<stringProp name="Argument.value">emqx</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="mqtt_password" elementType="Argument">
<stringProp name="Argument.name">mqtt_password</stringProp>
<stringProp name="Argument.value">public</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="connect" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">80000</stringProp>
<stringProp name="ThreadGroup.ramp_time">400</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<net.xmeter.samplers.EfficientConnectSampler guiclass="net.xmeter.gui.EfficientConnectSamplerUI" testclass="net.xmeter.samplers.EfficientConnectSampler" testname="Efficient MQTT Connect" enabled="true">
<stringProp name="mqtt.server">${__RandomFromMultipleVars(emqx_ip1|emqx_ip2|emqx_ip3,)}</stringProp>
<stringProp name="mqtt.port">1883</stringProp>
<stringProp name="mqtt.version">3.1</stringProp>
<stringProp name="mqtt.conn_timeout">100</stringProp>
<stringProp name="mqtt.protocol">TCP</stringProp>
<stringProp name="mqtt.ws_path"></stringProp>
<boolProp name="mqtt.dual_ssl_authentication">false</boolProp>
<stringProp name="mqtt.clientcert_file_path"></stringProp>
<stringProp name="mqtt.clientcert_password"></stringProp>
<stringProp name="mqtt.user_name">${mqtt_username}</stringProp>
<stringProp name="mqtt.password">${mqtt_password}</stringProp>
<stringProp name="mqtt.client_id_prefix"></stringProp>
<boolProp name="mqtt.client_id_suffix">true</boolProp>
<stringProp name="mqtt.conn_keep_alive">300</stringProp>
<stringProp name="mqtt.conn_attampt_max">0</stringProp>
<stringProp name="mqtt.reconn_attampt_max">0</stringProp>
<stringProp name="mqtt.conn_clean_session">true</stringProp>
<boolProp name="mqtt.sub_when_connected">false</boolProp>
<stringProp name="mqtt.qos_level">0</stringProp>
<stringProp name="mqtt.topic_name"></stringProp>
<stringProp name="mqtt.conn_capacity">5</stringProp>
</net.xmeter.samplers.EfficientConnectSampler>
<hashTree/>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">500000</stringProp>
</TestAction>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>

View File

@ -0,0 +1,132 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="xmeter_runtime_vars" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="emqx_ip1" elementType="Argument">
<stringProp name="Argument.name">emqx_ip1</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip1,,)}</stringProp>
<stringProp name="Argument.desc">emqx server ip</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip2" elementType="Argument">
<stringProp name="Argument.name">emqx_ip2</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip2,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip3" elementType="Argument">
<stringProp name="Argument.name">emqx_ip3</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip3,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_user" elementType="Argument">
<stringProp name="Argument.name">emqx_user</stringProp>
<stringProp name="Argument.value">admin</stringProp>
<stringProp name="Argument.desc">emqx account</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_pwd" elementType="Argument">
<stringProp name="Argument.name">emqx_pwd</stringProp>
<stringProp name="Argument.value">public</stringProp>
<stringProp name="Argument.desc">emqx password</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<ResultCollector guiclass="ViewResultsFullVisualizer" testclass="ResultCollector" testname="View Results Tree" enabled="false">
<boolProp name="ResultCollector.error_logging">false</boolProp>
<objProp>
<name>saveConfig</name>
<value class="SampleSaveConfiguration">
<time>true</time>
<latency>true</latency>
<timestamp>true</timestamp>
<success>true</success>
<label>true</label>
<code>true</code>
<message>true</message>
<threadName>true</threadName>
<dataType>true</dataType>
<encoding>false</encoding>
<assertions>true</assertions>
<subresults>true</subresults>
<responseData>false</responseData>
<samplerData>false</samplerData>
<xml>false</xml>
<fieldNames>true</fieldNames>
<responseHeaders>false</responseHeaders>
<requestHeaders>false</requestHeaders>
<responseDataOnError>false</responseDataOnError>
<saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
<assertionsResultsToSave>0</assertionsResultsToSave>
<bytes>true</bytes>
<sentBytes>true</sentBytes>
<url>true</url>
<threadCounts>true</threadCounts>
<idleTime>true</idleTime>
<connectTime>true</connectTime>
</value>
</objProp>
<stringProp name="filename"></stringProp>
</ResultCollector>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="connect" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">80000</stringProp>
<stringProp name="ThreadGroup.ramp_time">400</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<net.xmeter.samplers.EfficientConnectSampler guiclass="net.xmeter.gui.EfficientConnectSamplerUI" testclass="net.xmeter.samplers.EfficientConnectSampler" testname="Efficient MQTT Connect" enabled="true">
<stringProp name="mqtt.server">${__RandomFromMultipleVars(emqx_ip1|emqx_ip2|emqx_ip3,)}</stringProp>
<stringProp name="mqtt.port">1883</stringProp>
<stringProp name="mqtt.version">3.1</stringProp>
<stringProp name="mqtt.conn_timeout">100</stringProp>
<stringProp name="mqtt.protocol">TCP</stringProp>
<stringProp name="mqtt.ws_path"></stringProp>
<boolProp name="mqtt.dual_ssl_authentication">false</boolProp>
<stringProp name="mqtt.clientcert_file_path"></stringProp>
<stringProp name="mqtt.clientcert_password"></stringProp>
<stringProp name="mqtt.user_name"></stringProp>
<stringProp name="mqtt.password"></stringProp>
<stringProp name="mqtt.client_id_prefix"></stringProp>
<boolProp name="mqtt.client_id_suffix">true</boolProp>
<stringProp name="mqtt.conn_keep_alive">300</stringProp>
<stringProp name="mqtt.conn_attampt_max">0</stringProp>
<stringProp name="mqtt.reconn_attampt_max">0</stringProp>
<stringProp name="mqtt.conn_clean_session">true</stringProp>
<boolProp name="mqtt.sub_when_connected">false</boolProp>
<stringProp name="mqtt.qos_level">0</stringProp>
<stringProp name="mqtt.topic_name"></stringProp>
<stringProp name="mqtt.conn_capacity">5</stringProp>
</net.xmeter.samplers.EfficientConnectSampler>
<hashTree/>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">500000</stringProp>
</TestAction>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>

View File

@ -0,0 +1,105 @@
<?xml version="1.0" encoding="UTF-8"?>
<jmeterTestPlan version="1.2" properties="5.0" jmeter="5.3">
<hashTree>
<TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
<stringProp name="TestPlan.comments"></stringProp>
<boolProp name="TestPlan.functional_mode">false</boolProp>
<boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
<boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
<elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments"/>
</elementProp>
<stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
<Arguments guiclass="ArgumentsPanel" testclass="Arguments" testname="xmeter_runtime_vars" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="emqx_ip1" elementType="Argument">
<stringProp name="Argument.name">emqx_ip1</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip1,,)}</stringProp>
<stringProp name="Argument.desc">emqx server ip</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip2" elementType="Argument">
<stringProp name="Argument.name">emqx_ip2</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip2,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_ip3" elementType="Argument">
<stringProp name="Argument.name">emqx_ip3</stringProp>
<stringProp name="Argument.value">${__property(emqx_ip3,,)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_user" elementType="Argument">
<stringProp name="Argument.name">emqx_user</stringProp>
<stringProp name="Argument.value">admin</stringProp>
<stringProp name="Argument.desc">emqx account</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="emqx_pwd" elementType="Argument">
<stringProp name="Argument.name">emqx_pwd</stringProp>
<stringProp name="Argument.value">public</stringProp>
<stringProp name="Argument.desc">emqx password</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="mqtt_username" elementType="Argument">
<stringProp name="Argument.name">mqtt_username</stringProp>
<stringProp name="Argument.value">emqx</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
<elementProp name="mqtt_password" elementType="Argument">
<stringProp name="Argument.name">mqtt_password</stringProp>
<stringProp name="Argument.value">public</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
</Arguments>
<hashTree/>
<ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="connect" enabled="true">
<stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
<elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" testname="Loop Controller" enabled="true">
<boolProp name="LoopController.continue_forever">false</boolProp>
<stringProp name="LoopController.loops">1</stringProp>
</elementProp>
<stringProp name="ThreadGroup.num_threads">20000</stringProp>
<stringProp name="ThreadGroup.ramp_time">35</stringProp>
<boolProp name="ThreadGroup.scheduler">false</boolProp>
<stringProp name="ThreadGroup.duration"></stringProp>
<stringProp name="ThreadGroup.delay"></stringProp>
<boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
</ThreadGroup>
<hashTree>
<net.xmeter.samplers.EfficientConnectSampler guiclass="net.xmeter.gui.EfficientConnectSamplerUI" testclass="net.xmeter.samplers.EfficientConnectSampler" testname="Efficient MQTT Connect" enabled="true">
<stringProp name="mqtt.server">${__RandomFromMultipleVars(emqx_ip1|emqx_ip2|emqx_ip3,)}</stringProp>
<stringProp name="mqtt.port">1883</stringProp>
<stringProp name="mqtt.version">3.1</stringProp>
<stringProp name="mqtt.conn_timeout">10</stringProp>
<stringProp name="mqtt.protocol">TCP</stringProp>
<stringProp name="mqtt.ws_path"></stringProp>
<boolProp name="mqtt.dual_ssl_authentication">false</boolProp>
<stringProp name="mqtt.clientcert_file_path"></stringProp>
<stringProp name="mqtt.clientcert_password"></stringProp>
<stringProp name="mqtt.user_name">${mqtt_username}</stringProp>
<stringProp name="mqtt.password">${mqtt_password}</stringProp>
<stringProp name="mqtt.client_id_prefix"></stringProp>
<boolProp name="mqtt.client_id_suffix">true</boolProp>
<stringProp name="mqtt.conn_keep_alive">300</stringProp>
<stringProp name="mqtt.conn_attampt_max">0</stringProp>
<stringProp name="mqtt.reconn_attampt_max">0</stringProp>
<stringProp name="mqtt.conn_clean_session">true</stringProp>
<boolProp name="mqtt.sub_when_connected">false</boolProp>
<stringProp name="mqtt.qos_level">0</stringProp>
<stringProp name="mqtt.topic_name"></stringProp>
<stringProp name="mqtt.conn_capacity">1</stringProp>
</net.xmeter.samplers.EfficientConnectSampler>
<hashTree/>
<TestAction guiclass="TestActionGui" testclass="TestAction" testname="Flow Control Action" enabled="true">
<intProp name="ActionProcessor.action">1</intProp>
<intProp name="ActionProcessor.target">0</intProp>
<stringProp name="ActionProcessor.duration">240000</stringProp>
</TestAction>
<hashTree/>
</hashTree>
</hashTree>
</hashTree>
</jmeterTestPlan>

View File

@ -0,0 +1,470 @@
name: Cluster Performance Test Suite
concurrency:
group: slim-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
profile:
- emqx
otp:
- 23.3.4.9-3
os:
- ubuntu20.04
container: "ghcr.io/emqx/emqx-builder/5.0-2:${{ matrix.otp }}-${{ matrix.os }}"
steps:
- uses: actions/checkout@v1
- name: build zip packages
run: make ${{ matrix.profile }}-zip
- name: packages test
run: |
export CODE_PATH=$GITHUB_WORKSPACE
EMQX_NAME=${{ matrix.profile }} .ci/build_packages/tests.sh
- uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os}}
path: _packages/**/*.zip
terraform_emqx:
runs-on: ubuntu-latest
needs: [build]
outputs:
emqx_public_ip: ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
emqx_node_ip1: ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
emqx_node_ip2: ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
emqx_node_ip3: ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ubuntu20.04
path: /tmp
- name: Download emqx package
run: |
sudo cp /tmp/emqx/*.zip /tmp/emqx.zip
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: init1
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: validate1
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/emqx
id: server_ip
run: |
terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}" -var="emqx_package=/tmp/emqx.zip"
echo "::set-output name=emqx_private_ips::$(terraform output emqx_private_ips)"
echo "::set-output name=emqx_public_ips::$(terraform output emqx_public_ips)"
- name: Rename and upload emqx tfstate
working-directory: ./tf-test-automation/services/emqx
run: |
mv ./terraform.tfstate ./emqx.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/emqx/emqx.tfstate
- name: Show emqx_private_ips
id: emqx_private_ip
run: |
ip1=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $1}'`
ip2=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $2}'`
ip3=`echo "${{ steps.server_ip.outputs.emqx_private_ips }}"|awk -F ',' '{print $3}'`
emqx_public_ip=`echo "${{ steps.server_ip.outputs.emqx_public_ips }}"|awk -F ',' '{print $1}'`
echo "::set-output name=emqx_node_ip1::$ip1"
echo "::set-output name=emqx_node_ip2::$ip2"
echo "::set-output name=emqx_node_ip3::$ip3"
echo "::set-output name=emqx_public_ip::$emqx_public_ip"
- name: Show emqx node ip
run: |
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip1 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip2 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_node_ip3 }}
echo ${{ steps.emqx_private_ip.outputs.emqx_public_ip }}
xmeter_start:
runs-on: ubuntu-latest
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}
aws-region: ap-southeast-1
- name: Start Xmeter Services
run: |
aws ec2 start-instances --instance-ids i-0dd6d99916baaa1a8
aws ec2 start-instances --instance-ids i-05222103df01eb2d7
sleep 40;
aws ec2 start-instances --instance-ids i-0c5dccd394ed9be18
aws ec2 start-instances --instance-ids i-04c1c50b3e4952266
terraform_mysql:
runs-on: ubuntu-latest
outputs:
mysql_ip: ${{ steps.mysql_ip.outputs.mysql_ip }}
mysql_url: ${{ steps.mysql_url.outputs.mysql_url }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: init1
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: validate1
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/mysql
id: mysql_url
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
echo "::set-output name=mysql_url::$(terraform output endpoint)"
- name: Rename and upload mysql tfstate
working-directory: ./tf-test-automation/services/mysql
run: |
mv ./terraform.tfstate ./mysql.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/mysql/mysql.tfstate
- name: Show mysql url
id: mysql_ip
run: |
ip=`echo "${{ steps.mysql_url.outputs.mysql_url }}"|awk -F ':' '{print $1}'`
echo "::set-output name=mysql_ip::$ip"
- name: Show mysql ip
run: |
echo ${{ steps.mysql_url.outputs.mysql_url }}
echo ${{ steps.mysql_ip.outputs.mysql_ip }}
#
terraform_redis:
runs-on: ubuntu-latest
outputs:
redis_ip: ${{ steps.redis_ip.outputs.redis_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/redis
id: redis_ip
run: |
terraform apply -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
echo "::set-output name=redis_ip::$(terraform output redis_private_ips)"
- name: Rename and upload redis server tfstate
working-directory: ./tf-test-automation/services/redis
run: |
mv ./terraform.tfstate ./redis.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/redis/redis.tfstate
- name: Show redis ip
run: |
echo ${{ steps.redis_ip.outputs.redis_ip }}
terraform_pgsql:
runs-on: ubuntu-latest
outputs:
pgsql_url: ${{ steps.pgsql_url.outputs.pgsql_url }}
pgsql_ip: ${{ steps.pgsql_ip.outputs.pgsql_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/pgsql
id: pgsql_url
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
echo "::set-output name=pgsql_url::$(terraform output endpoint)"
- name: Rename and upload pgsql server tfstate
working-directory: ./tf-test-automation/services/pgsql
run: |
mv ./terraform.tfstate ./pgsql.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/pgsql/pgsql.tfstate
- name: Show pgsql url
id: pgsql_ip
run: |
ip=`echo "${{ steps.pgsql_url.outputs.pgsql_url }}"|awk -F ':' '{print $1}'`
echo "::set-output name=pgsql_ip::$ip"
- name: Show pgsql ip
run: |
echo ${{ steps.pgsql_url.outputs.pgsql_url }}
echo ${{ steps.pgsql_ip.outputs.pgsql_ip }}
terraform_mongo:
runs-on: ubuntu-latest
outputs:
mongo_ip: ${{ steps.mongo_ip.outputs.mongo_ip }}
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: emqx-broker
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- name: Terraform Init tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: init
run: |
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Validate tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: validate
run: terraform validate -no-color
- name: Terraform Apply tf-test-automation
working-directory: ./tf-test-automation/services/mongodb
id: mongo_ip
run: |
terraform apply -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
echo "::set-output name=mongo_ip::$(terraform output mongo_private_ips)"
- name: Rename and upload mongo server tfstate
working-directory: ./tf-test-automation/services/mongodb
run: |
mv ./terraform.tfstate ./mongo.tfstate
- uses: actions/upload-artifact@v2
if: always()
with:
name: tfstate
path: ./tf-test-automation/services/mongodb/mongo.tfstate
- name: Show mongo ip
run: |
echo ${{ steps.mongo_ip.outputs.mongo_ip }}
master_control:
runs-on: ubuntu-latest
needs: [xmeter_start, terraform_emqx, terraform_mysql, terraform_redis, terraform_pgsql, terraform_mongo]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: '8.0.282' # The JDK version to make available on the path.
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk
architecture: x64 # (x64 or x86) - defaults to x64
- name: install jmeter
timeout-minutes: 10
env:
JMETER_VERSION: 5.3
run: |
wget --no-verbose --no-check-certificate -O /tmp/apache-jmeter.tgz https://downloads.apache.org/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
cd /tmp && tar -xvf apache-jmeter.tgz
echo "jmeter.save.saveservice.output_format=xml" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
echo "jmeter.save.saveservice.response_data.on_error=true" >> /tmp/apache-jmeter-$JMETER_VERSION/user.properties
wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/ext/mqtt-xmeter-fuse-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-fuse-2.0.2-jar-with-dependencies.jar
ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter
- name: install jmeter plugin
run: |
wget --no-verbose -O "/opt/jmeter/lib/mysql-connector-java-8.0.16.jar" https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.16/mysql-connector-java-8.0.16.jar
- name: run jmeter
run: |
/opt/jmeter/bin/jmeter.sh \
-Jjmeter.save.saveservice.output_format=xml -n \
-t .ci/broker-performance-test-suite/broker_attestation_test.jmx \
-Demqx_ip=${{ needs.terraform_emqx.outputs.emqx_public_ip }} \
-Demqx_private_ip1=${{ needs.terraform_emqx.outputs.emqx_node_ip1 }} \
-Demqx_private_ip2=${{ needs.terraform_emqx.outputs.emqx_node_ip2 }} \
-Demqx_private_ip3=${{ needs.terraform_emqx.outputs.emqx_node_ip3 }} \
-Dmysql_ip=${{ needs.terraform_mysql.outputs.mysql_ip }} \
-Dpgsql_ip=${{ needs.terraform_pgsql.outputs.pgsql_ip }} \
-Dredis_ip=${{ needs.terraform_redis.outputs.redis_ip }} \
-Dmongo_ip=${{ needs.terraform_mongo.outputs.mongo_ip }} \
-Dxmeter_ip=${{ secrets.XMETER_IP }} \
-Dplugins_path="/opt/jmeter/lib/ext" \
-Dxmeter_user=${{ secrets.XMETER_USER }} \
-Dxmeter_pwd=${{ secrets.XMETER_PWD }} \
-Dscripts_path=".ci/performance-test-suite" \
-Dreport_file="jmeter_logs/report.txt" \
-l jmeter_logs/xmeter_process.jtl \
-j jmeter_logs/xmeter_process.log
- name: check logs
run: |
if cat jmeter_logs/xmeter_process.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
echo "check logs filed"
fi
- name: check report
run: |
if cat jmeter_logs/report.txt | grep -e 'err_report_id' > /dev/null 2>&1; then
echo "check report filed"
exit 1
fi
- uses: actions/upload-artifact@v2
if: always()
with:
name: jmeter_logs_report
path: ./jmeter_logs
terraform_destroy:
runs-on: ubuntu-latest
needs: [master_control]
steps:
- name: Checkout tf-test-automation
uses: actions/checkout@v2
with:
repository: emqx/tf-test-automation
ref: cluster
path: tf-test-automation
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1.3.2
with:
terraform_wrapper: false
- uses: actions/download-artifact@v2
with:
name: tfstate
path: ./tf-test-automation/services
- name: Terraform Init mysql
working-directory: ./tf-test-automation/services
run: |
cp mysql.tfstate ./mysql/terraform.tfstate
cd ./mysql
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Destroy mysql
working-directory: ./tf-test-automation/services/mysql
run: |
terraform destroy -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Init emqx
working-directory: ./tf-test-automation/services
run: |
cp emqx.tfstate ./emqx/terraform.tfstate
cd ./emqx
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Destroy emqx
working-directory: ./tf-test-automation/services/emqx
run: |
terraform destroy -auto-approve -var="region=ap-southeast-1" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Init redis
working-directory: ./tf-test-automation/services
run: |
cp redis.tfstate ./redis/terraform.tfstate
cd ./redis
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Destroy redis
working-directory: ./tf-test-automation/services/redis
run: |
terraform destroy -auto-approve -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}" -var="private_key=${{ secrets.CI_SSH_PRIVATE_KEY }}"
- name: Terraform Init pgsql
working-directory: ./tf-test-automation/services
run: |
cp pgsql.tfstate ./pgsql/terraform.tfstate
cd ./pgsql
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Destroy pgsql
working-directory: ./tf-test-automation/services/pgsql
run: |
terraform destroy -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Init mongo
working-directory: ./tf-test-automation/services
run: |
cp mongo.tfstate ./mongodb/terraform.tfstate
cd ./mongodb
terraform init --backend-config="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" --backend-config="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
- name: Terraform Destroy mongo
working-directory: ./tf-test-automation/services/mongodb
run: |
terraform destroy -auto-approve -var="db_password=public123" -var="access_key=${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}" -var="secret_key=${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}"
xmeter_stop:
runs-on: ubuntu-latest
needs: [terraform_destroy]
steps:
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_FOR_PERFORMANCE_TESTING }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_FOR_PERFORMANCE_TESTING }}
aws-region: ap-southeast-1
- name: Start Xmeter Services
run: |
aws ec2 stop-instances --instance-ids i-0dd6d99916baaa1a8
aws ec2 stop-instances --instance-ids i-05222103df01eb2d7
aws ec2 stop-instances --instance-ids i-0c5dccd394ed9be18
aws ec2 stop-instances --instance-ids i-04c1c50b3e4952266