From dfbde5b06ae0028bcb67e7485cee6f4bb33895b0 Mon Sep 17 00:00:00 2001 From: amolpati30 <151733635+amolpati30@users.noreply.github.com> Date: Mon, 9 Dec 2024 14:55:55 +0530 Subject: [PATCH 1/7] Updated the assertion to align with the 'rex_snippet' var. (#17088) Updated the assertion to align with the 'rex_snippet' var Foreman changes 1)https://github.com/theforeman/foreman/pull/10340 2)https://github.com/theforeman/foreman/pull/10236 --- tests/foreman/api/test_provisioningtemplate.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/foreman/api/test_provisioningtemplate.py b/tests/foreman/api/test_provisioningtemplate.py index 7775e5f17f1..fb418177b38 100644 --- a/tests/foreman/api/test_provisioningtemplate.py +++ b/tests/foreman/api/test_provisioningtemplate.py @@ -585,7 +585,7 @@ def test_positive_template_check_rex_snippet( assert f'chown -R {rex_user}: ~{rex_user}' in rex_snippet assert f'chown -R {rex_user}: ~{rex_user}/.ssh' in rex_snippet assert ( - f'echo "{rex_user} ALL = (root) NOPASSWD : ALL" > /etc/sudoers.d/{rex_user}\necho "Defaults:{rex_user} !requiretty" >> /etc/sudoers.d/{rex_user}' + f'echo "{rex_user} ALL = (ALL) NOPASSWD : ALL" > /etc/sudoers.d/{rex_user}\necho "Defaults:{rex_user} !requiretty" >> /etc/sudoers.d/{rex_user}' in rex_snippet ) assert ssh_key in rex_snippet @@ -646,8 +646,8 @@ def test_positive_template_check_rex_pull_mode_snippet( pkg_manager = 'yum' if module_sync_kickstart_content.rhel_ver < 8 else 'dnf' assert f'{pkg_manager} -y install foreman_ygg_worker' in rex_snippet assert 'broker = ["mqtts://$SERVER_NAME:1883"]' in rex_snippet - assert 'systemctl try-restart yggdrasild' in rex_snippet - assert 'systemctl enable --now yggdrasild' in rex_snippet + assert 'systemctl try-restart $YGGDRASIL_SERVICE' in rex_snippet + assert 'systemctl enable --now $YGGDRASIL_SERVICE' in rex_snippet assert 'yggdrasil status' in rex_snippet assert 'Remote execution pull provider successfully configured!' in rex_snippet From 58f7c4fd16ea79e5d28382b295f1d9bca41301fa Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Mon, 9 Dec 2024 10:46:20 +0100 Subject: [PATCH 2/7] Update test_positive_documentation_links to test stage doc links (#16884) --- conf/robottelo.yaml.template | 2 ++ robottelo/config/validators.py | 1 + tests/foreman/ui/test_documentation_links.py | 11 +++++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/conf/robottelo.yaml.template b/conf/robottelo.yaml.template index bb67c31a3d3..200563d55e4 100644 --- a/conf/robottelo.yaml.template +++ b/conf/robottelo.yaml.template @@ -29,3 +29,5 @@ ROBOTTELO: SETTINGS: GET_FRESH: true IGNORE_VALIDATION_ERRORS: false + # Stage docs url + STAGE_DOCS_URL: https://docs.redhat.com diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index b7c3817b420..47b13ba41a0 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -321,6 +321,7 @@ Validator('remotedb.port', default=5432), ], robottelo=[ + Validator('robottelo.stage_docs_url', default='https://docs.redhat.com'), Validator('robottelo.settings.ignore_validation_errors', is_type_of=bool, default=False), Validator('robottelo.rhel_source', default='ga', is_in=['ga', 'internal']), Validator( diff --git a/tests/foreman/ui/test_documentation_links.py b/tests/foreman/ui/test_documentation_links.py index b1e34b7ea8a..3d11b8cd865 100644 --- a/tests/foreman/ui/test_documentation_links.py +++ b/tests/foreman/ui/test_documentation_links.py @@ -22,10 +22,6 @@ @pytest.mark.e2e -@pytest.mark.skipif( - (settings.server.version.release.split('.')[0:2] in settings.robottelo.sat_non_ga_versions), - reason="The test don't yet support verifying documentation links for non GA'ed Satellite release.", -) def test_positive_documentation_links(target_sat): """Verify that Satellite documentation links are working. Note: At the moment, the test doesn't support verifying links hidden behind a button. @@ -67,6 +63,7 @@ def test_positive_documentation_links(target_sat): 'factvalue', 'dashboard', ] + sat_version = ".".join(target_sat.version.split('.')[0:2]) all_links = defaultdict(list) pages_with_broken_links = defaultdict(list) with target_sat.ui_session() as session: @@ -86,6 +83,12 @@ def test_positive_documentation_links(target_sat): ) for page in pages: for link in all_links[page]: + # Test stage docs url for Non-GA'ed Satellite + if sat_version in settings.robottelo.sat_non_ga_versions: + link = link.replace( + 'https://docs.redhat.com', settings.robottelo.stage_docs_url + ) + link = link.replace('html', 'html-single') if requests.get(link, verify=False).status_code != 200: pages_with_broken_links[page].append(link) logger.info(f"Following link on {page} page seems broken: \n {link}") From 904a0787d53664e3eea5ea7abd270c218ebb2016 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 22:57:08 -0500 Subject: [PATCH 3/7] Bump python-box from 7.2.0 to 7.3.0 (#17119) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 45cce748bcb..752b075ba28 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,7 +12,7 @@ manifester==0.2.8 navmazing==1.2.2 productmd==1.42 pyotp==2.9.0 -python-box==7.2.0 +python-box==7.3.0 pytest==8.3.4 pytest-order==1.3.0 pytest-services==2.2.1 From a2ce5f8c5030a35fdc2eaa70720091b95b5ee8bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 23:05:57 -0500 Subject: [PATCH 4/7] Bump productmd from 1.42 to 1.43 (#17120) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 752b075ba28..3bbe7e838dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ fauxfactory==3.1.1 jinja2==3.1.4 manifester==0.2.8 navmazing==1.2.2 -productmd==1.42 +productmd==1.43 pyotp==2.9.0 python-box==7.3.0 pytest==8.3.4 From 2a06c9d74133693ec1dc29c89b8bce5e4e37a4c3 Mon Sep 17 00:00:00 2001 From: amolpati30 <151733635+amolpati30@users.noreply.github.com> Date: Tue, 10 Dec 2024 11:25:02 +0530 Subject: [PATCH 5/7] variable value should del after update (#16969) --- tests/foreman/ui/test_ansible.py | 35 ++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index df00f9ec0ab..99399f099dd 100644 --- a/tests/foreman/ui/test_ansible.py +++ b/tests/foreman/ui/test_ansible.py @@ -151,12 +151,14 @@ def test_positive_assign_ansible_role_variable_on_host( module_org, module_location, ): - """Verify ansible variable is added to the role and attached to the host. + """Verify ansible variable is added to the role and attached to the host and delete updated value in variable :id: 7ec4fe19-5a08-4b10-bb4e-7327dd68699a :BZ: 2170727 + :Verifies: SAT-23109 + :customerscenario: true :steps: @@ -164,8 +166,13 @@ def test_positive_assign_ansible_role_variable_on_host( 2. Enable both 'Merge Overrides' and 'Merge Default'. 3. Add the variable to a role and attach the role to the host. 4. Verify that ansible role and variable is added to the host. + 5. Override the variable value. + 6. Reset the overridden value to the original value. + - :expectedresults: The role and variable is successfully added to the host. + :expectedresults: + 1. The role and variable is successfully added to the host. + 2. The overridden value in the variable was successfully deleted, and the default value remains unchanged. """ @request.addfinalizer @@ -229,6 +236,30 @@ def _finalize(): (v['Name'], v['Ansible role'], v['Type'], v['Value']) for v in variable_table ] + new_key = gen_string('alpha') + session.ansiblevariables.create_with_overrides( + { + 'key': new_key, + 'ansible_role': SELECTED_ROLE[0], + 'override': 'true', + 'parameter_type': parameter_type, + 'default_value': default_value, + } + ) + new_value = '["test update"]' + # Update the value in a variable. + session.host_new.update_variable_value(rhel_contenthost.hostname, new_key, new_value) + update_value = session.host_new.read_variable_value(rhel_contenthost.hostname, new_key) + assert new_value in update_value + + # Revert the updated value to its default state. + session.host_new.del_variable_value(rhel_contenthost.hostname) + reset_variable_value = session.host_new.read_variable_value( + rhel_contenthost.hostname, new_key + ) + assert new_value not in reset_variable_value + assert default_value in reset_variable_value + @pytest.mark.tier3 @pytest.mark.parametrize('setting_update', ['ansible_roles_to_ignore'], indirect=True) def test_positive_ansible_roles_ignore_list(self, target_sat, setting_update): From 4503fe8833ac0688233432a8214c9d8f26660f11 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Dec 2024 14:39:48 +0530 Subject: [PATCH 6/7] [pre-commit.ci] pre-commit autoupdate (#17118) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.8.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.8.1...v0.8.2) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5af8d97bcf..bd68ccdb122 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: - id: check-yaml - id: debug-statements - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.8.1 + rev: v0.8.2 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From c170b84214e2ce4928af4ca744a64df6c37ee607 Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Tue, 10 Dec 2024 11:49:07 +0100 Subject: [PATCH 7/7] Provide better error output for test_satellite_installation (#17105) --- pytest_fixtures/core/sat_cap_factory.py | 28 ++++++++++++----------- tests/foreman/installer/test_installer.py | 10 ++++---- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 07dc6b4876e..45742edea07 100644 --- a/pytest_fixtures/core/sat_cap_factory.py +++ b/pytest_fixtures/core/sat_cap_factory.py @@ -364,19 +364,18 @@ def installer_satellite(request): # enable satellite repos for repo in sat.SATELLITE_CDN_REPOS.values(): sat.enable_repo(repo, force=True) + elif settings.server.version.source == 'nightly': + sat.create_custom_repos( + satellite_repo=settings.repos.satellite_repo, + satmaintenance_repo=settings.repos.satmaintenance_repo, + ) else: - if settings.server.version.source == 'nightly': - sat.create_custom_repos( - satellite_repo=settings.repos.satellite_repo, - satmaintenance_repo=settings.repos.satmaintenance_repo, - ) - else: - # get ohsnap repofile - sat.download_repofile( - product='satellite', - release=settings.server.version.release, - snap=settings.server.version.snap, - ) + # get ohsnap repofile + sat.download_repofile( + product='satellite', + release=settings.server.version.release, + snap=settings.server.version.snap, + ) if settings.robottelo.rhel_source == "internal": # disable rhel repos from cdn @@ -386,7 +385,7 @@ def installer_satellite(request): sat.install_satellite_or_capsule_package() # Install Satellite - sat.execute( + installer_result = sat.execute( InstallerCommand( installer_args=[ 'scenario satellite', @@ -395,6 +394,9 @@ def installer_satellite(request): ).get_command(), timeout='30m', ) + # exit code 0 means no changes, 2 means changes were applied succesfully + assert installer_result.status in (0, 2), installer_result.stdout + sat.enable_satellite_ipv6_http_proxy() if 'sanity' in request.config.option.markexpr: configure_nailgun() diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 2cc45623205..3505b910e05 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -116,22 +116,22 @@ def common_sat_install_assertions(satellite): result = satellite.execute( r'journalctl --quiet --no-pager --boot --priority err -u "dynflow-sidekiq*" -u "foreman-proxy" -u "foreman" -u "httpd" -u "postgresql" -u "pulpcore-api" -u "pulpcore-content" -u "pulpcore-worker*" -u "redis" -u "tomcat"' ) - assert len(result.stdout) == 0 + assert not result.stdout # no errors in /var/log/foreman/production.log result = satellite.execute(r'grep --context=100 -E "\[E\|" /var/log/foreman/production.log') if not is_open('SAT-21086'): - assert len(result.stdout) == 0 + assert not result.stdout # no errors/failures in /var/log/foreman-installer/satellite.log result = satellite.execute( r'grep "\[ERROR" --context=100 /var/log/foreman-installer/satellite.log' ) - assert len(result.stdout) == 0 + assert not result.stdout # no errors/failures in /var/log/httpd/* result = satellite.execute(r'grep -iR "error" /var/log/httpd/*') - assert len(result.stdout) == 0 + assert not result.stdout # no errors/failures in /var/log/candlepin/* result = satellite.execute(r'grep -iR "error" /var/log/candlepin/*') - assert len(result.stdout) == 0 + assert not result.stdout httpd_log = satellite.execute('journalctl --unit=httpd') assert "WARNING" not in httpd_log.stdout