Skip to content

Commit

Permalink
Merge pull request #627 from Percona-QA/PMM-7-fix-rc-check
Browse files Browse the repository at this point in the history
PMM-7 fixed server check for RC
  • Loading branch information
Vadim Yarosh authored Jan 26, 2024
2 parents 8d545c2 + 0ec3c15 commit 52ddbed
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/pmm-package-test-fb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ jobs:
matrix:
os: ${{ fromJSON(needs.get_versions.outputs.pt_os) }}
with:
package_testing_branch: ${{ inputs.package_testing_branch || 'PMM-9527-package-tests-fb' }}
pmm_server_image: ${{ inputs.package_testing_branch || 'perconalab/pmm-server-fb:PR-3510-9cb96a5' }}
pmm_client_tarball: ${{ inputs.package_testing_branch || 'https://s3.us-east-2.amazonaws.com/pmm-build-cache/PR-BUILDS/pmm2-client/pmm2-client-PR-3510-9cb96a5.tar.gz' }}
package_testing_branch: ${{ inputs.package_testing_branch || 'master' }}
pmm_server_image: ${{ inputs.package_testing_branch }}
pmm_client_tarball: ${{ inputs.package_testing_branch }}
expected_version: ${{needs.get_versions.outputs.finish_version}}
repository: 'dev-latest'
metrics_mode: ${{ inputs.metrics_mode || 'auto' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pmm-package-test-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ jobs:
EOF
- name: "Run (${{ inputs.repository }})${{ inputs.test_name }} test on ${{ inputs.os }}"
- name: "Run (${{ inputs.repository }})${{ inputs.playbook }} test on ${{ inputs.os }}"
working-directory: ./
run: vagrant up

Expand Down
26 changes: 26 additions & 0 deletions tasks/verify_pmm_server_version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Performs PMM Server version verification from "pmm-admin status" output
#
# Task adjustments are handled by parent playbook vars:
# var "port_flag" : to access agent with custom port
# ex: port_flag: "--pmm-agent-listen-port={{ custom_port }}"
#
- name: Grep pmm-admin status output
shell: "pmm-admin status {{ port_flag if port_flag is defined else '' }}"
register: pmm_admin_status

- block:
- name: Grep PMM Server version from pmm-admin status output
shell: "echo \"{{ pmm_admin_status.stdout }}\" | grep Version | awk -F':' '{print $2}' | awk -F' ' '{print $1}'"
register: pmm_server_version

- name: Validate PMM Server version({{ pmm_server_version.stdout }}) from "status" is "{{ pmm_version }}"
assert:
that:
- "pmm_version in pmm_server_version.stdout"
fail_msg: "PMM Server version is not {{ pmm_version }}!"
success_msg: "PMM Server version is {{ pmm_version }}!"
rescue:
- name: Print pmm-admin status on fail
debug:
msg: "{{ pmm_admin_status.stdout }}"
failed_when: true
101 changes: 38 additions & 63 deletions tasks/verify_pmm_status_versions.yml
Original file line number Diff line number Diff line change
@@ -1,71 +1,46 @@
# This task performs PMM Client version verification from "pmm-admin --version" and
# This task performs PMM Client version verification from "pmm-admin status" and
# "pmm-admin status" commands output
#
# Task adjustments are handled by parent playbook vars:
# var "port_flag" : to access agent with custom port
# ex: port_flag: "--pmm-agent-listen-port={{ custom_port }}"

- name: set empty port_flag
when: port_flag is not defined
set_fact:
port_flag: ""

#
- name: Grep pmm-admin status output
shell: "pmm-admin status {{ port_flag }}"
shell: "pmm-admin status {{ port_flag if port_flag is defined else '' }}"
register: pmm_admin_status
- debug: var=pmm_admin_status.stdout

- name: Assert pmm-agent is connected to server
assert:
that:
- "'Failed to get PMM Agent status from local pmm-agent' not in pmm_admin_status.stdout"
- "'Connected' in pmm_admin_status.stdout"
fail_msg: "pmm-agent is not connected to server!"
success_msg: "pmm-agent is connected to server"

- name: Grep PMM Server version from pmm-admin status output
shell: "pmm-admin status {{ port_flag }} | grep Version | awk -F':' '{print $2}' | awk -F' ' '{print $1}'"

register: pmm_server_version

- name: Print the PMM Server Version on Status command
ansible.builtin.debug:
msg: PMM Server version is {{ pmm_server_version.stdout }}

- name: Assert PMM Server version from "status" output ({{ pmm_server_version.stdout }}) equals expected "{{ pmm_version }}"
when: lookup('env', 'install_repo') == "testing"
assert:
that:
- "pmm_version in pmm_server_version.stdout"

- name: Grep PMM Admin version from pmm-admin status output
shell: "pmm-admin status {{ port_flag }} | grep pmm-admin | awk -F' ' '{print $3}'"
register: pmm_admin_version

- name: Print the PMM Admin Version on Status command
ansible.builtin.debug:
msg: pmm-agent version is {{ pmm_admin_version.stdout }}

- name: Assert PMM Admin version from "status" output ({{ pmm_admin_version.stdout }}) equals expected "{{ pmm_version }}"
# when: lookup('env', 'install_repo') == "testing"
assert:
that:
- "pmm_version in pmm_admin_version.stdout"

- name: Grep PMM Agent version from pmm-admin status output
shell: "pmm-admin status {{ port_flag }} | grep pmm-agent | awk -F' ' '{print $3}'"
register: pmm_agent_version

- name: Print the PMM Agent Version on Status command
ansible.builtin.debug:
msg: pmm-agent version is {{ pmm_agent_version.stdout }}

- name: Assert PMM Agent version from "status" output ({{ pmm_agent_version.stdout }}) equals expected "{{ pmm_version }}"
assert:
that:
- "pmm_version in pmm_agent_version.stdout"

- name: Assert PMM Admin and Agent versions are equal
assert:
that:
- "pmm_admin_version.stdout in pmm_agent_version.stdout"
- block:
- name: Assert pmm-agent is connected to server
assert:
that:
- "'Failed to get PMM Agent status from local pmm-agent' not in pmm_admin_status.stdout"
- "'Connected' in pmm_admin_status.stdout"
fail_msg: "pmm-agent is not connected to server!"
success_msg: "pmm-agent is connected to server"

- name: Grep PMM Admin version from pmm-admin status output
shell: "echo \"{{ pmm_admin_status.stdout }}\" | grep pmm-admin | awk -F' ' '{print $3}'"
register: pmm_admin_version

- name: Assert <pmm-admin> version({{ pmm_admin_version.stdout }}) from "status" is "{{ pmm_version }}"
assert:
that:
- "pmm_version in pmm_admin_version.stdout"
fail_msg: "pmm-admin version is not {{ pmm_version }}!"
success_msg: "pmm-admin version is {{ pmm_admin_version.stdout }}!"

- name: Grep PMM Agent version from pmm-admin status output
shell: "echo \"{{ pmm_admin_status.stdout }}\" | grep pmm-agent | awk -F' ' '{print $3}'"
register: pmm_agent_version

- name: Assert <pmm-agent> version({{ pmm_agent_version.stdout }}) from "status" is "{{ pmm_version }}"
assert:
that:
- "pmm_version in pmm_agent_version.stdout"
fail_msg: "pmm-agent version is not {{ pmm_version }}!"
success_msg: "pmm-agent version is {{ pmm_agent_version.stdout }}!"
rescue:
- name: Print pmm-admin status on fail
debug:
msg: "{{ pmm_admin_status.stdout }}"
failed_when: true

0 comments on commit 52ddbed

Please sign in to comment.