-
Notifications
You must be signed in to change notification settings - Fork 136
Add initial tests to validate foremanctl #20339
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,124 @@ | ||||||||||||
| """Smoke tests to check installation health | ||||||||||||
| :Requirement: Installation | ||||||||||||
| :CaseAutomation: Automated | ||||||||||||
| :CaseComponent: Installation | ||||||||||||
| :Team: Rocket | ||||||||||||
| :CaseImportance: Critical | ||||||||||||
| """ | ||||||||||||
|
|
||||||||||||
| from broker import Broker | ||||||||||||
| import pytest | ||||||||||||
|
|
||||||||||||
| from robottelo.config import settings | ||||||||||||
| from robottelo.hosts import Satellite | ||||||||||||
| from robottelo.utils.issue_handlers import is_open | ||||||||||||
|
|
||||||||||||
| pytestmark = [pytest.mark.foremanctl, pytest.mark.build_sanity, pytest.mark.upgrade] | ||||||||||||
|
|
||||||||||||
| SATELLITE_SERVICES = [ | ||||||||||||
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
| 'candlepin', | ||||||||||||
| 'dynflow-sidekiq@orchestrator', | ||||||||||||
| 'dynflow-sidekiq@worker', | ||||||||||||
| 'dynflow-sidekiq@worker-hosts-queue', | ||||||||||||
| 'foreman-proxy', | ||||||||||||
| 'foreman', | ||||||||||||
| 'httpd', | ||||||||||||
| 'postgresql', | ||||||||||||
| 'pulp-api', | ||||||||||||
| 'pulp-content', | ||||||||||||
| 'pulp-worker@*', | ||||||||||||
| 'redis', | ||||||||||||
| ] | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| def common_sat_install_assertions(satellite): | ||||||||||||
| # no errors/failures in journald | ||||||||||||
| result = satellite.execute( | ||||||||||||
| r'journalctl --quiet --no-pager --boot --grep ERROR -u "dynflow-sidekiq*" -u "foreman-proxy" -u "foreman" -u "httpd" -u "postgresql" -u "pulp-api" -u "pulp-content" -u "pulp-worker*" -u "redis" -u "candlepin"' | ||||||||||||
| ) | ||||||||||||
|
Comment on lines
+42
to
+44
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given the list here is the same as
Suggested change
It makes the test re-use the list, but is not really well readable :/ (Why is this a
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does not exactly follow a SATELLITE_SERVICES as dynflow-sidekiq* and pulp-worker* is not a service, and defining a separate list for this systemd units would not make any sense as it wouldn't be reusable, and I see no problem with it being in raw string
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
So yes, the lists are not identical, but I'd expect the result to be. That said, this all is not blocking and I am totally OK with the current code. |
||||||||||||
| if is_open('SAT-21086'): | ||||||||||||
| assert not list(filter(lambda x: 'PG::' not in x, result.stdout.splitlines())) | ||||||||||||
| else: | ||||||||||||
| assert not result.stdout | ||||||||||||
| # no errors/failures in /var/log/httpd/* | ||||||||||||
| result = satellite.execute(r'grep -iR "error" /var/log/httpd/*') | ||||||||||||
| assert not result.stdout | ||||||||||||
| httpd_log = satellite.execute('journalctl --unit=httpd') | ||||||||||||
| assert 'WARNING' not in httpd_log.stdout | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.fixture(scope='module') | ||||||||||||
| def module_sat_ready_rhel(request): | ||||||||||||
| with Broker( | ||||||||||||
| workflow=settings.server.deploy_workflows.os, | ||||||||||||
| deploy_rhel_version=settings.server.version.rhel_version, | ||||||||||||
| deploy_flavor=settings.flavors.default, | ||||||||||||
| deploy_network_type=settings.server.network_type, | ||||||||||||
| host_class=Satellite, | ||||||||||||
| ) as sat: | ||||||||||||
| sat.install_satellite_foremanctl( | ||||||||||||
| enable_fapolicyd=(request.param == 'fapolicyd'), enable_fips=(request.param == 'fips') | ||||||||||||
| ) | ||||||||||||
| yield sat | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.first_sanity | ||||||||||||
| @pytest.mark.parametrize('module_sat_ready_rhel', ['default'], indirect=True) | ||||||||||||
| def test_satellite_installation_with_foremanctl(module_sat_ready_rhel): | ||||||||||||
| """Run a basic Satellite installation | ||||||||||||
| :id: 661206f3-2eec-403c-af26-3c5cadcd5769 | ||||||||||||
| :steps: | ||||||||||||
| 1. Get RHEL Host | ||||||||||||
| 2. Configure satellite repos | ||||||||||||
| 3. Install satellite using foremanctl | ||||||||||||
| 4. Run foremanctl deploy | ||||||||||||
| :expectedresults: | ||||||||||||
| 1. foremanctl deploy runs successfully | ||||||||||||
| 2. no unexpected errors in logs | ||||||||||||
| """ | ||||||||||||
| common_sat_install_assertions(module_sat_ready_rhel) | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.parametrize('module_sat_ready_rhel', ['default'], indirect=True) | ||||||||||||
| @pytest.mark.parametrize('service', SATELLITE_SERVICES) | ||||||||||||
| def test_positive_check_installer_service_running(service, module_sat_ready_rhel): | ||||||||||||
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
| """Check if all Satellite services is running | ||||||||||||
| :id: 5389c174-7ab1-4e9d-b2aa-66d80fd6dc5h | ||||||||||||
| :steps: | ||||||||||||
| 1. Verify a service is active with systemctl is-active | ||||||||||||
| :expectedresults: All Satellite services are active | ||||||||||||
| """ | ||||||||||||
| is_active = module_sat_ready_rhel.execute(f'systemctl is-active {service}') | ||||||||||||
| status = module_sat_ready_rhel.execute(f'systemctl status {service}') | ||||||||||||
| assert is_active.status == 0, status.stdout | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| @pytest.mark.parametrize('module_sat_ready_rhel', ['default'], indirect=True) | ||||||||||||
| def test_positive_check_installer_hammer_ping(module_sat_ready_rhel): | ||||||||||||
Gauravtalreja1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||
| """Check if hammer ping reports all services as ok | ||||||||||||
| :id: 85fd4388-6d94-42f5-bed2-24be38e9f111 | ||||||||||||
| :steps: | ||||||||||||
| 1. Run the 'hammer ping' command on satellite. | ||||||||||||
| :expectedresults: All services are active (running) | ||||||||||||
| """ | ||||||||||||
| # check status reported by hammer ping command | ||||||||||||
| result = module_sat_ready_rhel.execute('hammer ping') | ||||||||||||
| assert result.status == 0 | ||||||||||||
| for line in result.stdout.split('\n'): | ||||||||||||
| if 'Status' in line: | ||||||||||||
| assert 'ok' in line | ||||||||||||
Uh oh!
There was an error while loading. Please reload this page.