From 748b36800efd58658fdd294e731fb945c166b883 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 9 Apr 2024 08:44:00 +0200 Subject: [PATCH 01/15] PMM-13040: Matrix Job for the V3 --- .github/workflows/fb-e2e-suite.yml | 259 ++++++++++++++++++ .../workflows/runner-e2e-tests-codeceptjs.yml | 193 +++++++++++++ .../workflows/runner-e2e-tests-playwright.yml | 187 +++++++++++++ 3 files changed, 639 insertions(+) create mode 100644 .github/workflows/fb-e2e-suite.yml create mode 100644 .github/workflows/runner-e2e-tests-codeceptjs.yml create mode 100644 .github/workflows/runner-e2e-tests-playwright.yml diff --git a/.github/workflows/fb-e2e-suite.yml b/.github/workflows/fb-e2e-suite.yml new file mode 100644 index 00000000..3750508d --- /dev/null +++ b/.github/workflows/fb-e2e-suite.yml @@ -0,0 +1,259 @@ +name: _FB e2e tests + +on: + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'pmm-ui-tests repository branch(CLI tests)' + default: 'main' + required: false + type: string + pmm_qa_branch: + description: 'pmm-qa repository branch(for setup)' + default: 'main' + required: false + type: string + pmm_server_image: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:3-dev-latest' + required: true + type: string + pmm_client_image: + description: 'pmm2-client docker image' + default: 'perconalab/pmm-client:3-dev-latest' + required: false + type: string + pmm_client_version: + description: 'PMM Client version (dev-latest|pmm2-latest|pmm2-rc|x.xx.x|https...)' + default: 'dev-latest' + required: false + type: string + sha: + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + pmm_ui_tests_branch: + required: false + type: string + pmm_qa_branch: + required: false + type: string + pmm_server_image: + required: true + type: string + pmm_client_image: + required: false + type: string + pmm_client_version: + required: false + type: string + sha: + required: false + type: string + + secrets: + BACKUP_LOCATION_ACCESS_KEY: + required: false + BACKUP_LOCATION_SECRET_KEY: + required: false + +jobs: + backup_management_mongo: + name: Backup Management MongoDB UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + setup_services: '--mongo-replica-for-backup' + tags_for_tests: '@bm-mongo' + + # -- include backup_management_ps once setup for mysql fixed for the worker + # backup_management_ps: + # name: Backup Management PS UI tests + # uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + # secrets: inherit + # with: + # pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + # pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + # pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + # pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + # pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + # sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + # setup_services: '--mongo-replica-for-backup --setup-bm-mysql' + # tags_for_tests: '@bm-mysql' + + backup_management_common: + name: Backup Management Common and Locations UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--mongo-replica-for-backup --setup-bm-mysql' + # tags_for_tests: '@bm-common|@bm-locations' -- include bm-common once setup for mysql fixed + tags_for_tests: '@bm-locations' + + exporters: + name: Exporters tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--mongo-replica-for-backup' + tags_for_tests: '@mongodb-exporter|@exporters' + + instances: + name: Instances UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=haproxy,1 --addclient=ps,1 --setup-external-service' + tags_for_tests: '@instances-fb' + + alerting_and_settings: + name: Alerting and Settings UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=ms,1' + tags_for_tests: '@alerting-fb|@settings-fb' + + user_and_password: + name: User with changed password UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=ps,1 --addclient=modb,1 --addclient=pdpgsql,1' + tags_for_tests: '@user-password' + + pgsm: + name: PGSM UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--setup-pmm-pgsm-integration' + tags_for_tests: '@pgsm-pmm-integration' + + pgss: + name: PGSS UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--setup-pmm-pgss-integration' + tags_for_tests: '@pgss-pmm-integration' + + rbac: + name: RBAC UI tests + uses: ./.github/workflows/runner-e2e-tests-playwright.yml + secrets: inherit + with: + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main '}} + pmm_test_flag: '@rbac' + pmm_server_version: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + setup_services: '--addclient=ps,1' + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + + psmdb_arbiter: + name: PSMDB Arbiter Replica UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--mongomagic --with-arbiter' + tags_for_tests: '@pmm-psmdb-arbiter-integration' + + user_and_password_podman: + name: User with changed password UI tests + uses: ./.github/workflows/runner-e2e-tests-podman.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=ps,1 --addclient=modb,1 --addclient=pdpgsql,1' + tags_for_tests: '@user-password' + + dump_tool: + name: Dump Tool UI tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=ps,1' + tags_for_tests: '@dump' + + service_account: + name: Service Accounts tests + uses: ./.github/workflows/runner-e2e-tests-codeceptjs.yml + secrets: inherit + with: + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:3-dev-latest' }} + pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'https://s3.us-east-2.amazonaws.com/pmm-build-cache/PR-BUILDS/pmm-client/pmm-client-latest.tar.gz' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + setup_services: '--addclient=ps,1' + tags_for_tests: '@service-account' \ No newline at end of file diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml new file mode 100644 index 00000000..a884683d --- /dev/null +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -0,0 +1,193 @@ +name: _runner-e2e-tests +on: + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: "Branch for PMM-UI tests to checkout" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_server_image: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:dev-latest' + required: false + type: string + pmm_client_image: + description: 'pmm2-client docker image' + default: 'perconalab/pmm-client:dev-latest' + required: false + type: string + pmm_client_version: + description: 'PMM Client version (dev-latest|pmm2-latest|pmm2-rc|x.xx.x|https...)' + default: 'dev-latest' + required: false + type: string + setup_services: + description: "Setup arguments, ex.: --addclient=ps,1 --ps-version=5.7" + required: false + type: string + tags_for_tests: + description: "example: @settings-fb" + required: true + type: string + sha: + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + pmm_ui_tests_branch: + required: false + type: string + pmm_qa_branch: + required: false + type: string + pmm_server_image: + required: false + type: string + pmm_client_version: + required: false + type: string + pmm_client_image: + required: false + type: string + setup_services: + required: false + type: string + tags_for_tests: + required: true + type: string + sha: + required: false + type: string + +jobs: + ui-tests-e2e: + name: "e2e tests: ${{ inputs.tags_for_tests || '@settings-fb' }}" + # runs-on: ubuntu-latest Mongo Replica setup fails in ubuntu-latest for some reason. Additional investigation needed + runs-on: ubuntu-20.04 + timeout-minutes: 60 + env: + SHA: ${{ inputs.sha || 'null' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ADMIN_PASSWORD: 'admin-password' + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + PMM_UI_BRANCH: ${{ inputs.pmm_ui_tests_branch || 'main' }} + DOCKER_VERSION: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_DOCKER_VERSION: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + PMM_CLIENT_VERSION: ${{ inputs.pmm_client_version || 'dev-latest' }} + WIZARD_ARGS: ${{ inputs.setup_services || '' }} + TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }} + + # Environment variables for tests + BACKUP_LOCATION_ACCESS_KEY: ${{ secrets.BACKUP_LOCATION_ACCESS_KEY }} + BACKUP_LOCATION_SECRET_KEY: ${{ secrets.BACKUP_LOCATION_SECRET_KEY }} + + + steps: + - name: Create status check + if: ${{ github.event_name != 'pull_request' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: Checkout PMM UI tests + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_UI_BRANCH }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: Setup tools + run: | + sudo npm install -g bats + sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + sudo apt-get update + sudo apt-get install -y clickhouse-client + sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash + ls -la + git clone -b ${{ env.PMM_QA_BRANCH }} https://github.com/percona/pmm-qa + ls -la + pushd pmm-qa + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + popd + - name: Setup PMM2-Server + working-directory: ./pmm-ui-tests + run: | + PWD=$(pwd) PMM_SERVER_IMAGE=${{ env.DOCKER_VERSION }} docker-compose up -d + sleep 60 + docker exec pmm-server change-admin-password ${{ env.ADMIN_PASSWORD }} + bash -x testdata/db_setup.sh + - name: Export path to pmm-qa repo + working-directory: ./pmm-qa + run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV + + - name: Setup PMM2-Client + working-directory: ./pmm-qa + run: sudo bash -x pmm-tests/v3/pmm3-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + + - name: Run Setup for E2E Tests + working-directory: ./pmm-qa + run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.WIZARD_ARGS }} --pmm2 + + - name: Setup npm modules for e2e tests + working-directory: ./pmm-ui-tests + run: | + npm ci + envsubst < env.list > env.generated.list + - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} + working-directory: ./pmm-ui-tests + env: + SERVER_IP : "192.168.0.1" + PMM_UI_URL : "http://192.168.0.1/" + PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}" + run: | + sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js + ./node_modules/.bin/codeceptjs run -c pr.codecept.js --grep "${{ env.TAGS_FOR_TESTS }}" + - uses: actions/github-script@v7 + if: ${{ always() }} + id: artifact_name + with: + script: | + return `artifacts_for_${process.env.TAGS_FOR_TESTS.replaceAll('|', '')}` + result-encoding: string + + - uses: actions/upload-artifact@v4 + if: ${{ always() }} + with: + name: ${{ steps.artifact_name.outputs.result }} + path: | + pmm-ui-tests/tests/output/*.png + - name: Create status check + if: ${{ github.event_name != 'pull_request' && always() }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + +# - name: Setup tmate session on failure +# if: ${{ failure() }} +# uses: percona-platform/action-tmate@v2 \ No newline at end of file diff --git a/.github/workflows/runner-e2e-tests-playwright.yml b/.github/workflows/runner-e2e-tests-playwright.yml new file mode 100644 index 00000000..845a83aa --- /dev/null +++ b/.github/workflows/runner-e2e-tests-playwright.yml @@ -0,0 +1,187 @@ +--- +name: runner-e2e-tests-playwright + +on: + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: 'Target branch for pmm-ui-tests repository' + type: string + default: 'main' + required: true + pmm_test_flag: + description: 'Flag to run only specific portion of the tests.' + type: string + required: false + pmm_server_version: + description: 'Version of the pmm server used for testing' + type: string + default: 'dev-latest' + required: true + pmm_client_version: + description: 'Version of the pmm client used for testing' + type: string + default: 'dev-latest' + required: true + setup_services: + description: 'Clients for pmm-server' + type: string + default: '--addclient=ps,1' + required: true + pmm_qa_branch: + description: 'Branch for the pmm-qa repository.' + type: string + default: 'main' + required: true + + workflow_call: + inputs: + pmm_ui_tests_branch: + type: string + required: true + pmm_test_flag: + type: string + required: false + pmm_server_version: + type: string + required: true + pmm_client_version: + type: string + required: true + setup_services: + type: string + required: false + pmm_qa_branch: + type: string + required: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + timeout-minutes: 60 + env: + SHA: ${{ inputs.sha || 'null' }} + PMM_BASE_URL: https://127.0.0.1 + ADMIN_PASSWORD: admin + + UI_TESTS_BRANCH: ${{ inputs.pmm_ui_tests_branch }} + WIZARD_ARGS: ${{ inputs.setup_services }} + PMM_TEST_FLAG: ${{ inputs.pmm_test_flag }} + + PMM_SERVER_VERSION: ${{ inputs.pmm_server_version }} + PMM_CLIENT_VERSION: ${{ inputs.pmm_client_version }} + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch }} + + OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }} + OAUTH_ISSUER_URL: 'https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7' + OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }} + OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }} + OAUTH_PMM_CLIENT_ID: ${{ secrets.OAUTH_PMM_CLIENT_ID }} + OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OAUTH_PMM_CLIENT_SECRET }} + OAUTH_DEV_HOST: 'id-dev.percona.com' + OAUTH_SCOPES: percona + + # Variables for E2E tests + MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} + MAILOSAUR_UI_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_UI_TESTS_SERVER_ID }} + MAILOSAUR_API_TESTS_SERVER_ID: ${{ secrets.MAILOSAUR_API_TESTS_SERVER_ID }} + + SERVICENOW_LOGIN: percona_platform + SERVICENOW_PASSWORD: ${{ secrets.SERVICENOW_PASSWORD }} + SERVICENOW_DEV_URL: 'https://perconadev.service-now.com/api/x_pellc_percona_pl/platform/settest' + + steps: + - name: PMM server version ${{ inputs.pmm_server_version }} and UI tests for flag "${{ inputs.pmm_test_flag }}" and pmm-ui-tests branch ${{ inputs.pmm_ui_tests_branch }} + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.PMM_TEST_FLAG }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: 'Checkout UI tests: "${{ inputs.pmm_ui_tests_branch }}"' + uses: actions/checkout@v3 + with: + ref: ${{ inputs.pmm_ui_tests_branch }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: 'Install playwright' + working-directory: ./pmm-ui-tests/playwright-tests + run: | + npm ci + npx playwright install + - name: 'Checkout pmm-qa: "${{ inputs.pmm_qa_branch }}"' + uses: actions/checkout@v3 + with: + # token: ${{ secrets.ROBOT_TOKEN }} + repository: percona/pmm-qa + ref: ${{ inputs.pmm_qa_branch }} + path: ./pmm-qa + + - name: 'Setup : "${{ inputs.pmm_server_version }}"' + working-directory: pmm-qa/pmm-integration + run: | + npm install + sudo npx ts-node ./integration-setup.ts --ci --setup-docker-pmm-server --rbac --pmm-server-docker-tag=${{ env.PMM_SERVER_VERSION }} --pmm-client-version=${{ env.PMM_CLIENT_VERSION }} + timeout 100 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/ping)" != "200" ]]; do sleep 5; done' || false + - name: 'Setup ' + run: | + sudo bash ./pmm-qa/pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password admin --use_metrics_mode no + shell: bash + + - name: Setup Databases for the PMM-Server + working-directory: pmm-qa/pmm-integration + run: | + sudo npx ts-node ./integration-setup.ts --ci \ + ${{ env.WIZARD_ARGS }} + sleep 30 + sudo pmm-admin list + shell: bash + + - name: Execute UI tests + if: ${{ inputs.pmm_test_flag == 'null' }} + id: ui-tests-all + working-directory: pmm-ui-tests/playwright-tests + run: | + npx playwright test --project="chromium" --quiet + - name: 'Run UI tests: ${{ env.PMM_TEST_FLAG }}' + if: ${{ inputs.pmm_test_flag != 'null' }} + id: ui-tests-flagged + working-directory: pmm-ui-tests/playwright-tests + run: | + project="${{ contains(env.PMM_TEST_FLAG, 'portal') && 'Portal' || 'Chromium' }}" + npx playwright test --project=$project --grep ${{ env.PMM_TEST_FLAG }} --pass-with-no-tests + - name: 'Create report name' + if: failure() + run: | + # TODO: add job id for matrix call + job_tag=$(echo "${{ inputs.pmm_test_flag }}" | sed -e "s/-pre-upgrade//" -e "s/@//") + report_name="$job_tag"-report + echo $report_name + echo "REPORT_NAME=$report_name" >> $GITHUB_ENV + - name: Generate and Attach the report + if: failure() + uses: actions/upload-artifact@v3 + with: + name: ${{ env.REPORT_NAME }} + path: ./pmm-ui-tests/playwright-tests/playwright-report + + - name: Create status check + uses: percona/gh-action-github-status-action@v1 + if: ${{ env.SHA != 'null' && always() }} + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.PMM_TEST_FLAG }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} \ No newline at end of file From 97efac3e4f3ec430babee5e83580c300e77a0573 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 9 Apr 2024 08:53:15 +0200 Subject: [PATCH 02/15] PMM-13040: Setup PMM client V3 --- pmm-tests/v3/pmm3-client-setup.sh | 114 ++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 pmm-tests/v3/pmm3-client-setup.sh diff --git a/pmm-tests/v3/pmm3-client-setup.sh b/pmm-tests/v3/pmm3-client-setup.sh new file mode 100644 index 00000000..f101da51 --- /dev/null +++ b/pmm-tests/v3/pmm3-client-setup.sh @@ -0,0 +1,114 @@ +#!/bin/sh + +echo "start installing pmm-agent" + +while [ $# -gt 0 ]; do + + if [[ $1 == *"--"* ]]; then + param="${1/--/}" + declare $param="$2" + fi + + shift +done + +if [ -z "$admin_password" ]; then + export admin_password=admin +fi + +if [ -z "$pmm_server_ip" ]; then + export pmm_server_ip=127.0.0.1 +fi + +if [ -z "$client_version" ]; then + export client_version=dev-latest +fi + +if [ -z "$install_client" ]; then + export install_client=yes +fi + +if [ -z "$metrics_mode" ]; then + export metrics_mode=auto +fi + +if [ -z "$use_metrics_mode" ]; then + export use_metrics_mode=yes +fi + +apt-get update +apt-get install -y wget gnupg2 libtinfo-dev libnuma-dev mysql-client postgresql-client +wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb +dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb +apt-get update +export PMM_AGENT_SETUP_NODE_NAME=client_container_$(echo $((1 + $RANDOM % 9999))) +mv -v /artifacts/* . + +if [[ "$client_version" == "dev-latest" ]]; then + percona-release enable-only original experimental + apt-get update + apt-get -y install pmm2-client +fi + +if [[ "$client_version" == "pmm2-rc" ]]; then + percona-release enable-only original testing + apt-get update + apt-get -y install pmm2-client +fi + +if [[ "$client_version" == "pmm2-latest" ]]; then + apt-get -y install pmm2-client + apt-get -y update + percona-release enable-only original experimental +fi + +## only supported for debian based systems for now +if [[ "$client_version" == 2* && $(dpkg --list vim) ]]; then + curl -O https://raw.githubusercontent.com/Percona-QA/package-testing/master/scripts/pmm2_client_install_tarball.sh + bash -x pmm2_client_install_tarball.sh -v ${client_version} +fi + +if [[ "$client_version" == http* ]]; then + if [[ "$install_client" == "yes" ]]; then + wget -O pmm-client.tar.gz --progress=dot:giga "${client_version}" + fi + tar -zxpf pmm-client.tar.gz + rm -r pmm-client.tar.gz + export PMM2_CLIENT=`ls -1td pmm-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1` + echo ${PMM2_CLIENT} + mv ${PMM2_CLIENT} pmm-client + mv pmm-client /usr/local/bin + pushd /usr/local/bin/pmm-client + ## only setting up all binaries in default path /usr/local/percona/pmm2 + bash -x ./install_tarball + ## keep the pmm-admin & pmm-agent binaries in the /usr/local/bin path + export PMM_DIR=/usr/local + bash -x ./install_tarball + pwd + popd + pmm-admin --version + if [[ "$use_metrics_mode" == "yes" ]]; then + echo "install pmm-agent 1" + pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password} + else + echo "install pmm-agent 2" + pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password} + fi + sleep 10 + pmm-agent --config-file=/usr/local/config/pmm-agent.yaml > pmm-agent.log 2>&1 & +else + if [[ "$use_metrics_mode" == "yes" ]]; then + echo "install pmm-agent 3" + pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password} + else + echo "install pmm-agent 4" + pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password} + fi + sleep 10 + echo "install config-file" + pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 & +fi +sleep 10 + +echo "pmm-admin status" +pmm-admin status \ No newline at end of file From 1f7d8d5bd20f5480b0941e0a775fab8e0688fce5 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 08:44:52 +0200 Subject: [PATCH 03/15] PMM-13040: Podman Runner --- .github/workflows/runner-e2e-tests-podman.yml | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 .github/workflows/runner-e2e-tests-podman.yml diff --git a/.github/workflows/runner-e2e-tests-podman.yml b/.github/workflows/runner-e2e-tests-podman.yml new file mode 100644 index 00000000..195ba9e1 --- /dev/null +++ b/.github/workflows/runner-e2e-tests-podman.yml @@ -0,0 +1,264 @@ +name: runner-e2e-tests-podman +on: + workflow_dispatch: + inputs: + pmm_ui_tests_branch: + description: "Branch for PMM-UI tests to checkout" + required: false + type: string + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_server_image: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:dev-latest' + required: false + type: string + pmm_client_image: + description: 'pmm2-client docker image' + default: 'perconalab/pmm-client:dev-latest' + required: false + type: string + pmm_client_version: + description: 'PMM Client version (dev-latest|pmm2-latest|pmm2-rc|x.xx.x|https...)' + default: 'dev-latest' + required: false + type: string + setup_services: + description: "Setup arguments, ex.: --addclient=ps,1 --ps-version=5.7" + required: false + type: string + tags_for_tests: + description: "example: @settings-fb" + required: true + type: string + sha: + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + pmm_ui_tests_branch: + required: false + type: string + pmm_qa_branch: + required: false + type: string + pmm_server_image: + required: false + type: string + pmm_client_version: + required: false + type: string + pmm_client_image: + required: false + type: string + setup_services: + required: false + type: string + tags_for_tests: + required: true + type: string + sha: + required: false + type: string + +jobs: + ui-tests-e2e: + name: "podman e2e tests: ${{ inputs.tags_for_tests || '@settings-fb' }}" + # runs-on: ubuntu-latest Mongo Replica setup fails in ubuntu-latest for some reason. Additional investigation needed + runs-on: ubuntu-20.04 + timeout-minutes: 60 + env: + SHA: ${{ inputs.sha || 'null' }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + PMM_UI_TESTS_BRANCH: ${{ inputs.pmm_ui_tests_branch || 'main' }} + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + DOCKER_VERSION: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + CLIENT_DOCKER_VERSION: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + CLIENT_IMAGE: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + CLIENT_VERSION: ${{ inputs.pmm_client_version || 'dev-latest' }} + WIZARD_ARGS: ${{ inputs.setup_services || '' }} + TAGS_FOR_TESTS: ${{ inputs.tags_for_tests || '@settings-fb' }} + ADMIN_PASSWORD: 'admin-password' + + # Environment variables for tests + BACKUP_LOCATION_ACCESS_KEY: ${{ secrets.BACKUP_LOCATION_ACCESS_KEY }} + BACKUP_LOCATION_SECRET_KEY: ${{ secrets.BACKUP_LOCATION_SECRET_KEY }} + + steps: + - name: Create status check + if: ${{ github.event_name != 'pull_request' }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: "pending" + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + + - name: "Checkout PMM UI tests: ${{ env.PMM_UI_TESTS_BRANCH }}" + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_UI_TESTS_BRANCH }} + repository: percona/pmm-ui-tests + path: ./pmm-ui-tests + + - name: "Checkout PMM QA: ${{ env.PMM_QA_BRANCH }}" + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_QA_BRANCH }} + repository: percona/pmm-qa + path: ./pmm-qa + + - name: Setup tools + run: | + npm install -g bats + sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench + sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 + echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ + /etc/apt/sources.list.d/clickhouse.list + . /etc/os-release + echo "deb https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/ /" | sudo tee \ + /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list + curl -L "https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/xUbuntu_${VERSION_ID}/Release.key" | sudo apt-key add - + sudo apt-get update + sudo apt-get -y upgrade + sudo apt-get install -y + sudo apt-get install -y clickhouse-client podman + sudo curl -s https://raw.githubusercontent.com/datacharmer/dbdeployer/master/scripts/dbdeployer-install.sh | bash + ls -la + pushd ./pmm-qa + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + popd + sudo sysctl net.ipv4.ip_unprivileged_port_start=80 + + - name: Setup PMM2-Server + working-directory: ./pmm-ui-tests + run: | + mkdir -p ~/.config/systemd/user/ + cat > ~/.config/systemd/user/pmm-server.service < ~/.config/pmm-server/pmm-server.env <> $GITHUB_ENV + + - name: Setup PMM2-Client + working-directory: ./pmm-qa + run: sudo bash -x pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + + - name: Run Setup for E2E Tests + working-directory: ./pmm-qa + run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.WIZARD_ARGS }} --pmm2 + + - name: Setup npm modules for e2e tests + working-directory: ./pmm-ui-tests + run: | + npm ci + envsubst < env.list > env.generated.list + + - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} + working-directory: ./pmm-ui-tests + env: + SERVER_IP : "127.0.0.1" + PMM_UI_URL : "http://127.0.0.1/" + PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}" + run: | + sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js + ./node_modules/.bin/codeceptjs run -c pr.codecept.js --grep "${{ env.TAGS_FOR_TESTS }}" + + - uses: actions/github-script@v7 + if: ${{ always() }} + id: artifact_name + with: + script: | + return `artifacts_for_${process.env.TAGS_FOR_TESTS.replaceAll('|', '')}` + result-encoding: string + + - name: Create status check + if: ${{ github.event_name != 'pull_request' && always() }} + uses: percona/gh-action-github-status-action@v1 + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ env.TAGS_FOR_TESTS }} UI tests" + description: "Test execution ${{ job.status }}" + state: ${{ job.status }} + repository: ${{ github.repository }} + target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" + sha: ${{ env.SHA }} + +# - name: Setup tmate session on failure +# if: ${{ failure() }} +# uses: percona-platform/action-tmate@v2 From ca098e396d9211a43182833deca9df6ce2ffe418 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 08:47:18 +0200 Subject: [PATCH 04/15] PMM-13040: Remove Bats install --- .github/workflows/runner-e2e-tests-podman.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/runner-e2e-tests-podman.yml b/.github/workflows/runner-e2e-tests-podman.yml index 195ba9e1..30f0223f 100644 --- a/.github/workflows/runner-e2e-tests-podman.yml +++ b/.github/workflows/runner-e2e-tests-podman.yml @@ -119,7 +119,6 @@ jobs: - name: Setup tools run: | - npm install -g bats sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ From 1b1211a358fd714254a010bde3880430e2fc4129 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 09:53:27 +0200 Subject: [PATCH 05/15] PMM-13040: Start pmm server --- .../workflows/runner-e2e-tests-codeceptjs.yml | 24 +++++++++++++++---- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index a884683d..18476c93 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -128,13 +128,27 @@ jobs: wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh chmod +x get_download_link.sh popd - - name: Setup PMM2-Server + + - name: Setup PMM3-Server working-directory: ./pmm-ui-tests run: | - PWD=$(pwd) PMM_SERVER_IMAGE=${{ env.DOCKER_VERSION }} docker-compose up -d - sleep 60 - docker exec pmm-server change-admin-password ${{ env.ADMIN_PASSWORD }} - bash -x testdata/db_setup.sh + docker network create pmm-qa || true + docker volume create pmm-data + + docker run -d \ + -p 80:8080 \ + -p 443:8443 \ + -p 9000:9000 \ + --volume pmm-data:/srv \ + --name pmm-server \ + --hostname pmm-server \ + --network pmm-qa \ + --restart always \ + ${{ env.DOCKER_VERSION } + + sleep 30 + docker logs pmm-server + - name: Export path to pmm-qa repo working-directory: ./pmm-qa run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV From 99527326e38a33ab0702ddfe395cb94724f545c1 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 13:57:29 +0200 Subject: [PATCH 06/15] PMM-13040: Start pmm server --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 18476c93..e03937a7 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -134,7 +134,6 @@ jobs: run: | docker network create pmm-qa || true docker volume create pmm-data - docker run -d \ -p 80:8080 \ -p 443:8443 \ @@ -145,7 +144,6 @@ jobs: --network pmm-qa \ --restart always \ ${{ env.DOCKER_VERSION } - sleep 30 docker logs pmm-server From 68863d077b7c946528852433c182e203be3ab322 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 14:00:19 +0200 Subject: [PATCH 07/15] PMM-13040: Fixes typo --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index e03937a7..4143c38f 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -143,7 +143,7 @@ jobs: --hostname pmm-server \ --network pmm-qa \ --restart always \ - ${{ env.DOCKER_VERSION } + ${{ env.DOCKER_VERSION }} sleep 30 docker logs pmm-server From 39e60addf9613caf93ea4d20005414f7efce906c Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 14:19:56 +0200 Subject: [PATCH 08/15] PMM-13040: Changes pmm server address for container --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 4143c38f..940bf976 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -153,7 +153,7 @@ jobs: - name: Setup PMM2-Client working-directory: ./pmm-qa - run: sudo bash -x pmm-tests/v3/pmm3-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + run: sudo bash -x pmm-tests/v3/pmm3-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no - name: Run Setup for E2E Tests working-directory: ./pmm-qa From d4d97d0d100ccbb7d89239041df2130aac4c1077 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 14:23:22 +0200 Subject: [PATCH 09/15] PMM-13040: Fix admin password --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 940bf976..147a1529 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -75,7 +75,7 @@ jobs: env: SHA: ${{ inputs.sha || 'null' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ADMIN_PASSWORD: 'admin-password' + ADMIN_PASSWORD: 'admin' PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} PMM_UI_BRANCH: ${{ inputs.pmm_ui_tests_branch || 'main' }} From 841645494d1e8645f30924bba304ed13177fcd8f Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Mon, 22 Apr 2024 14:32:44 +0200 Subject: [PATCH 10/15] PMM-13040: Fix pmm server address --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 147a1529..2da5b049 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -167,8 +167,8 @@ jobs: - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} working-directory: ./pmm-ui-tests env: - SERVER_IP : "192.168.0.1" - PMM_UI_URL : "http://192.168.0.1/" + SERVER_IP : "127.0.0.1" + PMM_UI_URL : "http://127.0.0.1/" PMM_URL : "http://admin:${{ env.ADMIN_PASSWORD }}@${{ env.SERVER_IP }}" run: | sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js From 37113c55031650d0e6134c61712690652c79f311 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Fri, 26 Apr 2024 09:56:10 +0200 Subject: [PATCH 11/15] PMM-13040: Install bats as sudo --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index e57dbd47..69d66956 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -113,7 +113,7 @@ jobs: - name: Setup tools run: | - npm install -g bats + sudo npm install -g bats sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754 echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \ From 49e72f396d2a48c4872926ede7de28fae9d030cf Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Fri, 26 Apr 2024 10:09:28 +0200 Subject: [PATCH 12/15] PMM-13040: Fixes for pmm 3 setup --- .github/workflows/runner-e2e-tests-codeceptjs.yml | 2 +- pmm-tests/v3/pmm3-client-setup.sh | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 69d66956..ca66ffae 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -151,7 +151,7 @@ jobs: working-directory: ./pmm-qa run: echo "PATH_TO_PMM_QA=$(pwd)" >> $GITHUB_ENV - - name: Setup PMM2-Client + - name: Setup PMM3-Client working-directory: ./pmm-qa run: sudo bash -x pmm-tests/v3/pmm3-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.PMM_CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no diff --git a/pmm-tests/v3/pmm3-client-setup.sh b/pmm-tests/v3/pmm3-client-setup.sh index f101da51..6c82e6ea 100644 --- a/pmm-tests/v3/pmm3-client-setup.sh +++ b/pmm-tests/v3/pmm3-client-setup.sh @@ -47,17 +47,17 @@ mv -v /artifacts/* . if [[ "$client_version" == "dev-latest" ]]; then percona-release enable-only original experimental apt-get update - apt-get -y install pmm2-client + apt-get -y install pmm-client fi -if [[ "$client_version" == "pmm2-rc" ]]; then +if [[ "$client_version" == "pmm3-rc" ]]; then percona-release enable-only original testing apt-get update - apt-get -y install pmm2-client + apt-get -y install pmm-client fi -if [[ "$client_version" == "pmm2-latest" ]]; then - apt-get -y install pmm2-client +if [[ "$client_version" == "pmm3-latest" ]]; then + apt-get -y install pmm-client apt-get -y update percona-release enable-only original experimental fi From 30e6a143ab57d5b487498fa967455f22f0fdafa6 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Fri, 3 May 2024 09:41:24 +0200 Subject: [PATCH 13/15] PMM-13040: adds version of ps --- .github/workflows/fb-e2e-suite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/fb-e2e-suite.yml b/.github/workflows/fb-e2e-suite.yml index eb1e4de4..3a62bf13 100644 --- a/.github/workflows/fb-e2e-suite.yml +++ b/.github/workflows/fb-e2e-suite.yml @@ -255,5 +255,5 @@ jobs: pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} - setup_services: '--addclient=ps,1' + setup_services: '--database ps=8.0' tags_for_tests: '@service-account' From 167059c8da802b018fe9c84bd201348325275841 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 7 May 2024 11:10:52 +0200 Subject: [PATCH 14/15] PMM-13040: Removes client setup --- pmm-tests/v3/pmm3-client-setup.sh | 114 ------------------------------ 1 file changed, 114 deletions(-) delete mode 100644 pmm-tests/v3/pmm3-client-setup.sh diff --git a/pmm-tests/v3/pmm3-client-setup.sh b/pmm-tests/v3/pmm3-client-setup.sh deleted file mode 100644 index 6c82e6ea..00000000 --- a/pmm-tests/v3/pmm3-client-setup.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/sh - -echo "start installing pmm-agent" - -while [ $# -gt 0 ]; do - - if [[ $1 == *"--"* ]]; then - param="${1/--/}" - declare $param="$2" - fi - - shift -done - -if [ -z "$admin_password" ]; then - export admin_password=admin -fi - -if [ -z "$pmm_server_ip" ]; then - export pmm_server_ip=127.0.0.1 -fi - -if [ -z "$client_version" ]; then - export client_version=dev-latest -fi - -if [ -z "$install_client" ]; then - export install_client=yes -fi - -if [ -z "$metrics_mode" ]; then - export metrics_mode=auto -fi - -if [ -z "$use_metrics_mode" ]; then - export use_metrics_mode=yes -fi - -apt-get update -apt-get install -y wget gnupg2 libtinfo-dev libnuma-dev mysql-client postgresql-client -wget https://repo.percona.com/apt/percona-release_latest.$(lsb_release -sc)_all.deb -dpkg -i percona-release_latest.$(lsb_release -sc)_all.deb -apt-get update -export PMM_AGENT_SETUP_NODE_NAME=client_container_$(echo $((1 + $RANDOM % 9999))) -mv -v /artifacts/* . - -if [[ "$client_version" == "dev-latest" ]]; then - percona-release enable-only original experimental - apt-get update - apt-get -y install pmm-client -fi - -if [[ "$client_version" == "pmm3-rc" ]]; then - percona-release enable-only original testing - apt-get update - apt-get -y install pmm-client -fi - -if [[ "$client_version" == "pmm3-latest" ]]; then - apt-get -y install pmm-client - apt-get -y update - percona-release enable-only original experimental -fi - -## only supported for debian based systems for now -if [[ "$client_version" == 2* && $(dpkg --list vim) ]]; then - curl -O https://raw.githubusercontent.com/Percona-QA/package-testing/master/scripts/pmm2_client_install_tarball.sh - bash -x pmm2_client_install_tarball.sh -v ${client_version} -fi - -if [[ "$client_version" == http* ]]; then - if [[ "$install_client" == "yes" ]]; then - wget -O pmm-client.tar.gz --progress=dot:giga "${client_version}" - fi - tar -zxpf pmm-client.tar.gz - rm -r pmm-client.tar.gz - export PMM2_CLIENT=`ls -1td pmm-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1` - echo ${PMM2_CLIENT} - mv ${PMM2_CLIENT} pmm-client - mv pmm-client /usr/local/bin - pushd /usr/local/bin/pmm-client - ## only setting up all binaries in default path /usr/local/percona/pmm2 - bash -x ./install_tarball - ## keep the pmm-admin & pmm-agent binaries in the /usr/local/bin path - export PMM_DIR=/usr/local - bash -x ./install_tarball - pwd - popd - pmm-admin --version - if [[ "$use_metrics_mode" == "yes" ]]; then - echo "install pmm-agent 1" - pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password} - else - echo "install pmm-agent 2" - pmm-agent setup --config-file=/usr/local/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password} - fi - sleep 10 - pmm-agent --config-file=/usr/local/config/pmm-agent.yaml > pmm-agent.log 2>&1 & -else - if [[ "$use_metrics_mode" == "yes" ]]; then - echo "install pmm-agent 3" - pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --metrics-mode=${metrics_mode} --server-username=admin --server-password=${admin_password} - else - echo "install pmm-agent 4" - pmm-agent setup --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml --server-address=${pmm_server_ip}:443 --server-insecure-tls --server-username=admin --server-password=${admin_password} - fi - sleep 10 - echo "install config-file" - pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 & -fi -sleep 10 - -echo "pmm-admin status" -pmm-admin status \ No newline at end of file From 9a5ca7b50566a2e878fde6493603a41a9b2f88e3 Mon Sep 17 00:00:00 2001 From: Peter Sirotnak Date: Tue, 14 May 2024 08:32:29 +0200 Subject: [PATCH 15/15] PMM-13040: Changes from PR --- .github/workflows/fb-e2e-suite.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/fb-e2e-suite.yml b/.github/workflows/fb-e2e-suite.yml index 467203a3..8c04c891 100644 --- a/.github/workflows/fb-e2e-suite.yml +++ b/.github/workflows/fb-e2e-suite.yml @@ -253,10 +253,10 @@ jobs: secrets: inherit with: pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:3-dev-latest' }} - pmm_client_version: ${{ inputs.pmm_client_version || 'dev-latest' }} - pmm_client_image: ${{ inputs.pmm_client_image || 'https://s3.us-east-2.amazonaws.com/pmm-build-cache/PR-BUILDS/pmm-client/pmm-client-latest.tar.gz' }} - pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} - pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_client_version: ${{ inputs.pmm_client_version || '3-dev-latest' }} + pmm_client_image: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:3-dev-latest' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'v3' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'v3' }} sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} setup_services: '--database ps=8.0' tags_for_tests: '@service-account'