Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/PMM-2.0' into PMM-7-fb-test-latest
Browse files Browse the repository at this point in the history
  • Loading branch information
tshcherban committed Jan 3, 2023
2 parents 89fa94a + afec90e commit 8eabde0
Show file tree
Hide file tree
Showing 20 changed files with 625 additions and 55 deletions.
5 changes: 2 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
/build/ @nikita-b
ci-default.yml @nikita-b
ci.py @nikita-b
ci-default.yml @talhabinrizwan
ci.py @talhabinrizwan
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
https://jira.percona.com/browse/PMM-0

- [ ] Links to other linked pull requests.
- [ ] Links to relevant pull requests
38 changes: 19 additions & 19 deletions .github/workflows/jenkins-dispatch.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
on:
on:
workflow_dispatch:
inputs:
server_image:
description: 'server image: repo/name:tag'
description: "server image: repo/name:tag"
required: true
type: string
type: string
client_image:
description: 'client image: repo/name:tag'
required: true
description: "client image: repo/name:tag"
required: true
type: string
sha:
description: 'commit sha to report status'
description: "commit sha to report status"
required: false
type: string

jobs:

helm-tests:
runs-on: ubuntu-latest
env:
WORK_DIR: /home/runner/work/pmm-submodules/pmm-submodules/sources/pmm-qa/src/github.com/percona/pmm-qa/pmm-tests
WORK_DIR: sources/pmm-qa/src/github.com/percona/pmm-qa/pmm-tests
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}

steps:

- name: checkout code
uses: percona-platform/checkout@v3
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'recursive'
submodules: "recursive"

- name: install npm
uses: percona-platform/setup-node@v3
with:
node-version: '14'
- name: run ci.py
run: |
pip3 install PyGithub
pip3 install GitPython
python3 ci.py
- name: install tools
run: |
npm install -g bats
$WORK_DIR/install_k8s_tools.sh --minikube --helm --kubectl --user
- name: minikube_start
- name: Start minikube
run: |
minikube start
kubectl wait --for=condition=Ready node --timeout=90s minikube
- name: helm_tests
- name: Run helm tests
run: |
echo $(git submodule status)
cd $WORK_DIR
export IMAGE_REPO=$(echo $SERVER_IMAGE | cut -d ':' -f 1)
export IMAGE_TAG=$(echo $SERVER_IMAGE | cut -d ':' -f 2)
bats --tap pmm-2-0-bats-tests/helm-test.bats
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/pmm-cli.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
on:
workflow_dispatch:
inputs:
client_tar_url:
description: 'client tar url'
required: true
type: string
sha:
description: 'commit sha to report status'
required: false
type: string

jobs:
pmm-cli:
name: 'PMM binary CLI tests'
runs-on: ubuntu-20.04
env:
CLIENT_TAR_URL: ${{ github.event.inputs.client_tar_url }}
WORK_DIR: sources/pmm/src/github.com/percona/pmm/cli-tests
GH_API_TOKEN: ${{ secrets.GH_API_TOKEN }}

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Run ci.py
run: |
pip3 install PyGithub
pip3 install GitPython
python3 ci.py
- name: Set Client tar name env variable
run: echo "PMM_CLIENT_TAR=$(echo ${{ env.CLIENT_TAR_URL }} | grep -o '[^/]*$')" >> $GITHUB_ENV

- name: Download client
run: |
sudo wget ${{ env.CLIENT_TAR_URL }}
- name: Unzip client
run: |
tar -xzf ${{ env.PMM_CLIENT_TAR }}
echo "PMM_CLIENT_BASEDIR=$(ls -1td pmm2-client-* 2>/dev/null | grep -v ".tar" | head -n1)" >> $GITHUB_ENV
- name: Rename client folder
run: mv ${{ env.PMM_CLIENT_BASEDIR }} pmm2-client

- name: Check pmm version output
working-directory: pmm2-client
run: |
echo "export PATH=$PATH:$PWD/bin" >> ~/.bash_profile
source ~/.bash_profile
pmm --version
- name: Install Dependencies
working-directory: ${{ env.WORK_DIR }}
run: npm ci

- name: Run tests
working-directory: ${{ env.WORK_DIR }}
run: |
source ~/.bash_profile
npm run test:pmm-cli
- name: Create status check
if: ${{ github.event.inputs.sha && always() }}
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="PMM binary CLI Tests $STATUS" \
-f context='actions/workflows/pmm-cli'
# - name: Setup tmate session on failure
# if: ${{ failure() }}
# uses: percona-platform/action-tmate@v2
215 changes: 215 additions & 0 deletions .github/workflows/pmm2-testsuite.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
name: pmm2-testsuite pipeline
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
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
sha:
description: "SHA (leave empty if running manually, default - 'null')"
required: false
type: string

jobs:
bats-testsuite:
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' }}
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' }}
PMM_QA_GIT_BRANCH: ${{ github.event.inputs.pmm_qa_branch || inputs.pmm_qa_branch || 'main' }}
SHA: ${{ github.event.inputs.sha || inputs.sha || 'null' }}
strategy:
fail-fast: false
matrix:
db-type: [ps5.7, ps8, pdpgsql13, pdpgsql14, pdpgsql15, modb4.4, modb5, modb6, generic, clientContainer, haproxy, proxysql, ms8.0]

steps:
- name: Create status check
if: ${{ env.SHA != 'null' }}
uses: percona-platform/github-status-action@v1
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@v3
with:
ref: ${{ env.PMM_QA_BRANCH }}
repository: percona/pmm-qa
path: ./

- name: Setup tools
run: |
npm install -g bats
sudo apt-get install -y apt-transport-https ca-certificates dirmngr ansible libaio1 libaio-dev libnuma-dev libncurses5 socat sysbench
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 8919F6BD2B48D754
echo "deb https://packages.clickhouse.com/deb stable main" | sudo tee \
/etc/apt/sources.list.d/clickhouse.list
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 }}
sleep 30
- 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: Run Setup for ps5.7
if: ${{ matrix.db-type == 'ps5.7' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=ps,1 --ps-version=5.7 --pmm2

- name: Run Setup for ps8.0
if: ${{ matrix.db-type == 'ps8' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=ps,1 --ps-version=8 --pmm2

- name: Run bats tests for PS
if: ${{ matrix.db-type == 'ps5.7' || matrix.db-type == 'ps8' }}
run: sudo bats ./pmm-tests/pmm-2-0-bats-tests/ps-specific-tests.bats

- name: Run Setup for pdpgsql 13
if: ${{ matrix.db-type == 'pdpgsql13' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=pdpgsql,1 --pdpgsql-version=13 --pmm2

- name: Run Setup for pdpgsql 14
if: ${{ matrix.db-type == 'pdpgsql14' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=pdpgsql,1 --pdpgsql-version=14 --pmm2

- name: Run Setup for pdpgsql 15.0
if: ${{ matrix.db-type == 'pdpgsql15' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=pdpgsql,1 --pdpgsql-version=15.0 --pmm2

- name: Run bats tests for PDPGSQL
if: ${{ matrix.db-type == 'pdpgsql13' || matrix.db-type == 'pdpgsql14' || matrix.db-type == 'pdpgsql15' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/pdpgsql-tests.bats
sudo bats ./pmm-tests/pmm-2-0-bats-tests/pgsql-specific-tests.bats
- name: Run Setup for PSMDB 4.4
if: ${{ matrix.db-type == 'modb4.4' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=modb,1 --modb-version=4.4 --pmm2

- name: Run Setup for PSMDB 5
if: ${{ matrix.db-type == 'modb5' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=modb,1 --modb-version=5 --pmm2

- name: Run Setup for PSMDB 6
if: ${{ matrix.db-type == 'modb6' }}
run: sudo -E bash -x ./pmm-tests/pmm-framework.sh --addclient=modb,1 --modb-version=6 --pmm2

- name: Run bats tests for PSMDB
if: ${{ matrix.db-type == 'modb6' || matrix.db-type == 'modb5' || matrix.db-type == 'modb4.4' }}
run: sudo bats ./pmm-tests/pmm-2-0-bats-tests/modb-tests.bats

- name: Run Setup Generic Tests, Including 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 bats tests for generic Scenarios
if: ${{ matrix.db-type == 'generic' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/generic-tests.bats
sudo bats ./pmm-tests/pmm-2-0-bats-tests/docker-env-variable-tests.bats
- name: Run bats tests for Client Container Scenarios
if: ${{ matrix.db-type == 'clientContainer' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/pmm-client-docker-tests.bats
sudo bats ./pmm-tests/pmm-2-0-bats-tests/pmm-admin-unregister-tests.bats
- 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 bats tests for Client Container Scenarios
if: ${{ matrix.db-type == 'haproxy' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/haproxy-tests.bats
- 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 bats tests for ProxySQL
if: ${{ matrix.db-type == 'proxysql' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/proxysql-specific-tests.bats
- name: Run Setup for MySQL
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 bats tests for MySQL Tests
if: ${{ matrix.db-type == 'ms8.0' }}
run: |
sudo bats ./pmm-tests/pmm-2-0-bats-tests/ms-specific-tests.bats
- name: Create status check
if: ${{ always() }}
uses: percona-platform/github-status-action@v1
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 }}
Loading

0 comments on commit 8eabde0

Please sign in to comment.