diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 376845c7..c193df30 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -18,7 +18,7 @@ on: default: 'perconalab/pmm-server:dev-latest' required: true pmm_client_version: - description: 'PMM Client version to test (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' + description: 'PMM Client version (dev-latest|pmm2-latest|pmm2-rc|x.xx.x|https...)' default: 'dev-latest' required: true @@ -32,7 +32,7 @@ jobs: pmm_test_flag: '@rbac' pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} - pmm_clients: '--addclient=ps,1 --addclient=pdpgsql,1' + setup_services: '--addclient=ps,1 --addclient=pdpgsql,1' pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} portal: @@ -44,7 +44,7 @@ jobs: pmm_test_flag: '@portal' pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} - pmm_clients: '' + setup_services: '' pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} inventory: @@ -56,5 +56,5 @@ jobs: pmm_test_flag: '@inventory' pmm_server_version: ${{ github.event.inputs.pmm_server_version || 'perconalab/pmm-server:dev-latest' }} pmm_client_version: ${{ github.event.inputs.pmm_client_version || 'dev-latest' }} - pmm_clients: '--addclient=modb,1 --addclient=ps,1 --addclient=pdpgsql,1' + setup_services: '--addclient=modb,1 --addclient=ps,1 --addclient=pdpgsql,1' pmm_qa_branch: ${{ github.event.inputs.pmm_qa_branch || 'main' }} diff --git a/.github/workflows/fb-e2e-suite.yml b/.github/workflows/fb-e2e-suite.yml new file mode 100644 index 00000000..082e0f7c --- /dev/null +++ b/.github/workflows/fb-e2e-suite.yml @@ -0,0 +1,273 @@ +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:dev-latest' + required: true + 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 + 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' + + psmdb_replica: + name: PSMDB 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: '--mongo-replica-for-backup' + tags_for_tests: '@pmm-psmdb-replica-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' + + ps_integration: + name: PS UI integration 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 --query-source=slowlog' + tags_for_tests: '(?=.*@pmm-ps-integration)^(?!.*@not-ui-pipeline)' diff --git a/.github/workflows/fb-integration-suite.yml b/.github/workflows/fb-integration-suite.yml new file mode 100644 index 00000000..00267b43 --- /dev/null +++ b/.github/workflows/fb-integration-suite.yml @@ -0,0 +1,69 @@ +name: _FB integration CLI 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: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 + 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: true + type: string + pmm_client_version: + required: true + type: string + sha: + required: false + type: string + +jobs: + help-tests: + name: 'Integration tests' + uses: ./.github/workflows/integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} diff --git a/.github/workflows/fb-tarball-suite.yml b/.github/workflows/fb-tarball-suite.yml new file mode 100644 index 00000000..c250d50c --- /dev/null +++ b/.github/workflows/fb-tarball-suite.yml @@ -0,0 +1,77 @@ +name: _FB tarball tests + +on: + workflow_dispatch: + inputs: + package_testing_branch: + description: 'Target branch for package-testing repository' + type: string + default: 'master' + required: true + pmm_server_image: + description: "pmm-server docker image" + required: true + type: string + default: "perconalab/pmm-server:dev-latest" + pmm_client_tarball: + description: "PMM Client tarball link or FB-code" + default: 'dev-latest' + type: string + required: true + metrics_mode: + description: 'Select the Metrics Mode for PMM Client:' + required: true + default: 'auto' + type: choice + options: + - auto + - push + - pull + sha: + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + package_testing_branch: + type: string + required: false + pmm_server_image: + required: true + type: string + pmm_client_tarball: + type: string + required: true + metrics_mode: + type: string + required: false + sha: + required: false + type: string + +jobs: + tarball_install: + name: Tarball Install test + uses: ./.github/workflows/package-test-fb.yml + secrets: inherit + with: + package_testing_branch: 'master' + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_tarball: ${{ inputs.pmm_client_tarball || 'dev-latest' }} + playbook: 'pmm2-client_integration_custom_port' + test_name: 'tarball install' + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + + tarball_upgrade: + name: Tarball Upgrade test + uses: ./.github/workflows/package-test-fb.yml + secrets: inherit + with: + package_testing_branch: 'master' + pmm_server_image: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + pmm_client_tarball: ${{ inputs.pmm_client_tarball || 'dev-latest' }} + playbook: 'pmm2-client_integration_upgrade_custom_path' + test_name: 'tarball upgrade' + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} \ No newline at end of file diff --git a/.github/workflows/helm-tests.yml b/.github/workflows/helm-tests.yml new file mode 100644 index 00000000..360145de --- /dev/null +++ b/.github/workflows/helm-tests.yml @@ -0,0 +1,112 @@ +on: + workflow_dispatch: + inputs: + server_image: + description: "server image: repo/name:tag" + required: true + type: string + client_image: + description: "client image: repo/name:tag" + required: true + type: string + pmm_qa_branch: + description: "Branch for pmm-qa repo to checkout" + required: false + type: string + sha: + description: "commit sha to report status" + required: false + type: string + + workflow_call: + inputs: + server_image: + required: true + type: string + client_image: + required: true + type: string + pmm_qa_branch: + required: false + type: string + sha: + required: false + type: string + + +jobs: + helm-tests: + runs-on: ubuntu-22.04 + timeout-minutes: 30 + env: + SHA: ${{ inputs.sha || 'null' }} + WORK_DIR: ./pmm-qa/pmm-tests/pmm-2-0-bats-tests + GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }} + PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} + SERVER_IMAGE: ${{ inputs.pmm_server_image || 'perconalab/pmm-server:dev-latest' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_QA_BRANCH }} + repository: percona/pmm-qa + path: ./pmm-qa + + - name: Set up bats globally + run: | + git clone https://github.com/bats-core/bats-core.git /opt/bats + sudo /opt/bats/install.sh /usr/local + + - name: Set up bats libraries + working-directory: ${{ env.WORK_DIR }} + run: | + ./setup_bats_libs.sh + echo "BATS_LIB_PATH=$(pwd)/lib" >> $GITHUB_ENV + + - name: Start minikube + run: | + minikube start + minikube addons disable storage-provisioner + + ### Install CSI drivers for snapshots + kubectl delete storageclass standard + minikube addons enable csi-hostpath-driver + minikube addons enable volumesnapshots + kubectl patch storageclass csi-hostpath-sc -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}' + kubectl wait --for=condition=Ready node --timeout=90s minikube + + - name: Run helm tests + working-directory: ${{ env.WORK_DIR }}/k8s + env: + SERVER_IMAGE: ${{ inputs.server_image }} + run: | + echo $(git submodule status) + + export IMAGE_REPO=$(echo $SERVER_IMAGE | cut -d ':' -f 1) + export IMAGE_TAG=$(echo $SERVER_IMAGE | cut -d ':' -f 2) + bats --tap helm-test.bats + + - name: Create status check + if: ${{ always() && inputs.sha }} + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPO: ${{ github.repository }} + RUN_ID: ${{ github.run_id }} + SHA: ${{ inputs.sha }} + STATUS: ${{ job.status }} + run: | + if [ "${STATUS}" = "cancelled" ]; then + STATUS="error" + fi + + gh api \ + --method POST \ + -H "Accept: application/vnd.github.v3+json" \ + /repos/$REPO/statuses/$SHA \ + -f state="$STATUS" \ + -f target_url="https://github.com/$REPO/actions/runs/$RUN_ID" \ + -f description="Helm Tests status: $STATUS" \ + -f context='actions/workflows/helm-tests' + diff --git a/.github/workflows/integration-cli-tests.yml b/.github/workflows/integration-cli-tests.yml new file mode 100644 index 00000000..7d255b52 --- /dev/null +++ b/.github/workflows/integration-cli-tests.yml @@ -0,0 +1,372 @@ +name: PMM Integration 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: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 + 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: true + type: string + pmm_client_version: + required: true + type: string + sha: + required: false + type: string + +jobs: + help-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/help.spec.ts' + test_name: 'help tests' + + pmm-server-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-server-only' + test_name: 'pmm-server container' + + pmm-client-container-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-client-docker' + services_list: '--setup-pmm-client-docker' + test_name: 'pmm-client docker' + + generic-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'generic unregister' + test_name: 'Generic' + + remove-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/remove.spec.ts' + services_list: '--pxc-version=5.7 --addclient=pxc,1' + test_name: 'Remove' + + ps-57-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/perconaMySqlServer.spec.ts' + services_list: '--ps-version=5.7 --addclient=ps,1' + test_name: 'Percona Server 5.7' + + ps-80-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/perconaMySqlServer.spec.ts' + services_list: '--ps-version=8.0 --addclient=ps,1' + test_name: 'Percona Server 8.0' + + mysql-80-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/mysql.spec.ts pmm-ui-tests/cli/tests/mysql-conf-file.spec.ts' + services_list: '--ms-version=8.0 --addclient=ms,1' + test_name: 'MySQL 8.0' + + pdpgsql-13-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'postgreSql' + services_list: '--pdpgsql-version=13 --addclient=pdpgsql,1' + test_name: 'PD PostgreSQL 13' + + pdpgsql-14-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'postgreSql' + services_list: '--pdpgsql-version=14 --addclient=pdpgsql,1' + test_name: 'PD PostgreSQL 14' + + pdpgsql-15-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'postgreSql' + services_list: '--pdpgsql-version=15 --addclient=pdpgsql,1' + test_name: 'PD PostgreSQL 15' + + # FIXME: PMM-12966 + # mongo-44-tests: + # name: 'CLI / Integration' + # uses: ./.github/workflows/runner-integration-cli-tests.yml + # secrets: inherit + # with: + # sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + # pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + # pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + # 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' }} + # cli_test: 'pmm-ui-tests/cli/tests/mongoDb.spec.ts' + # services_list: '--modb-version=4.4 --addclient=modb,1' + # test_name: 'MongoDB 4.4' + + # FIXME: PMM-12966 + # mongo-5-tests: + # name: 'CLI / Integration' + # uses: ./.github/workflows/runner-integration-cli-tests.yml + # secrets: inherit + # with: + # sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + # pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + # pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + # 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' }} + # cli_test: 'pmm-ui-tests/cli/tests/mongoDb.spec.ts' + # services_list: '--modb-version=5 --addclient=modb,1' + # test_name: 'MongoDB 5.x' + + # FIXME: PMM-12966 + # mongo-6-tests: + # name: 'CLI / Integration' + # uses: ./.github/workflows/runner-integration-cli-tests.yml + # secrets: inherit + # with: + # sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + # pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + # pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + # 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' }} + # cli_test: 'pmm-ui-tests/cli/tests/mongoDb.spec.ts' + # services_list: '--modb-version=6 --addclient=modb,1' + # test_name: 'MongoDB 6.x' + # FIXME: PMM-12966 + # mongo-7-tests: + # name: 'CLI / Integration' + # uses: ./.github/workflows/runner-integration-cli-tests.yml + # secrets: inherit + # with: + # sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + # pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + # pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + # 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' }} + # cli_test: 'pmm-ui-tests/cli/tests/mongoDb.spec.ts' + # services_list: '--modb-version=7 --addclient=modb,1' + # test_name: 'MongoDB 7.x' + + psmdb-44-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts' + services_list: '--mo-version=4.4 --mongomagic --with-shard' + test_name: 'PSMDB 4.4' + + psmdb-5-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts' + services_list: '--mo-version=5 --mongomagic --with-shard' + test_name: 'PSMDB 5.x' + + psmdb-6-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts' + services_list: '--mo-version=6 --mongomagic --with-shard' + test_name: 'PSMDB 6.x' + + psmdb-7-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts' + services_list: '--mo-version=7 --mongomagic --with-shard' + test_name: 'PSMDB 7.x' + + haproxy-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'haproxy' + services_list: '--addclient=haproxy,1' + test_name: 'HA Proxy' + + proxysql-tests: + name: 'CLI / Integration' + uses: ./.github/workflows/runner-integration-cli-tests.yml + secrets: inherit + with: + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} + pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} + pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} + 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' }} + cli_test: 'proxySql' + services_list: '--pxc-version=5.7 --addclient=pxc,1' + test_name: 'PXC 5.7' diff --git a/.github/workflows/package-test-fb.yml b/.github/workflows/package-test-fb.yml index 650121c5..9de25bb7 100644 --- a/.github/workflows/package-test-fb.yml +++ b/.github/workflows/package-test-fb.yml @@ -16,6 +16,7 @@ on: default: "perconalab/pmm-server:dev-latest" pmm_client_tarball: description: "PMM Client tarball link or FB-code" + default: 'dev-latest' type: string required: true playbook: @@ -37,34 +38,33 @@ on: - auto - push - pull + sha: + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string workflow_call: inputs: package_testing_branch: - description: 'Target branch for package-testing repository' type: string - default: 'master' required: false pmm_server_image: - description: "pmm-server docker image" required: true type: string - default: "perconalab/pmm-server:dev-latest" pmm_client_tarball: - description: "PMM Client tarball link or FB-code" type: string required: true playbook: - description: 'Select test to run:' - default: 'pmm2-client_integration' required: true type: string metrics_mode: - description: 'Select the Metrics Mode for PMM Client:' - default: 'auto' + required: false type: string test_name: - description: 'Name of the test to pretty display in checks list' + type: string + sha: + required: false type: string jobs: @@ -88,8 +88,10 @@ jobs: pmm_server_image: ${{ inputs.pmm_server_image }} pmm_client_tarball: ${{ inputs.pmm_client_tarball == 'dev-latest' && needs.get_versions.outputs.finish_version || inputs.pmm_client_tarball }} expected_version: ${{needs.get_versions.outputs.finish_version}} + package: 'pmm2-client' repository: 'dev-latest' metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: ${{ inputs.playbook || 'pmm2-client_integration_custom_path' }} test_name: ${{ inputs.test_name > '' && format('{0} {1}', inputs.test_name, matrix.os) || matrix.os }} os: ${{ matrix.os }} + sha: ${{ inputs.sha || github.event.pull_request.head.sha || 'null' }} diff --git a/.github/workflows/package-test-matrix-full.yml b/.github/workflows/package-test-matrix-full.yml index b9bc2bfd..e00f6652 100644 --- a/.github/workflows/package-test-matrix-full.yml +++ b/.github/workflows/package-test-matrix-full.yml @@ -9,6 +9,15 @@ on: type: string default: 'master' required: true + package: + description: "Select source package for enabling repo" + required: true + default: "pmm2-client" + type: choice + options: + - original + - pmm2-client + - tools repository: description: 'Select Repo for Client:' required: true @@ -35,6 +44,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration" @@ -45,6 +55,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration" @@ -55,6 +66,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_auth_config" @@ -65,6 +77,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_auth_register" @@ -75,6 +88,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_upgrade" @@ -85,6 +99,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_upgrade" @@ -95,6 +110,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_upgrade_custom_port" @@ -105,6 +121,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_custom_path" @@ -115,6 +132,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_custom_path" @@ -125,6 +143,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_custom_port" @@ -135,6 +154,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_upgrade_custom_path" diff --git a/.github/workflows/package-test-matrix.yml b/.github/workflows/package-test-matrix.yml index fb72feef..7ec7e1a2 100644 --- a/.github/workflows/package-test-matrix.yml +++ b/.github/workflows/package-test-matrix.yml @@ -12,6 +12,15 @@ on: type: string default: 'master' required: true + package: + description: "Select source package for enabling repo" + required: true + default: "pmm2-client" + type: choice + options: + - original + - pmm2-client + - tools repository: description: 'Select Repo for Client:' required: true @@ -38,6 +47,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration" @@ -48,6 +58,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_upgrade" @@ -58,6 +69,7 @@ jobs: secrets: inherit with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: "pmm2-client_integration_upgrade_custom_path" diff --git a/.github/workflows/package-test-single.yml b/.github/workflows/package-test-single.yml index 8fa5e748..513ac277 100644 --- a/.github/workflows/package-test-single.yml +++ b/.github/workflows/package-test-single.yml @@ -8,7 +8,7 @@ on: description: 'Target branch for package-testing repository' type: string default: 'master' - required: true + required: false playbook: description: 'Select test to run:' default: 'pmm2-client_integration' @@ -26,6 +26,15 @@ on: - pmm2-client_integration_custom_port - pmm2-client_integration_upgrade_custom_port - pmm2-client_integration_upgrade_custom_path + package: + description: "Select source package for enabling repo" + required: true + default: "pmm2-client" + type: choice + options: + - original + - pmm2-client + - tools repository: description: 'Select Repo for Client:' required: true @@ -37,7 +46,7 @@ on: - dev-latest metrics_mode: description: 'Select the Metrics Mode for PMM Client:' - required: true + required: false default: 'auto' type: choice options: @@ -48,24 +57,20 @@ on: workflow_call: inputs: package_testing_branch: - description: 'Target branch for package-testing repository' type: string - default: 'master' required: true playbook: - description: 'Select test to run:' - default: 'pmm2-client_integration' + required: true + type: string + package: required: true type: string repository: - description: 'Select Repo for Client:' required: true - default: 'dev-latest' type: string metrics_mode: - description: 'Select the Metrics Mode for PMM Client:' - default: 'auto' type: string + required: false jobs: get_versions: @@ -86,8 +91,25 @@ jobs: with: package_testing_branch: ${{ inputs.package_testing_branch || 'master' }} expected_version: ${{needs.get_versions.outputs.finish_version}} + package: ${{ inputs.package || 'pmm2-client' }} repository: ${{ inputs.repository || 'dev-latest' }} metrics_mode: ${{ inputs.metrics_mode || 'auto' }} playbook: ${{ inputs.playbook || 'pmm2-client_integration' }} test_name: ${{ matrix.os }} os: ${{ matrix.os }} + + slack_notify: + runs-on: ubuntu-latest + if: ${{ failure() && inputs.repository == 'release' }} + needs: fb_test + steps: + - name: Slack Notification + uses: percona/gh-action-action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_TOKEN }} + SLACK_USERNAME: "package tests runner" + SLACK_ICON_EMOJI: ":squirrel:" + SLACK_COLOR: "#FF0000" + SLACK_TITLE: "Package tests failure" + SLACK_MESSAGE: "Failed Package tests for release repository" + SLACK_FOOTER: "Please check the Actions URL ^" diff --git a/.github/workflows/pmm-version-getter.yml b/.github/workflows/pmm-version-getter.yml index 4ba0f12c..5c65d22b 100644 --- a/.github/workflows/pmm-version-getter.yml +++ b/.github/workflows/pmm-version-getter.yml @@ -10,7 +10,7 @@ on: description: 'PMM Client version to upgrade from (dev-latest|pmm2-latest|pmm2-rc|x.xx.x)' type: string repository: - description: 'Upgrade to:' + description: 'To detect "finish_version" string: X.XX.X' required: true default: 'dev-latest' type: string @@ -41,7 +41,7 @@ jobs: start_version: ${{ steps.get-start.outputs.result }} finish_version: ${{ steps.get-finish.outputs.result }} version_matrix: ${{ steps.get-matrix.outputs.result }} - pt_os_matrix: "[\"buster\", \"bullseye\", \"bookworm\", \"focal\", \"jammy\", \"centos-7\", \"ol-8\", \"ol-9\"]" + pt_os_matrix: "[\"buster\", \"bullseye\", \"bookworm\", \"focal\", \"jammy\", \"centos-7\", \"ol-8\", \"ol-9\", \"noble\"]" steps: - name: Prevent upgrade to the same version shell: bash @@ -65,6 +65,16 @@ jobs: echo "release_latest=$r_latest" >> $GITHUB_ENV echo "rc_latest=$rc_latest" >> $GITHUB_ENV echo "dev_latest=$d_latest" >> $GITHUB_ENV + + if [[ "${{ inputs.repository }}" == "release" ]]; then + if [[ "$r_latest" != "$rc_latest" ]]; then + echo "Released PMM version is not correct!" + echo "release_latest=$r_latest" + echo "rc_latest=$rc_latest" + echo "dev_latest=$d_latest" + exit 1 + fi + fi - name: Get start version string id: get-start diff --git a/.github/workflows/pmm2-integration-tests.yml b/.github/workflows/pmm2-integration-tests.yml deleted file mode 100644 index e9eaaf1e..00000000 --- a/.github/workflows/pmm2-integration-tests.yml +++ /dev/null @@ -1,149 +0,0 @@ ---- -name: pmm2-integration-tests - -on: - workflow_dispatch: - inputs: - pmm_ui_tests_branch: - description: 'Target branch for pmm-ui-tests repository' - default: 'main' - required: true - pmm_qa_branch: - description: 'Target branch for pmm-qa repository' - default: 'main' - required: true - integration_setup: - description: 'Add flag to test selected integration setup' - default: '--setup-pmm-pgsm-integration' - required: true - pmm_server_version: - description: 'Provide version of pmm server' - default: 'dev-latest' - required: true - pmm_client_version: - description: 'Provide version of pmm server' - default: 'dev-latest' - required: true - pgsql_version: - description: 'Provide version of PostgreSQL' - default: '15.0' - required: true - ps_version: - description: 'Provide version of Percona Server for MySQL' - default: '8.0' - required: true - mongo_version: - description: 'Provide version of Mongo DB' - default: '4.4' - required: true - mongo_setup: - description: 'Provide setup type for Mongo DB' - type: choice - options: - - regular - - replica - - sharded - - arbiter - default: 'regular' - required: true - -jobs: - integration-tests: - name: Integration Tests - runs-on: ubuntu-latest - timeout-minutes: 60 - env: - SHA: ${{ github.event.inputs.sha || 'null' }} - ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - UI_TESTS_BRANCH: ${{ github.event.inputs.pmm_ui_tests_branch }} - QA_TESTS_BRANCH: ${{ github.event.inputs.pmm_qa_branch }} - INTEGRATION_SETUP: ${{ github.event.inputs.integration_setup }} - PMM_SERVER_VERSION: ${{ github.event.inputs.pmm_server_version }} - PMM_CLIENT_VERSION: ${{ github.event.inputs.pmm_client_version }} - - PGSQL_VERSION: ${{ github.event.inputs.pgsql_version }} - PS_VERSION: ${{ github.event.inputs.ps_version }} - MONGO_VERSION: ${{ github.event.inputs.mongo_version }} - MONGO_SETUP: ${{ github.event.inputs.mongo_setup }} - - - - steps: - - name: Tests of pmm server version ${{ github.event.inputs.pmm_server_version }} for integration flag ${{ github.event.inputs.integration_setup }} - if: ${{ github.event_name == 'workflow_dispatch' && env.SHA != 'null' }} - uses: Sibz/github-status-action@v1 - with: - context: 'pmm2-ui-tests' - description: 'Tests execution has been started' - state: 'pending' - repository: ${{ github.event.inputs.repo }} - target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' - sha: ${{ env.SHA }} - - - name: Install NodeJS v16 - uses: percona-platform/setup-node@v2 - with: - node-version: 16.14.1 - - - name: Checkout UI tests - uses: percona-platform/checkout@v2 - with: - ref: ${{ env.UI_TESTS_BRANCH }} - repository: percona/pmm-ui-tests - path: ./pmm-ui-tests - - - name: Checkout pmm-qa Repo - uses: percona-platform/checkout@v2 - with: - repository: percona/pmm-qa - path: ./pmm-qa - ref: ${{ env.QA_TESTS_BRANCH }} - - - name: Start PMM-Sever - run: | - docker network create pmm-integration-network - docker run -d --restart always -e PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com:443 --network="pmm-integration-network" --publish 80:80 --publish 443:443 --name pmm-integration-server perconalab/pmm-server:${{ env.PMM_SERVER_VERSION }} - - - name: Setup Docker client for PMM-Server - run: | - sudo bash -x ./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 - sudo pmm-admin status - - - name: Setup Databases for PMM-Server - working-directory: pmm-qa/pmm-integration - run: | - sudo npm install - sudo npx ts-node ./integration-setup.ts --pmm-client-version=${{ env.PMM_CLIENT_VERSION }} --pgsql-version=${{ env.PGSQL_VERSION }} --ps-version=${{ env.PS_VERSION }} --mo-version=${{ env.MONGO_VERSION }} --mo-setup=${{ env.MONGO_SETUP }} --ci ${{ env.INTEGRATION_SETUP }} - shell: bash - - - name: Execute Integration Tests - working-directory: pmm-ui-tests - id: pmm-ui-tests - run: | - sudo docker ps -a - node -v - npm install - ./node_modules/.bin/codeceptjs run --debug --steps --reporter mochawesome -c pr.codecept.js --grep '${{ env.INTEGRATION_FLAG }}' - - - name: Generating the report - if: ${{ always() && (steps.pmm-ui-tests-all.outcome != 'skipped' || steps.pmm-ui-tests-tagged.outcome != 'skipped' ) }} - working-directory: pmm-ui-tests - run: | - npx mochawesome-merge tests/output/*/*.json > tests/output/output.json - - - name: Create the report - uses: phoenix-actions/test-reporting@v10 - if: success() || failure() - with: - token: ${{ secrets.ROBOT_TOKEN }} - name: Integration Tests - path: pmm-ui-tests/tests/output/mochawesome.json - reporter: mocha-json - - - name: Attaching the report - if: ${{ always() && (steps.pmm-ui-tests-all.outcome != 'skipped' || steps.pmm-ui-tests-tagged.outcome != 'skipped' ) }} - uses: percona-platform/upload-artifact@v2 - with: - name: pmm-ui-tests-report - path: pmm-ui-tests/tests/output diff --git a/.github/workflows/portal-tests-matrix.yml b/.github/workflows/portal-tests-matrix.yml deleted file mode 100644 index 7d0c25f3..00000000 --- a/.github/workflows/portal-tests-matrix.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: "Portal Tests Matrix" - -on: - push: - branches: - - "PMM-7-fix-portal-pipeline" - -jobs: - get_versions: - name: Get versions - uses: ./.github/workflows/pmm-version-getter.yml - with: - repository: ${{ inputs.repository || 'dev-latest'}} - matrix_range: 5 - - portal: - name: 'Portal / Integration' - uses: ./.github/workflows/portal-ui-tests.yml - secrets: inherit - needs: get_versions - strategy: - fail-fast: false - matrix: - old_version: ${{ fromJSON(needs.get_versions.outputs.version_matrix) }} - with: - pmm_ui_tests_branch: ${{ inputs.pmm_ui_tests_branch || 'main' }} - pmm_test_flag: '@portal' - pmm_server_version: ${{ matrix.old_version }} - pmm_client_version: ${{ matrix.old_version }} - pmm_qa_branch: ${{ inputs.pmm_qa_branch || 'main' }} - pmm_clients: '' - version_string_from: ${{needs.get_versions.outputs.start_version}} - diff --git a/.github/workflows/runner-cli-integration-test.yml b/.github/workflows/runner-cli-integration-test.yml deleted file mode 100644 index 257c581d..00000000 --- a/.github/workflows/runner-cli-integration-test.yml +++ /dev/null @@ -1,289 +0,0 @@ -name: PMM Integration Tests -on: - # run with default inputs - workflow_dispatch: - inputs: - server_image: - description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" - required: false - type: string - client_version: - description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" - required: false - type: string - client_image: - description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" - required: false - type: string - pmm_qa_branch: - description: "Branch for PMM-QA to checkout" - required: false - type: string - pmm_ui_branch: - description: "Branch for PMM-UI(CLI) tests to checkout" - required: false - type: string - sha: - description: "SHA (leave empty if running manually, default - 'null')" - required: false - type: string - workflow_call: - inputs: - server_image: - description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" - required: false - type: string - client_version: - description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" - required: false - type: string - client_image: - description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" - required: false - type: string - pmm_qa_branch: - description: "Branch for PMM-QA to checkout" - required: false - type: string - pmm_ui_branch: - description: "Branch for PMM-UI(CLI) tests to checkout" - required: false - type: string - sha: - description: "SHA (leave empty if running manually, default - 'null')" - required: false - type: string - -jobs: - cli-tests: - runs-on: ubuntu-latest - timeout-minutes: 40 - env: - SERVER_IMAGE: ${{ github.event.inputs.server_image || inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_IMAGE: ${{ github.event.inputs.client_image || inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - CLIENT_VERSION: ${{ github.event.inputs.client_version || inputs.client_version || 'dev-latest' }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PMM_QA_BRANCH: ${{ github.event.inputs.pmm_qa_branch || inputs.pmm_qa_branch || 'main' }} - PMM_UI_BRANCH: ${{ github.event.inputs.pmm_ui_branch || inputs.pmm_ui_branch || 'main' }} - DOCKER_VERSION: ${{ github.event.inputs.server_image || inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_DOCKER_VERSION: ${{ github.event.inputs.client_image || inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - SHA: ${{ github.event.inputs.sha || inputs.sha || github.event.pull_request.head.sha || github.event.pull_request.head.sha || github.sha || 'null' }} - strategy: - fail-fast: false - matrix: - db-type: [ps5.7, ps8, ms8.0, pdpgsql13, pdpgsql14, pdpgsql15, modb4.4, modb5, modb6, help, generic, server-container, clientContainer, haproxy, proxysql, remove] - - steps: - - name: Create status check - if: ${{ env.SHA != 'null' }} - uses: percona/gh-action-github-status-action@update-node - continue-on-error: true - with: - authToken: ${{ secrets.GITHUB_TOKEN }} - context: "${{ matrix.db-type }} CLI 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-QA tests ${{ env.PMM_QA_BRANCH }} branch - uses: actions/checkout@v4 - with: - ref: ${{ env.PMM_QA_BRANCH }} - repository: percona/pmm-qa - path: ./ - - - 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: Install playwright - working-directory: ./pmm-ui-tests/cli - run: | - npm ci - - - name: Setup tools - run: | - 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 - wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh - chmod +x get_download_link.sh - - - name: Setup PMM2-Server - run: | - docker create -v /srv --name pmm-server-data ${{ env.SERVER_IMAGE }} - docker run -d -p 80:80 -p 443:443 -p 9000:9000 \ - -e PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com:443 \ - -e PERCONA_TEST_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX \ - --volumes-from pmm-server-data --name pmm-server --restart always ${{ env.SERVER_IMAGE }} - timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1/v1/readyz)" != "200" ]]; do sleep 2; done' || false - - - name: Setup PMM2-Client - run: sudo -E bash -x ./pmm-tests/pmm2-client-setup.sh --pmm_server_ip 127.0.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password admin --use_metrics_mode no - - - name: Setup npm modules for the integration setup - working-directory: pmm-integration - run: npm ci - - - name: Run CLI '--help' tests - if: ${{ matrix.db-type == 'help' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-ui-tests/cli/tests/help.spec.ts --quiet - - - name: Run CLI remove tests - if: ${{ matrix.db-type == 'remove' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-ui-tests/cli/tests/remove.spec.ts --quiet - - - name: Run Setup for ps5.7 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'ps5.7' }} - run: | - sudo npx ts-node ./integration-setup.ts --ps-version=5.7 --ci --addclient=ps,1 - - - name: Run Setup for ps8.0 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'ps8' }} - run: | - sudo npx ts-node ./integration-setup.ts --ps-version=8 --ci --addclient=ps,1 - - - name: Run CLI tests for PS - if: ${{ matrix.db-type == 'ps5.7' || matrix.db-type == 'ps8' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-ui-tests/cli/tests/perconaMySqlServer.spec.ts --quiet - - - name: Run Setup for pdpgsql 13 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'pdpgsql13' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=13 - - - name: Run Setup for pdpgsql 14 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'pdpgsql14' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=14 - - - name: Run Setup for pdpgsql 15.0 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'pdpgsql15' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=pdpgsql,1 --pdpgsql-version=15.0 - - - name: Run CLI tests for PDPGSQL - if: ${{ matrix.db-type == 'pdpgsql13' || matrix.db-type == 'pdpgsql14' || matrix.db-type == 'pdpgsql15' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test postgreSql --quiet - - - name: Run Setup for PSMDB 4.4 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'modb4.4' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=4 - sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=4 --with-shard --mongomagic - - - name: Run Setup for PSMDB 5 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'modb5' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=5 - sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=5 --with-shard --mongomagic - - - name: Run Setup for PSMDB 6 - working-directory: pmm-integration - if: ${{ matrix.db-type == 'modb6' }} - run: | - sudo npx ts-node ./integration-setup.ts --ci --addclient=modb,1 --mo-version=6 - sudo -E bash -x ../pmm-tests/pmm-framework.sh --addclient=modb,1 --mo-version=6 --with-shard --mongomagic - - - name: Run CLI tests for PSMDB - if: ${{ matrix.db-type == 'modb6' || matrix.db-type == 'modb5' || matrix.db-type == 'modb4.4' }} - working-directory: ./pmm-ui-tests/cli - run: | - npx playwright test pmm-ui-tests/cli/tests/mongoDb-psmdb.spec.ts --quiet - -# TODO: Add setup for the official MongoDB and run "npx playwright test pmm-ui-tests/cli/tests/mongoDb.spec.ts" - - - name: Run Client Container Setup - if: ${{ matrix.db-type == 'clientContainer' }} - run: | - sudo -E bash -x ./pmm-tests/pmm-framework.sh --setup-pmm-client-docker --pmm2 - - - name: Run CLI tests for Generic Scenarios - if: ${{ matrix.db-type == 'generic' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test generic unregister --quiet - - - name: Run CLI tests for PMM Server Container - if: ${{ matrix.db-type == 'server-container' && !contains(env.PMM_UI_BRANCH, 'pmm-2.') }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-server-only --quiet - - - name: Run CLI tests for PMM Client Docker Container - if: ${{ matrix.db-type == 'clientContainer' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-client-docker --quiet - - - name: Run Setup for HAPROXY - if: ${{ matrix.db-type == 'haproxy' }} - run: | - export CLIENT_VERSION=${{ env.CLIENT_VERSION }} - export CLIENT_DOCKER_VERSION=${{ env.CLIENT_DOCKER_VERSION }} - sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=haproxy,1 --pmm2 - - - name: Run CLI tests for Client Container Scenarios - if: ${{ matrix.db-type == 'haproxy' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test haproxy --quiet - - - name: Run Setup for ProxySQL - if: ${{ matrix.db-type == 'proxysql' }} - run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=pxc,1 --pmm2 --pxc-version=5.7 - - - name: Run CLI tests for ProxySQL - if: ${{ matrix.db-type == 'proxysql' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test proxySql --quiet - - - name: Run Setup for MySQL 8.0 - if: ${{ matrix.db-type == 'ms8.0' }} - run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=ms,1 --pmm2 --ms-version=8.0 - - - name: Run MySQL specific CLI tests - if: ${{ matrix.db-type == 'ms8.0' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-ui-tests/cli/tests/mysql.spec.ts --quiet - - - name: Run CLI tests for MySQL Tests - if: ${{ matrix.db-type == 'ms8.0' }} - working-directory: ./pmm-ui-tests/cli - run: npx playwright test pmm-ui-tests/cli/tests/mysql-conf-file.spec.ts --quiet - - - name: Generate and Attach the report - if: ${{ always() }} - uses: actions/upload-artifact@v4 - with: - name: "report-${{ matrix.db-type }}" - path: ./pmm-ui-tests/cli/test-report - - - name: Create status check - if: ${{ always() }} - uses: percona/gh-action-github-status-action@update-node - continue-on-error: true - with: - authToken: ${{ secrets.GITHUB_TOKEN }} - context: "${{ matrix.db-type }} CLI 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 }} diff --git a/.github/workflows/runner-e2e-tests-codeceptjs.yml b/.github/workflows/runner-e2e-tests-codeceptjs.yml index 97b233c3..457bee02 100644 --- a/.github/workflows/runner-e2e-tests-codeceptjs.yml +++ b/.github/workflows/runner-e2e-tests-codeceptjs.yml @@ -1,39 +1,70 @@ name: _runner-e2e-tests on: - workflow_call: + workflow_dispatch: inputs: - server_image: - description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + pmm_ui_tests_branch: + description: "Branch for PMM-UI tests to checkout" required: false type: string - client_version: - description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" required: false type: string - client_image: - description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + pmm_server_image: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:dev-latest' required: false type: string - pmm_qa_branch: - description: "Branch for PMM-QA to checkout" + pmm_client_image: + description: 'pmm2-client docker image' + default: 'perconalab/pmm-client:dev-latest' required: false type: string - pmm_ui_branch: - description: "Branch for PMM-UI tests to checkout" + 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 empty if running manually, default - 'null')" + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + pmm_ui_tests_branch: required: false type: string - client_flags: - description: "example: --addclient=ps,1 --ps-version=5.7" + 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: - description: "example: @settings-fb" required: true type: string + sha: + required: false + type: string jobs: ui-tests-e2e: @@ -42,19 +73,16 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 60 env: - SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_IMAGE: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} - PMM_CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} + 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_branch || 'main' }} - DOCKER_VERSION: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_DOCKER_VERSION: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - SHA: ${{ inputs.sha || 'null' }} - CLIENT_FLAGS: ${{ inputs.client_flags || '' }} + 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 @@ -85,7 +113,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 \ @@ -115,16 +142,17 @@ jobs: - name: Setup PMM2-Client working-directory: ./pmm-qa - run: sudo bash -x pmm-tests/pmm2-client-setup.sh --pmm_server_ip 192.168.0.1 --client_version ${{ env.CLIENT_VERSION }} --admin_password ${{ env.ADMIN_PASSWORD }} --use_metrics_mode no + run: sudo bash -x pmm-tests/pmm2-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.CLIENT_FLAGS }} --pmm2 + 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 + npx playwright install envsubst < env.list > env.generated.list - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} @@ -145,6 +173,13 @@ jobs: 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 diff --git a/.github/workflows/runner-e2e-tests-playwright.yml b/.github/workflows/runner-e2e-tests-playwright.yml index a3ceaaa2..1f0f4dd4 100644 --- a/.github/workflows/runner-e2e-tests-playwright.yml +++ b/.github/workflows/runner-e2e-tests-playwright.yml @@ -2,7 +2,7 @@ name: runner-e2e-tests-playwright on: - workflow_call: + workflow_dispatch: inputs: pmm_ui_tests_branch: description: 'Target branch for pmm-ui-tests repository' @@ -23,7 +23,7 @@ on: type: string default: 'dev-latest' required: true - pmm_clients: + setup_services: description: 'Clients for pmm-server' type: string default: '--addclient=ps,1' @@ -34,36 +34,25 @@ on: default: 'main' required: true - workflow_dispatch: + workflow_call: 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 - pmm_clients: - description: 'Clients for pmm-server' + setup_services: type: string - default: '--addclient=ps,1' - required: true + required: false pmm_qa_branch: - description: 'Branch for the pmm-qa repository.' type: string - default: 'main' required: true jobs: @@ -77,7 +66,7 @@ jobs: ADMIN_PASSWORD: admin UI_TESTS_BRANCH: ${{ inputs.pmm_ui_tests_branch }} - PMM_CLIENTS: ${{ inputs.pmm_clients }} + WIZARD_ARGS: ${{ inputs.setup_services }} PMM_TEST_FLAG: ${{ inputs.pmm_test_flag }} PMM_SERVER_VERSION: ${{ inputs.pmm_server_version }} @@ -86,11 +75,11 @@ jobs: OKTA_TOKEN: ${{ secrets.OKTA_TOKEN }} OAUTH_ISSUER_URL: 'https://id-dev.percona.com/oauth2/aus15pi5rjdtfrcH51d7' - OAUTH_CLIENT_ID: ${{ secrets.OKTA_OAUTH_CLIENT_ID }} - OAUTH_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_CLIENT_SECRET }} - OAUTH_PMM_CLIENT_ID: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_ID }} - OAUTH_PMM_CLIENT_SECRET: ${{ secrets.OKTA_OAUTH_PMM_CLIENT_SECRET }} - OAUTH_DEV_HOST: ${{ secrets.OAUTH_DEV_HOST }} + 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 @@ -117,7 +106,7 @@ jobs: sha: ${{ env.SHA }} - name: 'Checkout UI tests: "${{ inputs.pmm_ui_tests_branch }}"' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ inputs.pmm_ui_tests_branch }} repository: percona/pmm-ui-tests @@ -130,7 +119,7 @@ jobs: npx playwright install - name: 'Checkout pmm-qa: "${{ inputs.pmm_qa_branch }}"' - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: # token: ${{ secrets.ROBOT_TOKEN }} repository: percona/pmm-qa @@ -153,7 +142,7 @@ jobs: working-directory: pmm-qa/pmm-integration run: | sudo npx ts-node ./integration-setup.ts --ci \ - ${{ env.PMM_CLIENTS }} + ${{ env.WIZARD_ARGS }} sleep 30 sudo pmm-admin list shell: bash @@ -164,8 +153,6 @@ jobs: working-directory: pmm-ui-tests/playwright-tests run: | npx playwright test --project="chromium" --quiet -# env: -# NODE_TLS_REJECT_UNAUTHORIZED: 0 - name: 'Run UI tests: ${{ env.PMM_TEST_FLAG }}' if: ${{ inputs.pmm_test_flag != 'null' }} @@ -174,8 +161,6 @@ jobs: run: | project="${{ contains(env.PMM_TEST_FLAG, 'portal') && 'Portal' || 'Chromium' }}" npx playwright test --project=$project --grep ${{ env.PMM_TEST_FLAG }} --pass-with-no-tests -# env: -# NODE_TLS_REJECT_UNAUTHORIZED: 0 - name: 'Create report name' if: failure() diff --git a/.github/workflows/runner-e2e-tests-podman.yml b/.github/workflows/runner-e2e-tests-podman.yml index 03f08922..4ef0f8cf 100644 --- a/.github/workflows/runner-e2e-tests-podman.yml +++ b/.github/workflows/runner-e2e-tests-podman.yml @@ -1,42 +1,70 @@ name: runner-e2e-tests-podman on: - workflow_call: + workflow_dispatch: inputs: - server_image: - description: "pmm-server docker image, default perconalab/pmm-server:dev-latest" + pmm_ui_tests_branch: + description: "Branch for PMM-UI tests to checkout" required: false type: string - client_version: - description: "pmm2-client version Tarball or Dev-latest, default is dev-latest" + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" required: false type: string - client_image: - description: "pmm2-client docker image, default perconalab/pmm-client:dev-latest" + pmm_server_image: + description: 'PMM Server docker image' + default: 'perconalab/pmm-server:dev-latest' required: false type: string - pmm_qa_branch: - description: "Branch for PMM-QA to checkout" + pmm_client_image: + description: 'pmm2-client docker image' + default: 'perconalab/pmm-client:dev-latest' required: false type: string - pmm_ui_branch: - description: "Branch for PMM-UI tests to checkout" + 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 empty if running manually, default - 'null')" + description: "SHA (leave default if running manually)" + default: 'null' + required: false + type: string + + workflow_call: + inputs: + pmm_ui_tests_branch: required: false type: string - client_flags: - description: "example: --addclient=ps,1 --ps-version=5.7" + 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: - description: "example: @settings-fb" required: true type: string - push: - branches: - - PMM-12359-podman-setup + sha: + required: false + type: string jobs: ui-tests-e2e: @@ -45,25 +73,22 @@ jobs: runs-on: ubuntu-20.04 timeout-minutes: 60 env: - SERVER_IMAGE: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_IMAGE: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - CLIENT_VERSION: ${{ inputs.client_version || 'dev-latest' }} + SHA: ${{ inputs.sha || 'null' }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - ADMIN_PASSWORD: 'admin-password' + PMM_UI_TESTS_BRANCH: ${{ inputs.pmm_ui_tests_branch || 'main' }} PMM_QA_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} - PMM_QA_GIT_BRANCH: ${{ inputs.pmm_qa_branch || 'main' }} - PMM_UI_BRANCH: ${{ inputs.pmm_ui_branch || 'main' }} - DOCKER_VERSION: ${{ inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - CLIENT_DOCKER_VERSION: ${{ inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - SHA: ${{ inputs.sha || 'null' }} - CLIENT_FLAGS: ${{ inputs.client_flags || '' }} + 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' }} @@ -78,10 +103,10 @@ jobs: target_url: "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" sha: ${{ env.SHA }} - - name: "Checkout PMM UI tests: ${{ env.PMM_UI_BRANCH }}" + - name: "Checkout PMM UI tests: ${{ env.PMM_UI_TESTS_BRANCH }}" uses: actions/checkout@v4 with: - ref: ${{ env.PMM_UI_BRANCH }} + ref: ${{ env.PMM_UI_TESTS_BRANCH }} repository: percona/pmm-ui-tests path: ./pmm-ui-tests @@ -94,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 \ @@ -195,12 +219,13 @@ jobs: - name: Run Setup for E2E Tests working-directory: ./pmm-qa - run: sudo -E bash -x pmm-tests/pmm-framework.sh ${{ env.CLIENT_FLAGS }} --pmm2 + 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 + npx playwright install envsubst < env.list > env.generated.list - name: Execute e2e tests with tags ${{ env.TAGS_FOR_TESTS }} diff --git a/.github/workflows/runner-e2e-upgrade-tests.yml b/.github/workflows/runner-e2e-upgrade-tests.yml index b0cdc070..b50819f5 100644 --- a/.github/workflows/runner-e2e-upgrade-tests.yml +++ b/.github/workflows/runner-e2e-upgrade-tests.yml @@ -382,7 +382,8 @@ jobs: --volumes-from pmm-integration-server-data \ --name pmm-integration-server \ ${{ steps.pmm_server_to_image.outputs.IMAGE }} - timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do sleep 2; done' || false + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do echo "waiting for ${{ env.PMM_SERVER_IP }}" && sleep 2; done' || false + sleep 30 - name: 'Upgrade pmm-server: ' if: ${{ inputs.upgrade_type == 'Podman way' }} @@ -395,7 +396,8 @@ jobs: podman pull docker.io/${{ steps.pmm_server_to_image.outputs.IMAGE }} systemctl --user restart pmm-server - timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do sleep 2; done' || false + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://${{ env.PMM_SERVER_IP }}/v1/readyz)" != "200" ]]; do echo "waiting for ${{ env.PMM_SERVER_IP }}" && sleep 2; done' || false + sleep 30 - name: 'Tests upgrade' working-directory: ./pmm-ui-tests/playwright-tests diff --git a/.github/workflows/runner-integration-cli-tests.yml b/.github/workflows/runner-integration-cli-tests.yml new file mode 100644 index 00000000..61f2620d --- /dev/null +++ b/.github/workflows/runner-integration-cli-tests.yml @@ -0,0 +1,156 @@ +name: _runner-integration-cli-tests +on: + workflow_call: + inputs: + pmm_qa_branch: + description: "Branch for PMM-QA to checkout" + required: false + type: string + pmm_ui_tests_branch: + description: "Branch for PMM-UI(CLI) tests to checkout" + required: false + type: string + pmm_server_image: + description: 'PMM Server docker image:' + default: 'perconalab/pmm-server:dev-latest' + required: true + 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://tarball.tar.gz)' + default: 'dev-latest' + required: true + type: string + services_list: + description: "pmm-framework.sh flags to perform setup, '--pmm2' added implicitly" + required: false + type: string + cli_test: + description: "playwright test arguments to execute tests" + required: false + type: string + test_name: + type: string + required: false + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string + +jobs: + cli-tests: + name: ${{ inputs.test_name || inputs.cli_test}} + runs-on: ubuntu-latest + timeout-minutes: 40 + env: + SHA: ${{ github.event.inputs.sha || inputs.sha || github.event.pull_request.head.sha || github.event.pull_request.head.sha || github.sha || 'null' }} + 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 || 'dev-latest' }} + + ### used in tests ### + PMM_SERVER_IMAGE: ${{ inputs.pmm_server_image || 'perconalab/pmm-client:dev-latest' }} + + # TODO: rename and update tests to use PMM_CLIENT_IMAGE instead + CLIENT_IMAGE: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + + # TODO: rename and update tests to use PMM_CLIENT_VERSION instead + CLIENT_VERSION: ${{ inputs.pmm_client_version || 'dev-latest' }} + + # TODO: used in pmm-framework.sh as well. Remove setup dependency on this var. + # TODO: update tests to use PMM_SERVER_IMAGE instead + DOCKER_VERSION: ${{ inputs.pmm_server_image || 'perconalab/pmm-client:dev-latest' }} + + # TODO: used in pmm-framework.sh as well. Remove setup dependency on this var. + # TODO: update tests to use PMM_SERVER_IMAGE instead + CLIENT_DOCKER_VERSION: ${{ inputs.pmm_client_image || 'perconalab/pmm-client:dev-latest' }} + + steps: + - name: Create status check + if: ${{ env.SHA != 'null' }} + uses: percona/gh-action-github-status-action@master + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ matrix.db-type }} CLI 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-qa: <${{ env.PMM_QA_BRANCH }}>' + uses: actions/checkout@v4 + with: + ref: ${{ env.PMM_QA_BRANCH }} + repository: percona/pmm-qa + path: ./ + + - 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: Install playwright + working-directory: ./pmm-ui-tests/cli + run: | + npm ci + + - name: Setup tools + run: | + 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 + wget https://raw.githubusercontent.com/Percona-QA/percona-qa/master/get_download_link.sh + chmod +x get_download_link.sh + + - name: 'Setup : "${{ env.PMM_SERVER_IMAGE }}"' + run: | + docker create -v /srv --name pmm-server-data ${{ env.PMM_SERVER_IMAGE }} + docker run -d -p 80:80 -p 443:443 -p 9000:9000 \ + -e PERCONA_TEST_PLATFORM_ADDRESS=https://check-dev.percona.com:443 \ + -e PERCONA_TEST_PLATFORM_PUBLIC_KEY=RWTg+ZmCCjt7O8eWeAmTLAqW+1ozUbpRSKSwNTmO+exlS5KEIPYWuYdX \ + --volumes-from pmm-server-data --name pmm-server --restart always ${{ env.PMM_SERVER_IMAGE }} + timeout 240 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://127.0.0.1/v1/readyz)" != "200" ]]; do sleep 2; done' || false + + - name: 'Setup PMM Client: <${{ env.PMM_CLIENT_VERSION }}>' + run: sudo -E bash -x ./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 + + - name: 'Run env setup: ${{ inputs.services_list }}' + if: ${{ !!inputs.services_list }} + run: | + sudo -E bash -x ./pmm-tests/pmm-framework.sh ${{ inputs.services_list }} --pmm2 + + - name: 'Run CLI tests: ${{ inputs.cli_test }}' + working-directory: ./pmm-ui-tests/cli + run: npx playwright test ${{ inputs.cli_test }} --quiet + + - name: Generate and Attach the report + if: ${{ failure() && !!inputs.cli_test }} + uses: actions/upload-artifact@v4 + with: + name: "report-${{ matrix.db-type }}" + path: ./pmm-ui-tests/cli/test-report + + - name: Create status check + if: ${{ env.SHA != 'null' && always() }} + uses: percona/gh-action-github-status-action@master + continue-on-error: true + with: + authToken: ${{ secrets.GITHUB_TOKEN }} + context: "${{ matrix.db-type }} CLI 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 }} + diff --git a/.github/workflows/runner-package-test.yml b/.github/workflows/runner-package-test.yml index cc5bd38a..78e672d7 100644 --- a/.github/workflows/runner-package-test.yml +++ b/.github/workflows/runner-package-test.yml @@ -21,6 +21,15 @@ on: description: "expected version" required: false type: string + package: + description: "package for enabling repo" + required: true + default: "pmm2-client" + type: choice + options: + - original + - pmm2-client + - tools # TODO: investigate switch to actual repo name: experimental | testing | main | pmm2-client-main repository: description: "Select Repo to install PMM Client:" @@ -62,6 +71,7 @@ on: - jammy - centos-7 - ol-8 + - noble - ol-9 workflow_call: @@ -79,6 +89,10 @@ on: expected_version: required: false type: string + package: + required: true + default: "pmm2-client" + type: string repository: required: true default: "dev-latest" @@ -99,6 +113,10 @@ on: required: true default: "jammy" type: string + sha: + description: "SHA (leave empty if running manually, default - 'null')" + required: false + type: string jobs: test: @@ -113,6 +131,7 @@ jobs: EXPECTED_VERSION: ${{ inputs.expected_version }} REPO: ${{ inputs.repository || 'dev-latest' }} + INSTALL_PACKAGE: ${{ inputs.package || 'pmm2-client' }} METRICS_MODE: ${{ inputs.metrics_mode || 'auto' }} PLAYBOOK: ${{ inputs.playbook }} VERBOSE: "no" @@ -191,6 +210,9 @@ jobs: if [[ "${{ inputs.os }}" =~ "ol-8" ]]; then echo "VM_BOX=generic/oracle8" >> $GITHUB_ENV fi + if [[ "${{ inputs.os }}" =~ "noble" ]]; then + echo "VM_BOX=bento/ubuntu-24.04" >> $GITHUB_ENV + fi if [[ "${{ inputs.os }}" =~ "ol-9" ]]; then echo "VM_BOX=generic/oracle9" >> $GITHUB_ENV fi @@ -254,6 +276,7 @@ jobs: export METRICS_MODE=${{ env.METRICS_MODE }} export PMM_VERSION="${{ env.EXPECTED_VERSION }}" export install_repo=${{ env.REPO }} + export install_package=${{ env.INSTALL_PACKAGE }} if [[ "${{ env.TARBALL }}" != "null" ]]; then export tarball_link=${{ env.TARBALL }} fi diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml deleted file mode 100644 index dec88eda..00000000 --- a/.github/workflows/testsuite.yml +++ /dev/null @@ -1,13 +0,0 @@ -name: pmm2-testsuite pipeline -on: - # run with default inputs - pull_request: - -jobs: - bats-testsuite: - uses: Percona-Lab/pmm-submodules/.github/workflows/pmm2-testsuite.yml@PMM-2.0 - with: - server_image: ${{ github.event.inputs.server_image || 'perconalab/pmm-server:dev-latest' }} - client_version: ${{ github.event.inputs.client_version || 'dev-latest' }} - client_image: ${{ github.event.inputs.client_image || 'perconalab/pmm-client:dev-latest' }} - pmm_qa_branch: ${{ github.head_ref || 'main' }} diff --git a/.gitignore b/.gitignore index 6f067d2f..086e7b7b 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ pmm-tests/tls-ssl-setup/mongodb/setup* pmm-tests/tls-ssl-setup/postgres/setup* pmm-tests/setup_pgsql_pgsm_*.log pmm-tests/vendor/* +pmm-tests/pmm-2-0-bats-tests/lib/* ps_socket* .DS_Store diff --git a/pmm-tests/client_container_ms_setup.sh b/pmm-tests/client_container_ms_setup.sh index 509b1f43..43fad7ae 100644 --- a/pmm-tests/client_container_ms_setup.sh +++ b/pmm-tests/client_container_ms_setup.sh @@ -51,11 +51,15 @@ if [[ $number_of_nodes == 1 ]];then export db_sandbox=$(dbdeployer sandboxes | awk -F' ' '{print $1}') node_port=`dbdeployer sandboxes --header | grep ${db_version_sandbox} | grep 'group-single-primary' | awk -F'[' '{print $2}' | awk -F' ' '{print $1}'` mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "ALTER USER 'msandbox'@'localhost' IDENTIFIED WITH mysql_native_password BY 'msandbox';" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL innodb_monitor_enable=all;" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%statements%';" else dbdeployer deploy single ${db_version_sandbox} --sandbox-binary=~/ms${ms_version} --remote-access=% --bind-address=0.0.0.0 --force export db_sandbox=$(dbdeployer sandboxes | awk -F' ' '{print $1}') node_port=`dbdeployer sandboxes --header | grep ${db_version_sandbox} | grep 'single' | awk -F'[' '{print $2}' | awk -F' ' '{print $1}'` mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "ALTER USER 'msandbox'@'localhost' IDENTIFIED WITH mysql_native_password BY 'msandbox';" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL innodb_monitor_enable=all;" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%statements%';" if [[ "${query_source}" == "slowlog" ]]; then mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL slow_query_log='ON';" mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL long_query_time=0;" @@ -84,8 +88,10 @@ else dbdeployer deploy multiple ${db_version_sandbox} --sandbox-binary=~/ms${ms_version} --nodes $number_of_nodes --force --remote-access=% --bind-address=0.0.0.0 export db_sandbox=$(dbdeployer sandboxes | awk -F' ' '{print $1}') node_port=`dbdeployer sandboxes --header | grep ${db_version_sandbox} | grep 'multiple' | awk -F'[' '{print $2}' | awk -F' ' '{print $1}'` + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "ALTER USER 'msandbox'@'localhost' IDENTIFIED WITH mysql_native_password BY 'msandbox';" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL innodb_monitor_enable=all;" + mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "UPDATE performance_schema.setup_consumers SET ENABLED = 'YES' WHERE NAME LIKE '%statements%';" for j in `seq 1 $number_of_nodes`; do - mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "ALTER USER 'msandbox'@'localhost' IDENTIFIED WITH mysql_native_password BY 'msandbox';" if [[ "${query_source}" == "slowlog" ]]; then mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL slow_query_log='ON';" mysql -h 127.0.0.1 -u msandbox -pmsandbox --port $node_port -e "SET GLOBAL long_query_time=0;" diff --git a/pmm-tests/pmm-2-0-bats-tests/helm-test.bats b/pmm-tests/pmm-2-0-bats-tests/helm-test.bats deleted file mode 100644 index c70ad7b5..00000000 --- a/pmm-tests/pmm-2-0-bats-tests/helm-test.bats +++ /dev/null @@ -1,238 +0,0 @@ -## pmm k8s helm tests -### needs: helm, kubectl, k8s cluster with snapshotclass, default kubeconfig - -setup() { - - PROJECT_ROOT=$(dirname "$BATS_TEST_FILENAME") - - echo "file name $BATS_TEST_FILENAME" - - source "$PROJECT_ROOT/k8s_helper.sh" - - # set default image from the repo charts or take it as a parameters from CI - IMAGE_REPO=${IMAGE_REPO:-"percona/pmm-server"} - IMAGE_TAG=${IMAGE_TAG:-"2"} -} - -teardown() { - - echo "-------debug info-------" - - kubectl get pods - kubectl describe pod --selector=app.kubernetes.io/name=pmm - kubectl get events --sort-by=lastTimestamp - kubectl logs --all-containers --timestamps --selector=app.kubernetes.io/name=pmm - echo "------------------------" - - echo "--------cleanup---------" - helm list --short | xargs helm uninstall || true - kubectl delete pod,service,statefulset,configmap,secret,serviceaccount,volumesnapshot --selector=app.kubernetes.io/name=pmm --force || true - delete_pvc || true - rm values.yaml || true - echo "------------------------" -} - -@test "add helm repo" { - helm repo add percona https://percona.github.io/percona-helm-charts/ -} - -@test "generate values.yaml" { - helm show values percona/pmm > values.yaml -} - -@test "install/uninstall default chart and check connectivity" { - helm install pmm \ - --set image.repository=$IMAGE_REPO \ - --set image.tag=$IMAGE_TAG \ - --wait \ - percona/pmm - wait_for_pmm - - # depends on the driver, but probably local PVC wouldn't be cleaned up - # and pass would be set only during this first pvc init - # so always use new name if you want to provision PVC in helm install (pmmX) - local admin_pass=$(get_pmm_pswd) - local pmm_address=$(get_pmm_addr) - - #encode pass, as it can have special characters - local encoded_u_p=$(echo -n admin:${admin_pass} | base64) - - echo "curl -k -H 'Authorization: Basic ...' https://"${pmm_address}"/v1/version" - #echo admin pass in case there are some issues with it - echo "pass:${admin_pass}" - - run bash -c "curl -sk -H 'Authorization: Basic ${encoded_u_p}' https://${pmm_address}/v1/version" - echo $output - [ "$status" -eq 0 ] - echo "${output}" | grep "full_version" - - - helm uninstall --wait --timeout 60s pmm - delete_pvc -} - -@test "install/uninstall with parameter set in cli" { - helm install pmm1 \ - --set image.repository=$IMAGE_REPO \ - --set image.tag=$IMAGE_TAG \ - --set-string pmmEnv.ENABLE_DBAAS="1" \ - --set service.type="NodePort" \ - --wait \ - percona/pmm - wait_for_pmm - - # this returns 1 with k8s>1.24, but will return 2 with k8s<1.24 - run bash -c "kubectl get sa pmm-service-account -o json | jq '.secrets|length'" - [ "$output" = "1" ] || [ "$output" = "2" ] - - helm uninstall --wait --timeout 60s pmm1 - delete_pvc -} - -@test "install/uninstall chart with default values from file" { - helm show values percona/pmm > values.yaml - - sed -i "s|tag: .*|tag: \"$IMAGE_TAG\"|g" values.yaml - sed -i "s|repository:.*|repository: $IMAGE_REPO|g" values.yaml - - helm install pmm -f values.yaml --wait percona/pmm - wait_for_pmm - - helm uninstall --wait --timeout 60s pmm - delete_pvc -} - -@test "install/uninstall chart with values from file and update pmm" { - helm show values percona/pmm > values.yaml - - sed -i "s|tag: .*|tag: \"$IMAGE_TAG\"|g" values.yaml - sed -i "s|repository:.*|repository: $IMAGE_REPO|g" values.yaml - - helm install pmm3 -f values.yaml --wait percona/pmm - wait_for_pmm - - sed -i "s|tag: .*|tag: \"dev-latest\"|g" values.yaml - sed -i "s|repository:.*|repository: perconalab/pmm-server|g" values.yaml - - helm upgrade pmm3 -f values.yaml percona/pmm - sleep 7 # give a chance to update manifest - wait_for_pmm - - local new_ver=$(kubectl get pod --selector=app.kubernetes.io/name=pmm -o jsonpath="{.items[*].spec.containers[*].image}") - - if [ "$new_ver" != "perconalab/pmm-server:dev-latest" ]; then - echo "Unexpected version: $new_ver , should be 'perconalab/pmm-server:dev-latest'" - cat values.yaml - false - fi - - helm uninstall --wait --timeout 60s pmm3 - delete_pvc -} - -@test "Backup and restore test" { - - cat << EOF | kubectl create -f - -apiVersion: v1 -kind: Secret -metadata: - name: pmm-secret - labels: - app.kubernetes.io/name: "pmm" -type: Opaque -data: -# base64 encoded password -# encode some password: `echo -n "admin" | base64` - PMM_ADMIN_PASSWORD: YWRtaW4= -EOF - - local some_old_version=2.33.0 - - helm install pmm4 \ - --set image.tag=$some_old_version \ - --set secret.create=false \ - --set secret.name=pmm-secret \ - --wait \ - percona/pmm - wait_for_pmm - - local admin_pass=$(get_pmm_pswd) - local pmm_address=$(get_pmm_addr) - local encoded_u_p=$(echo -n admin:${admin_pass} | base64) - - ### -------- Backup - - kubectl scale statefulset pmm4 --replicas=0 - kubectl wait --for=jsonpath='{.status.replicas}'=0 statefulset pmm4 - - cat << EOF | kubectl create -f - -apiVersion: snapshot.storage.k8s.io/v1 -kind: VolumeSnapshot -metadata: - name: before-upgrade-from-v$some_old_version - labels: - app.kubernetes.io/name: "pmm" -spec: - volumeSnapshotClassName: csi-hostpath-snapclass - source: - persistentVolumeClaimName: pmm-storage-pmm4-0 -EOF - - kubectl wait --for=jsonpath='{.status.readyToUse}'=true VolumeSnapshot/before-upgrade-from-v$some_old_version --timeout=5m - kubectl scale statefulset pmm4 --replicas=1 - - kubectl get volumesnapshot - - ### -------- Upgrade - - helm upgrade pmm4 \ - --set image.repository=$IMAGE_REPO \ - --set image.tag=$IMAGE_TAG \ - --set secret.create=false \ - --set secret.name=pmm-secret \ - --wait \ - percona/pmm - wait_for_pmm - - admin_pass=$(get_pmm_pswd) - pmm_address=$(get_pmm_addr) - encoded_u_p=$(echo -n admin:${admin_pass} | base64) - - run bash -c "curl -sk -H 'Authorization: Basic ${encoded_u_p}' https://${pmm_address}/v1/version | jq .version" - echo "New version: $output" - [ "$status" -eq 0 ] - - [ "${output//\"}" = "$IMAGE_TAG" ] || [ "$IMAGE_TAG" = "2" ] - - helm uninstall --wait --timeout 60s pmm4 - - ### -------- Restore - - helm install pmm5 \ - --set image.tag=$some_old_version \ - --set storage.name="pmm-storage-old" \ - --set storage.dataSource.name="before-upgrade-from-v$some_old_version" \ - --set storage.dataSource.kind="VolumeSnapshot" \ - --set storage.dataSource.apiGroup="snapshot.storage.k8s.io" \ - --set secret.create=false \ - --set secret.name=pmm-secret \ - percona/pmm - wait_for_pmm - - admin_pass=$(get_pmm_pswd) - pmm_address=$(get_pmm_addr) - encoded_u_p=$(echo -n admin:${admin_pass} | base64) - - run bash -c "curl -sk -H 'Authorization: Basic ${encoded_u_p}' https://${pmm_address}/v1/version | jq .version" - echo "Old version: $output" - [ "$status" -eq 0 ] - - [ "${output//\"}" = "$some_old_version" ] - - helm uninstall --wait --timeout 60s pmm5 - - kubectl delete secret pmm-secret - kubectl delete volumesnapshot --selector=app.kubernetes.io/name=pmm - kubectl wait --for=delete --selector=app.kubernetes.io/name=pmm volumesnapshot --timeout=5m - delete_pvc -} diff --git a/pmm-tests/pmm-2-0-bats-tests/k8s/helm-test.bats b/pmm-tests/pmm-2-0-bats-tests/k8s/helm-test.bats new file mode 100644 index 00000000..8e2f34fa --- /dev/null +++ b/pmm-tests/pmm-2-0-bats-tests/k8s/helm-test.bats @@ -0,0 +1,177 @@ +## pmm k8s helm tests +### needs: helm, kubectl, k8s cluster with snapshotclass, default kubeconfig +## add comment #bats test_tags=bats:focus above the test to focus it + +cleanup () { + echo "--------cleanup---------" + helm list --short | xargs helm uninstall || true + kubectl delete pod,service,statefulset,configmap,secret,serviceaccount,volumesnapshot --selector=app.kubernetes.io/name=pmm --force || true + delete_pvc || true + rm values.yaml || true + echo "------------------------" +} + +setup() { + echo "Running setup" + PROJECT_ROOT=$(dirname "$BATS_TEST_FILENAME") + echo "Project root: $PROJECT_ROOT" + source "$PROJECT_ROOT/k8s_helper.sh" + source "$PROJECT_ROOT/pmm_helper.sh" + IMAGE_REPO=${IMAGE_REPO:-"perconalab/pmm-server"} + IMAGE_TAG=${IMAGE_TAG:-"dev-latest"} + RELEASE_REPO="percona/pmm-server" + RELEASE_TAG="2" + + cleanup +} + +teardown() { + echo "Running teardown" + echo "-------debug info-------" + kubectl get pods + kubectl describe pod --selector=app.kubernetes.io/name=pmm + kubectl get events --sort-by=lastTimestamp + kubectl logs --all-containers --timestamps --selector=app.kubernetes.io/name=pmm + echo "------------------------" + + cleanup +} + +# Helper function to trim whitespace +trim() { + local var="$*" + # remove leading whitespace characters + var="${var#"${var%%[![:space:]]*}"}" + # remove trailing whitespace characters + var="${var%"${var##*[![:space:]]}"}" + echo -n "$var" +} + +# Function to update values.yaml based on the OS +update_values_yaml() { + local property=$1 + local value=$2 + + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + # Linux + sed -i "s|$property: .*|$property: \"$value\"|g" values.yaml + elif [[ "$OSTYPE" == "darwin"* ]]; then + # macOS + sed -i '' "s|$property: .*|$property: \"$value\"|g" values.yaml + else + echo "Unsupported OS: $OSTYPE" + return 1 + fi +} + + +@test "add helm repo" { + helm repo add percona https://percona.github.io/percona-helm-charts/ +} + +@test "generate values.yaml" { + helm show values percona/pmm > values.yaml +} + +@test "install/uninstall default chart and check connectivity" { + stop_port_forward + helm install pmm \ + --set image.repository=$IMAGE_REPO \ + --set image.tag=$IMAGE_TAG \ + --wait \ + percona/pmm + + wait_for_pmm + start_port_forward + + pmm_version=$(get_pmm_version) + echo "pmm_version is ${pmm_version}" + + stop_port_forward + helm uninstall --wait --timeout 60s pmm + # maybe pmm uninstall has ability to kill pvcs + # add validation that there is no load balancer, stateful set and containers/pods left + delete_pvc +} + +@test "install/uninstall with parameter set in cli" { + stop_port_forward + local instance_name="pmm1" + helm install $instance_name \ + --set image.repository=$IMAGE_REPO \ + --set image.tag=$IMAGE_TAG \ + --set-string pmmEnv.ENABLE_DBAAS="1" \ + --set service.type="NodePort" \ + --wait \ + percona/pmm + wait_for_pmm + + start_port_forward + + result=$(get_env_variable $instance_name "ENABLE_DBAAS") + trimmed_result=$(trim "$result") + assert_equal "$trimmed_result" "1" + + pmm_version=$(get_pmm_version) + echo "pmm_version is ${pmm_version}" + + stop_port_forward + # add check that pmm is working and env var was set + + helm uninstall --wait --timeout 60s pmm1 + delete_pvc +} + +@test "install/uninstall chart with file" { + stop_port_forward + helm show values percona/pmm > values.yaml + + update_values_yaml "tag" "$IMAGE_TAG" + update_values_yaml "repository" "$IMAGE_REPO" + + helm install pmm -f values.yaml --wait percona/pmm + wait_for_pmm + start_port_forward + + pmm_version=$(get_pmm_version) + echo "pmm_version is ${pmm_version}" + + helm uninstall --wait --timeout 60s pmm + delete_pvc +} + +@test "install/uninstall chart with values from file and update pmm from last released version" { + stop_port_forward + helm show values percona/pmm > values.yaml + + update_values_yaml "tag" "$RELEASE_TAG" + update_values_yaml "repository" "$RELEASE_REPO" + + helm install pmm3 -f values.yaml --wait percona/pmm + wait_for_pmm + start_port_forward + + pmm_version=$(get_pmm_version) + echo "pmm_version is ${pmm_version}" + + update_values_yaml "tag" "$IMAGE_TAG" + update_values_yaml "repository" "$IMAGE_REPO" + + helm upgrade pmm3 -f values.yaml percona/pmm + sleep 7 # give a chance to update manifest + wait_for_pmm + + pmm_version=$(get_pmm_version) + + local new_ver=$(kubectl get pod --selector=app.kubernetes.io/name=pmm -o jsonpath="{.items[*].spec.containers[*].image}") + + if [ "$new_ver" != "$IMAGE_REPO:$IMAGE_TAG" ]; then + echo "Unexpected version: $new_ver , should be '$IMAGE_REPO:$IMAGE_TAG'" + cat values.yaml + false + fi + + stop_port_forward + helm uninstall --wait --timeout 60s pmm3 + delete_pvc +} diff --git a/pmm-tests/pmm-2-0-bats-tests/k8s/k8s_helper.sh b/pmm-tests/pmm-2-0-bats-tests/k8s/k8s_helper.sh new file mode 100644 index 00000000..f4a023c0 --- /dev/null +++ b/pmm-tests/pmm-2-0-bats-tests/k8s/k8s_helper.sh @@ -0,0 +1,39 @@ +wait_for_pmm(){ + sleep 5 + kubectl wait --for=condition=Ready --selector=app.kubernetes.io/name=pmm pod --timeout=5m +} + +delete_pvc(){ + kubectl delete pvc --selector=app.kubernetes.io/name=pmm + kubectl wait --for=delete --selector=app.kubernetes.io/name=pmm pvc --timeout=5m +} + +get_pmm_pswd(){ + kubectl get secret pmm-secret -o jsonpath='{.data.PMM_ADMIN_PASSWORD}' | base64 --decode +} + +# Function to start port forwarding +start_port_forward(){ + POD_NAME=$(kubectl get pods -n default -l app.kubernetes.io/name=pmm -o jsonpath='{.items[0].metadata.name}') + kubectl port-forward $POD_NAME 8443:443 -n default & + PORT_FORWARD_PID=$! + echo $PORT_FORWARD_PID > port_forward.pid + sleep 5 # Give port forwarding some time to set up +} + +# Function to stop port forwarding +stop_port_forward(){ + if [ -f port_forward.pid ]; then + PORT_FORWARD_PID=$(cat port_forward.pid) + kill $PORT_FORWARD_PID || true + rm port_forward.pid + fi +} + +# Retrieves the value of a specified environment variable from the first pod of a given Kubernetes instance. +get_env_variable(){ + local instance_name=$1 + local env_var=$2 + local pod_name=$(kubectl get pods -l app.kubernetes.io/instance=$instance_name -o jsonpath='{.items[0].metadata.name}') + kubectl exec -it $pod_name -- printenv $env_var +} diff --git a/pmm-tests/pmm-2-0-bats-tests/k8s/pmm_helper.sh b/pmm-tests/pmm-2-0-bats-tests/k8s/pmm_helper.sh new file mode 100644 index 00000000..a705b760 --- /dev/null +++ b/pmm-tests/pmm-2-0-bats-tests/k8s/pmm_helper.sh @@ -0,0 +1,34 @@ + +load "../lib/bats-support/load" # Load BATS support libraries +load "../lib/bats-assert/load" # Load BATS assertions + +get_pmm_addr(){ + local node_port=8443 + local node_ip=127.0.0.1 + echo $node_ip:$node_port +} + +get_pmm_version() { + # depends on the driver, but probably local PVC wouldn't be cleaned up + # and pass would be set only during this first pvc init + # so always use new name if you want to provision PVC in helm install (pmmX) + admin_pass=$(get_pmm_pswd) + pmm_address=$(get_pmm_addr) + + # encode pass, as it can have special characters + encoded_u_p=$(echo -n admin:${admin_pass} | base64) + + echo "curl -k -H 'Authorization: Basic ...' https://"${pmm_address}"/v1/version" + # echo admin pass in case there are some issues with it + echo "pass:${admin_pass}" + + run bash -c "curl -sk -H 'Authorization: Basic ${encoded_u_p}' https://${pmm_address}/v1/version | jq .version" + assert_success + + # Check that the pmm_version string is not empty + if [[ -z "${output}" ]]; then + fail "pmm_version is empty" + fi + + echo $output +} diff --git a/pmm-tests/pmm-2-0-bats-tests/k8s_helper.sh b/pmm-tests/pmm-2-0-bats-tests/k8s_helper.sh deleted file mode 100644 index d4796aa4..00000000 --- a/pmm-tests/pmm-2-0-bats-tests/k8s_helper.sh +++ /dev/null @@ -1,23 +0,0 @@ -wait_for_pmm() -{ - sleep 5 - kubectl wait --for=condition=Ready --selector=app.kubernetes.io/name=pmm pod --timeout=5m -} - -delete_pvc() -{ - kubectl delete pvc --selector=app.kubernetes.io/name=pmm - kubectl wait --for=delete --selector=app.kubernetes.io/name=pmm pvc --timeout=5m -} - -get_pmm_pswd() -{ - kubectl get secret pmm-secret -o jsonpath='{.data.PMM_ADMIN_PASSWORD}' | base64 --decode -} - -get_pmm_addr() -{ - local node_port=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services monitoring-service) - local node_ip=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}") - echo $node_ip:$node_port -} diff --git a/pmm-tests/pmm-2-0-bats-tests/setup_bats_libs.sh b/pmm-tests/pmm-2-0-bats-tests/setup_bats_libs.sh new file mode 100755 index 00000000..28401bfa --- /dev/null +++ b/pmm-tests/pmm-2-0-bats-tests/setup_bats_libs.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +# Define the directory where the libraries will be cloned +LIBS_DIR="lib" + +# Create the directory if it doesn't exist +mkdir -p $LIBS_DIR + +# Clone bats-support +if [ ! -d "$LIBS_DIR/bats-support" ]; then + git clone https://github.com/bats-core/bats-support.git $LIBS_DIR/bats-support +else + echo "bats-support is already present." +fi + +# Clone bats-assert +if [ ! -d "$LIBS_DIR/bats-assert" ]; then + git clone https://github.com/bats-core/bats-assert.git $LIBS_DIR/bats-assert +else + echo "bats-assert is already present." +fi + +echo "BATS libraries setup completed." diff --git a/pmm-tests/pmm2-client-setup.sh b/pmm-tests/pmm2-client-setup.sh index abb1b2c8..7038b50c 100755 --- a/pmm-tests/pmm2-client-setup.sh +++ b/pmm-tests/pmm2-client-setup.sh @@ -36,6 +36,10 @@ if [ -z "$use_metrics_mode" ]; then export use_metrics_mode=yes fi +if [ ! -z "$upgrade" ]; then + upgrade="-u" +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 @@ -45,13 +49,13 @@ 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 + percona-release enable-only pmm2-client experimental apt-get update apt-get -y install pmm2-client fi if [[ "$client_version" == "pmm2-rc" ]]; then - percona-release enable-only original testing + percona-release enable-only pmm2-client testing apt-get update apt-get -y install pmm2-client fi @@ -59,56 +63,61 @@ fi if [[ "$client_version" == "pmm2-latest" ]]; then apt-get -y install pmm2-client apt-get -y update - percona-release enable-only original experimental + percona-release enable-only pmm2-client 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} +if [[ "$client_version" == 2* ]]; then + wget -O pmm2-client.deb https://repo.percona.com/pmm2-client/apt/pool/main/p/pmm2-client/pmm2-client_${client_version}-6.$(lsb_release -sc)_amd64.deb + dpkg -i pmm2-client.deb fi +## Default Binary path +path="/usr/local/percona/pmm2"; +## As export PATH is not working link the paths +ln -sf ${path}/bin/pmm-admin /usr/local/bin/pmm-admin +ln -sf ${path}/bin/pmm-agent /usr/local/bin/pmm-agent + if [[ "$client_version" == http* ]]; then - if [[ "$install_client" == "yes" ]]; then - wget -O pmm2-client.tar.gz --progress=dot:giga "${client_version}" - fi + if [[ "$install_client" == "yes" ]]; then + wget -O pmm2-client.tar.gz --progress=dot:giga "${client_version}" + fi tar -zxpf pmm2-client.tar.gz rm -r pmm2-client.tar.gz - export PMM2_CLIENT=`ls -1td pmm2-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1` + PMM2_CLIENT=`ls -1td pmm2-client* 2>/dev/null | grep -v ".tar" | grep -v ".sh" | head -n1` echo ${PMM2_CLIENT} + rm -rf pmm2-client mv ${PMM2_CLIENT} pmm2-client - mv pmm2-client /usr/local/bin + rm -rf /usr/local/bin/pmm2-client + mv -f pmm2-client /usr/local/bin pushd /usr/local/bin/pmm2-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 + bash -x ./install_tarball ${upgrade} pwd popd pmm-admin --version +fi + +## Check if we are upgrading or attempting fresh install. +if [[ -z "$upgrade" ]]; then 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" + echo "setup pmm-agent" 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" + else + echo "setup pmm-agent" 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 & + pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml > pmm-agent.log 2>&1 & + sleep 10 +else + pid=`ps -ef | grep pmm-agent | grep -v grep | awk -F ' ' '{print $2}'` + if [[ ! -z "$pid" ]]; then + kill -9 $pid + echo "Killing and restarting pmm agent...." + pmm-agent --config-file=/usr/local/percona/pmm2/config/pmm-agent.yaml >> pmm-agent.log 2>&1 & + sleep 10 + fi fi -sleep 10 - echo "pmm-admin status" pmm-admin status diff --git a/pmm-tests/psmdb_setup.yml b/pmm-tests/psmdb_setup.yml index d051a471..b61f5c4d 100644 --- a/pmm-tests/psmdb_setup.yml +++ b/pmm-tests/psmdb_setup.yml @@ -1,6 +1,8 @@ --- - hosts: all + become: true + become_method: sudo vars: psmdb_version: "{{ lookup('vars', 'extra_psmdb_version', default=lookup('env','PSMDB_VERSION') | default('4.4', true) ) }}" psmdb_tarball: "{{ lookup('vars', 'extra_psmdb_tarball', default=lookup('env','PSMDB_TARBALL') | default('', true) ) }}" @@ -46,7 +48,7 @@ - name: Setup psmdb for monitoring shell: "{{ item }}" with_items: - - docker exec {{ psmdb_container }} bash -x ./psmdb_setup.sh --mongodb_version {{ psmdb_version }} --mongodb_setup {{ psmdb_setup }} > ~/setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log + - docker exec {{ psmdb_container }} bash -x ./psmdb_setup.sh --mongodb_version {{ psmdb_version }} --mongodb_setup {{ psmdb_setup }} > setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log - name: Setup Load Running Docker Container shell: "{{ item }}" @@ -62,20 +64,26 @@ shell: docker exec {{ psmdb_container }} ./nodes/cl.sh mongodb_user_setup.js when: psmdb_setup == "regular" - - name: Run load on Replica Set Master + - name: Run load on Replica Set Master (PSS) shell: "{{ item }}" with_items: - - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27018 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php - when: psmdb_setup == "replica" or psmdb_setup == "arbiter" + - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27018 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php >> setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log + when: psmdb_setup == "replica" + + - name: Run load on Replica Set Master (PSA) + shell: "{{ item }}" + with_items: + - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27018 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 -e MONGODB_USER="dba" -e MONGODB_PASSWORD="test1234" --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php >> setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log + when: psmdb_setup == "arbiter" - name: Run load on Regular shell: "{{ item }}" with_items: - - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27017 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php + - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27017 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php >> setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log when: psmdb_setup == "regular" - name: Run load on Sharded Clusters Master shell: "{{ item }}" with_items: - - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27019 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php + - docker run --name mongodb_load_{{ psmdb_version }}_{{ psmdb_setup }} -d -e MONGODB_HOST={{ psmdb_container }} -e MONGODB_PORT=27019 -e TEST_TARGET_QPS=10 -e TEST_COLLECTION=10 -e TEST_DB=30 --network=pmm-qa -v $(pwd):/usr/src/myapp -w /usr/src/myapp php-db php mongodb_query.php >> setup_psmdb_{{ psmdb_version }}_{{ psmdb_setup }}.log when: psmdb_setup == "sharded" diff --git a/pmm-tests/tls-ssl-setup/mysql/mysql_ssl_setup.sh b/pmm-tests/tls-ssl-setup/mysql/mysql_ssl_setup.sh index 69db1dcd..388f1767 100644 --- a/pmm-tests/tls-ssl-setup/mysql/mysql_ssl_setup.sh +++ b/pmm-tests/tls-ssl-setup/mysql/mysql_ssl_setup.sh @@ -89,4 +89,5 @@ fi service mysql restart mysql -e "create user pmm@'%' identified by \"pmm\"" mysql -e "grant all on *.* to pmm@'%'" +mysql -e "CREATE USER 'pmm_tls'@'%' REQUIRE X509" service mysql restart