379 lines
14 KiB
YAML
379 lines
14 KiB
YAML
name: JMeter integration tests
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
jmeter_artifact:
|
|
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }}
|
|
steps:
|
|
- name: Cache Jmeter
|
|
id: cache-jmeter
|
|
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
|
|
with:
|
|
path: /tmp/apache-jmeter.tgz
|
|
key: apache-jmeter-5.4.3.tgz
|
|
- name: download jmeter
|
|
if: steps.cache-jmeter.outputs.cache-hit != 'true'
|
|
timeout-minutes: 15
|
|
env:
|
|
JMETER_VERSION: 5.4.3
|
|
run: |
|
|
# versions below 5.5 had been moved to the archive area
|
|
# latest version is 5.6, the script below should handle both scenarios
|
|
URL=https://downloads.apache.org/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
|
|
ARCHIVE_URL=https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-$JMETER_VERSION.tgz
|
|
if wget -q --method HEAD $URL; then
|
|
wget --no-verbose --no-check-certificate -O /tmp/apache-jmeter.tgz $URL
|
|
else
|
|
wget --no-verbose --no-check-certificate -O /tmp/apache-jmeter.tgz $ARCHIVE_URL
|
|
fi
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
with:
|
|
name: apache-jmeter.tgz
|
|
path: /tmp/apache-jmeter.tgz
|
|
retention-days: 3
|
|
|
|
advanced_feat:
|
|
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
scripts_type:
|
|
- mqtt_subscription_topic_metrics
|
|
- mqtt_delayed_publish
|
|
- mqtt_topic_rewrite
|
|
# - mqtt_retainer
|
|
|
|
needs: jmeter_artifact
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
- name: Set up environment
|
|
id: env
|
|
run: |
|
|
source env.sh
|
|
PKG_VSN=$(docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) "$EMQX_BUILDER" ./pkg-vsn.sh emqx)
|
|
echo "PKG_VSN=$PKG_VSN" >> "$GITHUB_ENV"
|
|
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
name: emqx-docker
|
|
path: /tmp
|
|
- name: load docker image
|
|
shell: bash
|
|
run: |
|
|
EMQX_DOCKER_IMAGE_TAG=$(docker load < /tmp/emqx-docker-${PKG_VSN}.tar.gz | sed 's/Loaded image: //g')
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_DOCKER_IMAGE_TAG" >> $GITHUB_ENV
|
|
- uses: ./.github/actions/prepare-jmeter
|
|
- name: docker compose up
|
|
timeout-minutes: 5
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
up --wait --build
|
|
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
|
|
- name: show logs
|
|
if: failure()
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
logs
|
|
- name: run jmeter
|
|
run: |
|
|
jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \
|
|
-Demqx_ip=$HAPROXY_IP \
|
|
-l jmeter_logs/${{ matrix.scripts_type }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.scripts_type }}.log
|
|
- name: check logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.scripts_type }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
if: always()
|
|
with:
|
|
name: jmeter_logs-advanced_feat-${{ matrix.scripts_type }}
|
|
path: ./jmeter_logs
|
|
retention-days: 3
|
|
|
|
pgsql_authn_authz:
|
|
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
pgsql_tag:
|
|
- 9
|
|
- 10
|
|
- 11
|
|
- 12
|
|
- 13
|
|
scripts_type:
|
|
- pgsql_authn
|
|
- pgsql_authz
|
|
|
|
needs: jmeter_artifact
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
- name: Set up environment
|
|
id: env
|
|
run: |
|
|
source env.sh
|
|
PKG_VSN=$(docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) "$EMQX_BUILDER" ./pkg-vsn.sh emqx)
|
|
echo "PKG_VSN=$PKG_VSN" >> "$GITHUB_ENV"
|
|
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
name: emqx-docker
|
|
path: /tmp
|
|
- name: load docker image
|
|
shell: bash
|
|
run: |
|
|
EMQX_DOCKER_IMAGE_TAG=$(docker load < /tmp/emqx-docker-${PKG_VSN}.tar.gz | sed 's/Loaded image: //g')
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_DOCKER_IMAGE_TAG" >> $GITHUB_ENV
|
|
- uses: ./.github/actions/prepare-jmeter
|
|
- name: docker compose up
|
|
timeout-minutes: 5
|
|
env:
|
|
PGSQL_TAG: ${{ matrix.pgsql_tag }}
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-pgsql-tls.yaml \
|
|
up --wait --build
|
|
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
|
|
echo PGSQL_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' pgsql-tls) >> $GITHUB_ENV
|
|
- name: run jmeter
|
|
run: |
|
|
jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \
|
|
-Demqx_ip=$HAPROXY_IP \
|
|
-Ddb_ip=$PGSQL_IP \
|
|
-Dport="5432" \
|
|
-Dpgsql_user="root" \
|
|
-Dpgsql_pwd="public" \
|
|
-Ddbname="mqtt" \
|
|
-Droute="apps/emqx_auth/test/data/certs" \
|
|
-Dca_name="ca.crt" \
|
|
-Dkey_name="client.key" \
|
|
-Dcert_name="client.crt" \
|
|
-l jmeter_logs/${{ matrix.scripts_type }}_${{ matrix.pgsql_tag }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.scripts_type }}_${{ matrix.pgsql_tag }}.log
|
|
- name: check logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.scripts_type }}_${{ matrix.pgsql_tag }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- name: dump docker compose logs
|
|
if: failure()
|
|
run: |
|
|
docker compose -f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml logs --no-color > ./jmeter_logs/emqx.log
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
if: always()
|
|
with:
|
|
name: jmeter_logs-pgsql_authn_authz-${{ matrix.scripts_type }}_${{ matrix.pgsql_tag }}
|
|
path: ./jmeter_logs
|
|
retention-days: 3
|
|
|
|
mysql_authn_authz:
|
|
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
mysql_tag:
|
|
- 5.7
|
|
- 8
|
|
scripts_type:
|
|
- mysql_authn
|
|
- mysql_authz
|
|
|
|
needs: jmeter_artifact
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
- name: Set up environment
|
|
id: env
|
|
run: |
|
|
source env.sh
|
|
PKG_VSN=$(docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) "$EMQX_BUILDER" ./pkg-vsn.sh emqx)
|
|
echo "PKG_VSN=$PKG_VSN" >> "$GITHUB_ENV"
|
|
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
name: emqx-docker
|
|
path: /tmp
|
|
- name: load docker image
|
|
shell: bash
|
|
run: |
|
|
EMQX_DOCKER_IMAGE_TAG=$(docker load < /tmp/emqx-docker-${PKG_VSN}.tar.gz | sed 's/Loaded image: //g')
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_DOCKER_IMAGE_TAG" >> $GITHUB_ENV
|
|
- uses: ./.github/actions/prepare-jmeter
|
|
- name: docker compose up
|
|
timeout-minutes: 5
|
|
env:
|
|
PGSQL_TAG: ${{ matrix.mysql_tag }}
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
-f .ci/docker-compose-file/docker-compose-mysql-tls.yaml \
|
|
up --wait --build
|
|
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
|
|
echo MYSQL_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mysql-tls) >> $GITHUB_ENV
|
|
- name: run jmeter
|
|
run: |
|
|
jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \
|
|
-Demqx_ip=$HAPROXY_IP \
|
|
-Dmysql_ip=$MYSQL_IP \
|
|
-Dport="3306" \
|
|
-Dmysql_user="root" \
|
|
-Dmysql_pwd="public" \
|
|
-Ddbname="mqtt" \
|
|
-Droute="apps/emqx_auth/test/data/certs" \
|
|
-Dca_name="ca.crt" \
|
|
-Dkey_name="client.key" \
|
|
-Dcert_name="client.crt" \
|
|
-l jmeter_logs/${{ matrix.scripts_type }}_${{ matrix.mysql_tag }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.scripts_type }}_${{ matrix.mysql_tag }}.log
|
|
- name: check logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.scripts_type }}_${{ matrix.mysql_tag }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
if: always()
|
|
with:
|
|
name: jmeter_logs-mysql_authn_authz-${{ matrix.scripts_type }}_${{ matrix.mysql_tag }}
|
|
path: ./jmeter_logs
|
|
retention-days: 3
|
|
|
|
JWT_authn:
|
|
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
scripts_type:
|
|
- jwt_authn
|
|
|
|
needs: jmeter_artifact
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
- name: Set up environment
|
|
id: env
|
|
run: |
|
|
source env.sh
|
|
PKG_VSN=$(docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) "$EMQX_BUILDER" ./pkg-vsn.sh emqx)
|
|
echo "PKG_VSN=$PKG_VSN" >> "$GITHUB_ENV"
|
|
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
name: emqx-docker
|
|
path: /tmp
|
|
- name: load docker image
|
|
shell: bash
|
|
run: |
|
|
EMQX_DOCKER_IMAGE_TAG=$(docker load < /tmp/emqx-docker-${PKG_VSN}.tar.gz | sed 's/Loaded image: //g')
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_DOCKER_IMAGE_TAG" >> $GITHUB_ENV
|
|
- uses: ./.github/actions/prepare-jmeter
|
|
- name: docker compose up
|
|
timeout-minutes: 5
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
up --wait --build
|
|
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
|
|
- name: run jwks_server
|
|
timeout-minutes: 10
|
|
run: |
|
|
cd scripts/jwks-server
|
|
mvn package
|
|
cd target
|
|
docker run --name jwks_server --network emqx_bridge --ip 172.100.239.88 -d -v $(pwd)/jwkserver-0.0.1.jar:/jwks_server/jwkserver-0.0.1.jar --workdir /jwks_server public.ecr.aws/amazoncorretto/amazoncorretto:8 bash \
|
|
-c "java -jar jwkserver-0.0.1.jar"
|
|
- name: run jmeter
|
|
run: |
|
|
jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \
|
|
-Demqx_ip=$HAPROXY_IP \
|
|
-Djwks_ip="172.100.239.88" \
|
|
-l jmeter_logs/${{ matrix.scripts_type }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.scripts_type }}.log
|
|
- name: check logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.scripts_type }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
if: always()
|
|
with:
|
|
name: jmeter_logs-JWT_authn-${{ matrix.scripts_type }}
|
|
path: ./jmeter_logs
|
|
retention-days: 3
|
|
|
|
built_in_database_authn_authz:
|
|
runs-on: ${{ github.repository_owner == 'emqx' && fromJSON('["self-hosted","ephemeral","linux","x64"]') || 'ubuntu-22.04' }}
|
|
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
scripts_type:
|
|
- built_in_database_authn
|
|
- built_in_database_authz
|
|
|
|
needs: jmeter_artifact
|
|
steps:
|
|
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
|
|
- name: Set up environment
|
|
id: env
|
|
run: |
|
|
source env.sh
|
|
PKG_VSN=$(docker run --rm -v $(pwd):$(pwd) -w $(pwd) -u $(id -u) "$EMQX_BUILDER" ./pkg-vsn.sh emqx)
|
|
echo "PKG_VSN=$PKG_VSN" >> "$GITHUB_ENV"
|
|
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
|
|
with:
|
|
name: emqx-docker
|
|
path: /tmp
|
|
- name: load docker image
|
|
shell: bash
|
|
run: |
|
|
EMQX_DOCKER_IMAGE_TAG=$(docker load < /tmp/emqx-docker-${PKG_VSN}.tar.gz | sed 's/Loaded image: //g')
|
|
echo "_EMQX_DOCKER_IMAGE_TAG=$EMQX_DOCKER_IMAGE_TAG" >> $GITHUB_ENV
|
|
- uses: ./.github/actions/prepare-jmeter
|
|
- name: docker compose up
|
|
timeout-minutes: 5
|
|
run: |
|
|
docker compose \
|
|
-f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \
|
|
up --wait --build
|
|
echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV
|
|
- name: run jmeter
|
|
run: |
|
|
jmeter/bin/jmeter.sh \
|
|
-Jjmeter.save.saveservice.output_format=xml -n \
|
|
-t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \
|
|
-Demqx_ip=$HAPROXY_IP \
|
|
-l jmeter_logs/${{ matrix.scripts_type }}.jtl \
|
|
-j jmeter_logs/logs/${{ matrix.scripts_type }}.log
|
|
- name: check logs
|
|
run: |
|
|
if cat jmeter_logs/${{ matrix.scripts_type }}.jtl | grep -e '<failure>true</failure>' > /dev/null 2>&1; then
|
|
echo "check logs failed"
|
|
exit 1
|
|
fi
|
|
- uses: actions/upload-artifact@89ef406dd8d7e03cfd12d9e0a4a378f454709029 # v4.3.5
|
|
if: always()
|
|
with:
|
|
name: jmeter_logs-built_in_database_authn_authz-${{ matrix.scripts_type }}
|
|
path: ./jmeter_logs
|
|
retention-days: 3
|