diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5af8d97bc..bd68ccdb12 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] diff --git a/conf/robottelo.yaml.template b/conf/robottelo.yaml.template index bb67c31a3d..200563d55e 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/pytest_fixtures/core/sat_cap_factory.py b/pytest_fixtures/core/sat_cap_factory.py index 07dc6b4876..45742edea0 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/requirements.txt b/requirements.txt index 45cce748bc..3bbe7e838d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,9 +10,9 @@ 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.2.0 +python-box==7.3.0 pytest==8.3.4 pytest-order==1.3.0 pytest-services==2.2.1 diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index b7c3817b42..47b13ba41a 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/api/test_provisioningtemplate.py b/tests/foreman/api/test_provisioningtemplate.py index 7775e5f17f..fb418177b3 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 diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 2cc4562320..3505b910e0 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 diff --git a/tests/foreman/ui/test_ansible.py b/tests/foreman/ui/test_ansible.py index df00f9ec0a..99399f099d 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): diff --git a/tests/foreman/ui/test_documentation_links.py b/tests/foreman/ui/test_documentation_links.py index b1e34b7ea8..3d11b8cd86 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}")