Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PMM-13607: Add status check to pmm 3 nightly job #3074

Merged
merged 13 commits into from
Dec 19, 2024
68 changes: 53 additions & 15 deletions pmm/v3/pmm3-ui-tests-nightly.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ void runStagingServer(String DOCKER_VERSION, CLIENT_VERSION, CLIENTS, CLIENT_INS
env.VM_NAME = stagingJob.buildVariables.VM_NAME
def clientInstance = "yes";
if ( CLIENT_INSTANCE == clientInstance ) {
env.PMM_URL = "http://admin:${ADMIN_PASSWORD}@${SERVER_IP}"
env.PMM_URL = "https://admin:${ADMIN_PASSWORD}@${SERVER_IP}"
env.PMM_UI_URL = "http://${SERVER_IP}/"
}
else
{
env.PMM_URL = "http://admin:${ADMIN_PASSWORD}@${VM_IP}"
env.PMM_URL = "https://admin:${ADMIN_PASSWORD}@${VM_IP}"
env.PMM_UI_URL = "http://${VM_IP}/"
}
}
Expand Down Expand Up @@ -107,6 +107,24 @@ void destroyStaging(IP) {
string(name: 'VM', value: IP),
]
}

void checkClientNodesAgentStatus(String VM_CLIENT_IP, PMM_QA_GIT_BRANCH) {
withCredentials([sshUserPrivateKey(credentialsId: 'aws-jenkins', keyFileVariable: 'KEY_PATH', passphraseVariable: '', usernameVariable: 'USER')]) {
sh """
ssh -i "${KEY_PATH}" -o ConnectTimeout=1 -o StrictHostKeyChecking=no ${USER}@${VM_CLIENT_IP} '
set -o errexit
set -o xtrace
echo "Checking Agent Status on Client Nodes";
sudo mkdir -p /srv/pmm-qa || :
sudo git clone --single-branch --branch $PMM_QA_GIT_BRANCH https://github.com/percona/pmm-qa.git /srv/pmm-qa
sudo chmod -R 755 /srv/pmm-qa
sudo chmod 755 /srv/pmm-qa/pmm-tests/agent_status.sh
bash -xe /srv/pmm-qa/pmm-tests/agent_status.sh
'
"""
}
}

pipeline {
agent {
label 'min-focal-x64'
Expand Down Expand Up @@ -198,11 +216,11 @@ pipeline {
description: 'MySQL Community Server version',
name: 'MS_VERSION')
choice(
choices: ['16', '17', '15', '14', '13'],
choices: ['17', '16', '15', '14', '13'],
description: "Which version of PostgreSQL",
name: 'PGSQL_VERSION')
choice(
choices: ['16', '17', '15', '14', '13'],
choices: ['17', '16', '15','14', '13'],
description: 'Percona Distribution for PostgreSQL',
name: 'PDPGSQL_VERSION')
choice(
Expand Down Expand Up @@ -234,6 +252,7 @@ pipeline {
sudo mkdir -p /srv/qa-integration || :
sudo git clone --single-branch --branch \${PMM_QA_GIT_BRANCH} https://github.com/Percona-Lab/qa-integration.git /srv/qa-integration
sudo chmod -R 755 /srv/qa-integration
'''
}
}
Expand Down Expand Up @@ -322,22 +341,41 @@ pipeline {
sleep 300
}
}
stage('Run Tests') {
stage('Check agent status') {
parallel {
stage('Run UI - Tests') {
options {
timeout(time: 150, unit: "MINUTES")
stage('Check Agent Status on ps single and mongo pss') {
steps {
checkClientNodesAgentStatus(env.VM_CLIENT_IP_MYSQL, env.PMM_QA_GIT_BRANCH)
}
}
stage('Check Agent Status on ps & replication node') {
steps {
checkClientNodesAgentStatus(env.VM_CLIENT_IP_PS_GR, env.PMM_QA_GIT_BRANCH)
}
}
stage('Check Agent Status on ms/md/pxc node') {
steps {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'PMM_AWS_DEV', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh """
sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js
export PWD=\$(pwd);
npx codeceptjs run --reporter mocha-multi -c pr.codecept.js --grep '@qan|@nightly|@menu'
"""
}
checkClientNodesAgentStatus(env.VM_CLIENT_IP_PXC, env.PMM_QA_GIT_BRANCH)
}
}
stage('Check Agent Status on postgresql node') {
steps {
checkClientNodesAgentStatus(env.VM_CLIENT_IP_PGSQL, env.PMM_QA_GIT_BRANCH)
}
}
}
}
stage('Run UI Tests') {
options {
timeout(time: 150, unit: "MINUTES")
}
steps {
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'PMM_AWS_DEV', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
sh """
sed -i 's+http://localhost/+${PMM_UI_URL}/+g' pr.codecept.js
npx codeceptjs run --reporter mocha-multi -c pr.codecept.js --grep '@qan|@nightly|@menu'
"""
}
}
}
}
Expand Down