Skip to content

PML-157: Fixing and readding percona-mongolink Version test #352

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

Merged
merged 30 commits into from
May 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8376e07
Fixing and readding version test
keithquinnpercona May 23, 2025
2472587
Removing fixture
keithquinnpercona May 23, 2025
2501c22
Fixing undeclared variable
keithquinnpercona May 23, 2025
5af2495
Fixing undeclared variable
keithquinnpercona May 23, 2025
49e7906
Debugging
keithquinnpercona May 23, 2025
22dc46e
Fixing test
keithquinnpercona May 23, 2025
238bd72
Fixing test
keithquinnpercona May 23, 2025
bde7280
Fixing test
keithquinnpercona May 23, 2025
5d0b543
Fixing test
keithquinnpercona May 23, 2025
4becce5
Fixing test
keithquinnpercona May 23, 2025
5e0febd
Cleanup
keithquinnpercona May 23, 2025
da174bb
Adding version variable to compare correct version in output
keithquinnpercona May 23, 2025
151c9a5
Adding git version check
keithquinnpercona May 23, 2025
82ad4d5
Changing git commit method
keithquinnpercona May 23, 2025
d1215e2
Changing git commit method
keithquinnpercona May 23, 2025
117a3f2
Testing test
keithquinnpercona May 23, 2025
ff90819
Testing test
keithquinnpercona May 23, 2025
418a782
Testing test
keithquinnpercona May 23, 2025
db0a757
Testing test
keithquinnpercona May 23, 2025
33a6acb
Testing test
keithquinnpercona May 23, 2025
1453d76
Testing test
keithquinnpercona May 23, 2025
94a2ee3
Cleanup
keithquinnpercona May 23, 2025
f2652f4
Cleanup
keithquinnpercona May 23, 2025
0d07a8d
Fixing test
keithquinnpercona May 23, 2025
2dc82a2
Fixing test
keithquinnpercona May 23, 2025
80a93d9
Fixing test
keithquinnpercona May 23, 2025
82749fd
Testing test
keithquinnpercona May 23, 2025
ebc684c
Testing test
keithquinnpercona May 23, 2025
a6ee179
Cleanup
keithquinnpercona May 23, 2025
87e988c
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PML-157
keithquinnpercona May 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pml/install/playbooks/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
update_cache: yes
vars:
packages:
- git
- python3-pip
- wget
- iputils-ping
Expand Down
1 change: 1 addition & 0 deletions pml/install/playbooks/redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
update_cache: yes
vars:
packages:
- git
- python3-pip
- wget
- docker-ce
Expand Down
1 change: 1 addition & 0 deletions pml/install/playbooks/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
update_cache: yes
vars:
packages:
- git
- python3-pip
- wget
- iputils-ping
Expand Down
30 changes: 24 additions & 6 deletions pml/tests/test_plm.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,13 @@
import pytest
import json

import requests
import testinfra.utils.ansible_runner
pml = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')

version = os.getenv("pml_version")

def pml_start(host, timeout=60, interval=2):
"""Starts PML and waits until the endpoint is ready
Also confirms the PML start command works and is ready to clone"""
Expand Down Expand Up @@ -94,7 +97,6 @@ def pml_status(host, timeout=45):
except Exception as e:
return {"success": False, "error": str(e)}

@pytest.fixture()
def pml_version(host):
"""Capture PLM Version command and returns output"""
result = host.run("percona-mongolink version")
Expand Down Expand Up @@ -175,11 +177,27 @@ def start_plm_service(host):
assert status.stdout.strip() == "active", f"PLM service is inactive: {status.stdout}"
return start_plm

# def test_pml_version(pml_version):
# """Test that percona-mongolink version output is correct"""
# pattern = r"^v\d+\.\d+ [a-f0-9]{7} \d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$"
#
# assert re.match(pattern, pml_version.stderr)
def get_git_commit():
url = f"https://api.github.com/repos/percona/percona-mongolink/commits/release-{version}"
git_commit = requests.get(url)

if git_commit.status_code == 200:
return git_commit.json()["sha"][:7]
else:
print(f"Unable to obtain git commit, failed with status code: {git_commit.status_code}")
return False

def test_pml_version(host):
"""Test that percona-mongolink version output is correct"""
result = pml_version(host)
lines = result.stderr.split("\n")
parsed_config = {line.split(":")[0]: line.split(":")[1].strip() for line in lines[0:-1]}
assert parsed_config['Version'] == f"v{version}", parsed_config
assert parsed_config['Platform'], parsed_config
assert parsed_config['GitCommit'] == get_git_commit(), parsed_config
assert parsed_config['GitBranch'] == f"release-{version}", parsed_config
assert parsed_config['BuildTime'], parsed_config
assert parsed_config['GoVersion'], parsed_config

def test_plm_binary(host):
"""Check PLM binary exists with the correct permissions"""
Expand Down