diff --git a/.ci/docker-compose-file/docker-compose-pgsql-tls.yaml b/.ci/docker-compose-file/docker-compose-pgsql-tls.yaml index 29d520e29..d2eaaaf07 100644 --- a/.ci/docker-compose-file/docker-compose-pgsql-tls.yaml +++ b/.ci/docker-compose-file/docker-compose-pgsql-tls.yaml @@ -28,7 +28,7 @@ services: - ssl_ca_file=/var/lib/postgresql/root.crt - -c - hba_file=/var/lib/postgresql/pg_hba.conf - - -c - - ssl_min_protocol_version=TLSv1.2 +# - -c +# - ssl_min_protocol_version=TLSv1.2 networks: - emqx_bridge diff --git a/.github/workflows/run_broker_tests.yaml b/.github/workflows/run_broker_tests.yaml index 1e47dd396..6b88f4cc1 100644 --- a/.github/workflows/run_broker_tests.yaml +++ b/.github/workflows/run_broker_tests.yaml @@ -5,7 +5,7 @@ on: branches: - '**' tags: - - v* +# - v* pull_request: jobs: @@ -39,14 +39,18 @@ jobs: with: name: emqx.tar path: ./emqx.tar - mqtt_subscription: + + advanced_feat: runs-on: ubuntu-latest strategy: fail-fast: false matrix: - subscription_type: + scripts_type: - mqtt_subscription_topic_metrics + - mqtt_delayed_publish + - mqtt_topic_rewrite + - mqtt_retainer needs: build steps: @@ -101,19 +105,19 @@ jobs: 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-2.0.2-jar-with-dependencies.jar https://raw.githubusercontent.com/xmeter-net/mqtt-jmeter/master/Download/v2.0.2/mqtt-xmeter-2.0.2-jar-with-dependencies.jar + 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: run jmeter run: | /opt/jmeter/bin/jmeter.sh \ -Jjmeter.save.saveservice.output_format=xml -n \ - -t scripts/broker-autotest-suite/${{ matrix.subscription_type }}.jmx \ + -t scripts/broker-autotest-suite/${{ matrix.scripts_type }}.jmx \ -Demqx_ip=$HAPROXY_IP \ - -l jmeter_logs/${{ matrix.subscription_type }}.jtl \ - -j jmeter_logs/logs/${{ matrix.subscription_type }}.log + -l jmeter_logs/${{ matrix.scripts_type }}.jtl \ + -j jmeter_logs/logs/${{ matrix.scripts_type }}.log - name: check logs run: | - if cat jmeter_logs/${{ matrix.subscription_type }}}.jtl | grep -e 'true' > /dev/null 2>&1; then + if cat jmeter_logs/${{ matrix.scripts_type }}.jtl | grep -e 'true' > /dev/null 2>&1; then echo "check logs filed" exit 1 fi @@ -122,3 +126,396 @@ jobs: with: name: jmeter_logs path: ./jmeter_logs + + pgslq_authn_authz: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + pgsql_tag: + - 9 + - 10 + - 11 + - 12 + - 13 + scripts_type: + - pgsql_authn + - pgsql_authz + + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: emqx.tar + path: /tmp + - name: load docker image + run: | + docker load < /tmp/emqx.tar + - name: docker compose up + timeout-minutes: 5 + env: + _EMQX_DOCKER_IMAGE_TAG: emqx/emqx:${{ needs.build.outputs.version }} + 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 -d --build + - name: wait docker compose up + timeout-minutes: 5 + run: | + while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do + echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx"; + sleep 5; + done + while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \ + != $(docker ps -a --filter name=client | wc -l) ]; do + sleep 1 + done + docker ps -a + 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 + - uses: actions/checkout@v2 + with: + repository: emqx/emqx-fvt + ref: broker-autotest + path: scripts + - 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 + - uses: actions/download-artifact@v2 + with: + name: apache-jmeter.tgz + path: /tmp + - name: install jmeter + timeout-minutes: 10 + env: + JMETER_VERSION: 5.3 + run: | + 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 + wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/lib/postgresql-42.2.18.jar https://repo1.maven.org/maven2/org/postgresql/postgresql/42.2.18/postgresql-42.2.18.jar + ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter + - name: run jmeter + run: | + /opt/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_authn/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 'true' > /dev/null 2>&1; then + echo "check logs filed" + exit 1 + fi + - uses: actions/upload-artifact@v1 + if: always() + with: + name: jmeter_logs + path: ./jmeter_logs + + mysql_authn_authz: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + mysql_tag: + - 5.7 + - 8 + scripts_type: + - mysql_authn + - mysql_authz + + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: emqx.tar + path: /tmp + - name: load docker image + run: | + docker load < /tmp/emqx.tar + - name: docker compose up + timeout-minutes: 5 + env: + _EMQX_DOCKER_IMAGE_TAG: emqx/emqx:${{ needs.build.outputs.version }} + 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 -d --build + - name: wait docker compose up + timeout-minutes: 5 + run: | + while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do + echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx"; + sleep 5; + done + while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \ + != $(docker ps -a --filter name=client | wc -l) ]; do + sleep 1 + done + docker ps -a + 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 + - uses: actions/checkout@v2 + with: + repository: emqx/emqx-fvt + ref: broker-autotest + path: scripts + - 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 + - uses: actions/download-artifact@v2 + with: + name: apache-jmeter.tgz + path: /tmp + - name: install jmeter + timeout-minutes: 10 + env: + JMETER_VERSION: 5.3 + run: | + 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 + wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/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 + ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter + - name: run jmeter + run: | + /opt/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_authn/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 'true' > /dev/null 2>&1; then + echo "check logs filed" + exit 1 + fi + - uses: actions/upload-artifact@v1 + if: always() + with: + name: jmeter_logs + path: ./jmeter_logs + + JWT_authn: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + scripts_type: + - jwt_authn + + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: emqx.tar + path: /tmp + - name: load docker image + run: | + docker load < /tmp/emqx.tar + - name: docker compose up + timeout-minutes: 5 + env: + _EMQX_DOCKER_IMAGE_TAG: emqx/emqx:${{ needs.build.outputs.version }} + run: | + docker-compose \ + -f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \ + up -d --build + - name: wait docker compose up + timeout-minutes: 5 + run: | + while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do + echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx"; + sleep 5; + done + while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \ + != $(docker ps -a --filter name=client | wc -l) ]; do + sleep 1 + done + docker ps -a + echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV + - uses: actions/checkout@v2 + with: + repository: emqx/emqx-fvt + ref: broker-autotest + path: scripts + - 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 openjdk:8-jdk bash \ + -c "java -jar jwkserver-0.0.1.jar" + - 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 + - uses: actions/download-artifact@v2 + with: + name: apache-jmeter.tgz + path: /tmp + - name: install jmeter + timeout-minutes: 10 + env: + JMETER_VERSION: 5.3 + run: | + 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: run jmeter + run: | + /opt/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 'true' > /dev/null 2>&1; then + echo "check logs filed" + exit 1 + fi + - uses: actions/upload-artifact@v1 + if: always() + with: + name: jmeter_logs + path: ./jmeter_logs + + built_in_database_authn_authz: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + scripts_type: + - built_in_database_authn + - built_in_database_authz + + needs: build + steps: + - uses: actions/checkout@v2 + - uses: actions/download-artifact@v2 + with: + name: emqx.tar + path: /tmp + - name: load docker image + run: | + docker load < /tmp/emqx.tar + - name: docker compose up + timeout-minutes: 5 + env: + _EMQX_DOCKER_IMAGE_TAG: emqx/emqx:${{ needs.build.outputs.version }} + PGSQL_TAG: ${{ matrix.mysql_tag }} + run: | + docker-compose \ + -f .ci/docker-compose-file/docker-compose-emqx-cluster.yaml \ + up -d --build + - name: wait docker compose up + timeout-minutes: 5 + run: | + while [ "$(docker inspect -f '{{ .State.Health.Status}}' node1.emqx.io)" != "healthy" ] || [ "$(docker inspect -f '{{ .State.Health.Status}}' node2.emqx.io)" != "healthy" ]; do + echo "['$(date -u +"%y-%m-%dt%h:%m:%sz")']:waiting emqx"; + sleep 5; + done + while [ $(docker ps -a --filter name=client --filter exited=0 | wc -l) \ + != $(docker ps -a --filter name=client | wc -l) ]; do + sleep 1 + done + docker ps -a + echo HAPROXY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' haproxy) >> $GITHUB_ENV + - uses: actions/checkout@v2 + with: + repository: emqx/emqx-fvt + ref: broker-autotest + path: scripts + - 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 + - uses: actions/download-artifact@v2 + with: + name: apache-jmeter.tgz + path: /tmp + - name: install jmeter + timeout-minutes: 10 + env: + JMETER_VERSION: 5.3 + run: | + 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 + wget --no-verbose -O /tmp/apache-jmeter-$JMETER_VERSION/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 + ln -s /tmp/apache-jmeter-$JMETER_VERSION /opt/jmeter + - name: run jmeter + run: | + /opt/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 }}_${{ 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 'true' > /dev/null 2>&1; then + echo "check logs filed" + exit 1 + fi + - uses: actions/upload-artifact@v1 + if: always() + with: + name: jmeter_logs + path: ./jmeter_logs + + delete-artifact: + runs-on: ubuntu-latest + needs: [advanced_feat,pgslq_authn_authz,JWT_authn,mysql_authn_authz,built_in_database_authn_authz] + steps: + - uses: geekyeggo/delete-artifact@v1 + with: + name: emqx.tar \ No newline at end of file