From deddfed8d349cb7aa581267fc79ec2a78e2d10d4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Dec 2024 22:42:29 -0500 Subject: [PATCH 01/21] Bump pytest-reportportal from 5.4.6 to 5.4.7 (#17075) --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2ebfb4f435..45cce748bc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,7 @@ pytest==8.3.4 pytest-order==1.3.0 pytest-services==2.2.1 pytest-mock==3.14.0 -pytest-reportportal==5.4.6 +pytest-reportportal==5.4.7 pytest-xdist==3.6.1 pytest-fixturecollection==0.1.2 pytest-ibutsu==2.2.4 From 1b64d7cc94210caf49ec1f02983690d83c1faed2 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Thu, 5 Dec 2024 15:05:32 +0530 Subject: [PATCH 02/21] automation coverage for SAT-28695 (#17044) * automation coverage for SAT-28695 * Update tests/foreman/cli/test_rhcloud_inventory.py Co-authored-by: vsedmik <46570670+vsedmik@users.noreply.github.com> * Update tests/foreman/cli/test_rhcloud_inventory.py Co-authored-by: vsedmik <46570670+vsedmik@users.noreply.github.com> --------- Co-authored-by: vsedmik <46570670+vsedmik@users.noreply.github.com> Co-authored-by: David Moore <109112035+damoore044@users.noreply.github.com> --- tests/foreman/cli/test_rhcloud_inventory.py | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/tests/foreman/cli/test_rhcloud_inventory.py b/tests/foreman/cli/test_rhcloud_inventory.py index 6c439a209e..ee8ddc5c0e 100644 --- a/tests/foreman/cli/test_rhcloud_inventory.py +++ b/tests/foreman/cli/test_rhcloud_inventory.py @@ -371,3 +371,37 @@ def test_positive_generate_all_reports_job(target_sat): assert task_output[0].result == "success" finally: target_sat.update_setting('allow_auto_inventory_upload', True) + + +@pytest.mark.rhel_ver_match('N-2') +def test_positive_register_insights_client_host(module_target_sat, rhel_insights_vm): + """Check the below command executed successfully + command - insights-client --ansible-host=foo.example.com + + :id: b578371e-ec36-42de-83fa-bcea6e027fe2 + + :setup: + 1. Enable, sync RHEL BaseOS and AppStream repositories + 2. Create CV, Publish/promote and create AK for host registration + 3. Register host to satellite, Setup Insights is Yes (Override), Install insights-client + + :steps: + 2. Test connection of insights client + 3. execute insight client command given in the description + + :expectedresults: Command executed successfully + + :Verifies: SAT-28695 + + :customerscenario: true + + :CaseAutomation: Automated + + """ + # Test connection of insights client + assert rhel_insights_vm.execute('insights-client --test-connection').status == 0 + + # Execute insight client command + output = rhel_insights_vm.execute(f'insights-client --ansible-host={rhel_insights_vm.hostname}') + assert output.status == 0 + assert 'Ansible hostname updated' in output.stdout From a2f2587620c35c176ec98521c420c4e4be111a07 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Thu, 5 Dec 2024 15:15:57 +0100 Subject: [PATCH 03/21] Update Jira ON_QA status for Jira issue handler (#16721) --- conf/jira.yaml.template | 2 +- robottelo/config/validators.py | 2 +- robottelo/constants/__init__.py | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/conf/jira.yaml.template b/conf/jira.yaml.template index 9c90993fe2..93a863509d 100644 --- a/conf/jira.yaml.template +++ b/conf/jira.yaml.template @@ -7,4 +7,4 @@ JIRA: COMMENT_VISIBILITY: "Red Hat Employee" ENABLE_COMMENT: false # Comment only if jira is in one of the following state - ISSUE_STATUS: ["Review", "Release Pending"] + ISSUE_STATUS: ["Testing", "Release Pending"] diff --git a/robottelo/config/validators.py b/robottelo/config/validators.py index e5ac9fed41..b7c3817b42 100644 --- a/robottelo/config/validators.py +++ b/robottelo/config/validators.py @@ -189,7 +189,7 @@ Validator('jira.comment_type', default="group"), Validator('jira.comment_visibility', default="Red Hat Employee"), Validator('jira.enable_comment', default=False), - Validator('jira.issue_status', default=["Review", "Release Pending"]), + Validator('jira.issue_status', default=["Testing", "Release Pending"]), ], ldap=[ Validator( diff --git a/robottelo/constants/__init__.py b/robottelo/constants/__init__.py index 8a0637f4c7..25bc67ab1b 100644 --- a/robottelo/constants/__init__.py +++ b/robottelo/constants/__init__.py @@ -1830,8 +1830,16 @@ # Jira statuses used by Robottelo issue handler. JIRA_TESTS_PASSED_LABEL = "tests-passed" JIRA_TESTS_FAILED_LABEL = "tests-failed" -JIRA_OPEN_STATUSES = ("New", "Backlog", "Refinement", "To Do", "In Progress") -JIRA_ONQA_STATUS = "Review" +JIRA_OPEN_STATUSES = ( + "New", + "Backlog", + "Refinement", + "To Do", + "In Progress", + "Review", + "Release Pending - Upstream", +) +JIRA_ONQA_STATUS = "Testing" JIRA_CLOSED_STATUSES = ("Release Pending", "Closed") JIRA_WONTFIX_RESOLUTIONS = "Obsolete" From 905395ea19112e0a05e1bd280ef1fc9040ef9b86 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 5 Dec 2024 22:25:36 -0500 Subject: [PATCH 04/21] Bump ruff from 0.8.1 to 0.8.2 (#17092) --- requirements-optional.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-optional.txt b/requirements-optional.txt index 1ec314083c..08c69a8318 100644 --- a/requirements-optional.txt +++ b/requirements-optional.txt @@ -2,7 +2,7 @@ pytest-cov==6.0.0 redis==5.2.0 pre-commit==4.0.1 -ruff==0.8.1 +ruff==0.8.2 # For generating documentation. sphinx==8.1.3 From 2f312effd1bbef5a609b18e2d48fcf33025915a1 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Fri, 6 Dec 2024 07:13:01 +0100 Subject: [PATCH 05/21] Preserve Capsule host for build sanity failures (#17083) --- pytest_fixtures/core/xdist.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/pytest_fixtures/core/xdist.py b/pytest_fixtures/core/xdist.py index 71e0c037cb..f34325bfde 100644 --- a/pytest_fixtures/core/xdist.py +++ b/pytest_fixtures/core/xdist.py @@ -6,7 +6,7 @@ import pytest from robottelo.config import configure_airgun, configure_nailgun, settings -from robottelo.hosts import Capsule, Satellite +from robottelo.hosts import ContentHost, Satellite from robottelo.logging import logger @@ -17,17 +17,12 @@ def align_to_satellite(request, worker_id, satellite_factory): settings.set("server.hostname", None) yield # Checkout Sanity Capsule finally - if settings.capsule.hostname: - sanity_cap = Capsule.get_host_by_hostname(settings.capsule.hostname) - sanity_cap.unregister() - Broker(hosts=[sanity_cap]).checkin() - # Checkout Sanity Satellite finally - if settings.server.hostname: - sanity_sat = Satellite(settings.server.hostname) - sanity_sat.unregister() - if settings.server.auto_checkin: - broker_sat = Satellite.get_host_by_hostname(sanity_sat.hostname) - Broker(hosts=[broker_sat]).checkin() + for host in [settings.capsule.hostname, settings.server.hostname]: + if host: + sanity_host = ContentHost.get_host_by_hostname(host) + if settings.server.auto_checkin: + sanity_host.unregister() + Broker(hosts=[sanity_host]).checkin() else: # clear any hostname that may have been previously set settings.set("server.hostname", None) From 27b62313217d3de25c67f9f8cad6b26d1ebdbb5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hellebrandt?= Date: Fri, 6 Dec 2024 11:31:42 +0100 Subject: [PATCH 06/21] Fix an assert in RHSSO test (#17089) --- tests/foreman/destructive/test_ldapauthsource.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/foreman/destructive/test_ldapauthsource.py b/tests/foreman/destructive/test_ldapauthsource.py index 8718b44cb8..d9e4dd5041 100644 --- a/tests/foreman/destructive/test_ldapauthsource.py +++ b/tests/foreman/destructive/test_ldapauthsource.py @@ -69,7 +69,10 @@ def test_rhsso_login_using_hammer( result = module_target_sat.cli.Auth.with_user( username=settings.rhsso.rhsso_user, password=settings.rhsso.rhsso_password ).status() - assert f"Session exists, currently logged in as '{settings.rhsso.rhsso_user}'." in result + assert ( + f"Session exists, currently logged in as '{settings.rhsso.rhsso_user}'." + in result[0]['message'] + ) task_list = module_target_sat.cli.Task.with_user( username=settings.rhsso.rhsso_user, password=settings.rhsso.rhsso_password ).list() From 06c9b26b9199b44e2f6f08b2931cb3ff7eabe031 Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Fri, 6 Dec 2024 11:32:25 +0100 Subject: [PATCH 07/21] permission read test skipped (#17080) --- tests/foreman/api/test_multiple_paths.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/foreman/api/test_multiple_paths.py b/tests/foreman/api/test_multiple_paths.py index b179e487fb..51a3f9c18c 100644 --- a/tests/foreman/api/test_multiple_paths.py +++ b/tests/foreman/api/test_multiple_paths.py @@ -471,10 +471,15 @@ def test_positive_permission_read(self, target_sat): class and name and resource_type fields are populated :CaseImportance: Critical + + :Verifies: SAT-29957 + + :BlockedBy: SAT-29957 """ - perm = target_sat.api.Permission().search(query={'per_page': '1'})[0] - assert perm.name - assert perm.resource_type + perms = target_sat.api.Permission().search(query={'per_page': '1'}) + for perm in perms: + assert perm.name + assert perm.resource_type @pytest.mark.tier1 def test_positive_media_read(self, target_sat): From b8890f951682019b1de38ae4b19571fd16bc4905 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:44:07 +0100 Subject: [PATCH 08/21] Skip /var/log/foreman-proxy/ log assertion for capsule installation (#17100) --- tests/foreman/installer/test_installer.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 2cc4562320..71215c7b62 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -429,9 +429,10 @@ def test_capsule_installation( # no errors/failures in /var/log/httpd/* result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/httpd/*') assert len(result.stdout) == 0 - # no errors/failures in /var/log/foreman-proxy/* - result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/foreman-proxy/*') - assert len(result.stdout) == 0 + if not is_open('SAT-29982'): + # no errors/failures in /var/log/foreman-proxy/* + result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/foreman-proxy/*') + assert len(result.stdout) == 0 # Enabling firewall cap_ready_rhel.execute('firewall-cmd --add-service RH-Satellite-6-capsule') From 1bdd7f2bf638ad5b46b53383c530b62583d1e154 Mon Sep 17 00:00:00 2001 From: Jameer Pathan <21165044+jameerpathan111@users.noreply.github.com> Date: Fri, 6 Dec 2024 17:01:38 +0100 Subject: [PATCH 09/21] Revert "Skip /var/log/foreman-proxy/ log assertion for capsule installation" (#17104) Revert "Skip /var/log/foreman-proxy/ log assertion for capsule installation (#17100)" This reverts commit b8890f951682019b1de38ae4b19571fd16bc4905. --- tests/foreman/installer/test_installer.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 71215c7b62..2cc4562320 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -429,10 +429,9 @@ def test_capsule_installation( # no errors/failures in /var/log/httpd/* result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/httpd/*') assert len(result.stdout) == 0 - if not is_open('SAT-29982'): - # no errors/failures in /var/log/foreman-proxy/* - result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/foreman-proxy/*') - assert len(result.stdout) == 0 + # no errors/failures in /var/log/foreman-proxy/* + result = cap_ready_rhel.execute(r'grep -iR "error" /var/log/foreman-proxy/*') + assert len(result.stdout) == 0 # Enabling firewall cap_ready_rhel.execute('firewall-cmd --add-service RH-Satellite-6-capsule') From a6af84ea7470a37613a8f2f9b7e3375f979255d1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Dec 2024 22:22:32 -0500 Subject: [PATCH 10/21] Bump redis from 5.2.0 to 5.2.1 (#17110) --- requirements-optional.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-optional.txt b/requirements-optional.txt index 08c69a8318..73b3315135 100644 --- a/requirements-optional.txt +++ b/requirements-optional.txt @@ -1,6 +1,6 @@ # For running tests and checking code quality using these modules. pytest-cov==6.0.0 -redis==5.2.0 +redis==5.2.1 pre-commit==4.0.1 ruff==0.8.2 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 11/21] 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 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 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 12/21] 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 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/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/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}") 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 13/21] 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 45cce748bc..752b075ba2 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 14/21] 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 752b075ba2..3bbe7e838d 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 15/21] 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 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): 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 16/21] [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 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] 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 17/21] 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 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/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 From 5abd4bc4885c2b31cdbb446e23f35e91808093a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ladislav=20Va=C5=A1ina?= Date: Tue, 10 Dec 2024 16:53:54 +0100 Subject: [PATCH 18/21] Reporting test fixes for stream (#17116) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Ondřej Gajdušek --- tests/foreman/ui/test_reporttemplates.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index 722b6e8be3..fbc5661518 100644 --- a/tests/foreman/ui/test_reporttemplates.py +++ b/tests/foreman/ui/test_reporttemplates.py @@ -282,7 +282,7 @@ def test_positive_generate_subscriptions_report_json( :CaseImportance: Medium """ # generate Subscriptions report - with session: + with module_target_sat.ui_session() as session: file_path = session.reporttemplate.generate( 'Subscription - General Report', values={'output_format': 'JSON'} ) @@ -295,10 +295,12 @@ def test_positive_generate_subscriptions_report_json( 'Account number', 'Available', 'Contract number', + 'Days Remaining', 'End date', 'ID', 'Name', 'Organization', + 'Product Host Count', 'Quantity', 'SKU', 'Start date', @@ -386,7 +388,7 @@ def test_positive_schedule_generation_and_get_mail( # make sure postfix daemon is running target_sat.execute('systemctl start postfix') # generate Subscriptions report - with session: + with target_sat.ui_session() as session: session.reporttemplate.schedule( 'Subscription - General Report', values={ @@ -426,10 +428,12 @@ def test_positive_schedule_generation_and_get_mail( 'Account number', 'Available', 'Contract number', + 'Days Remaining', 'End date', 'ID', 'Name', 'Organization', + 'Product Host Count', 'Quantity', 'SKU', 'Start date', @@ -556,9 +560,7 @@ def test_positive_installable_errata_with_user( :BZ: 1726504 """ - activation_key = target_sat.api.ActivationKey( - environment=function_lce, organization=function_org - ).create() + activation_key = target_sat.api.ActivationKey(organization=function_org).create() custom_cv = target_sat.api.ContentView(organization=function_org).create() ERRATUM_ID = str(settings.repos.yum_6.errata[2]) target_sat.cli_factory.setup_org_for_a_custom_repo( @@ -608,7 +610,7 @@ def test_positive_installable_errata_with_user( # Downgrade the package assert rhel_contenthost.execute(f'yum downgrade -y {FAKE_1_CUSTOM_PACKAGE}').status == 0 # Generate the report - with session: + with target_sat.ui_session() as session: session.organization.select(function_org.name) session.location.select(function_location.name) result_json = session.reporttemplate.generate( From 9c1a753a07595a435812854cecb2ef32ec7d2dd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hellebrandt?= Date: Wed, 11 Dec 2024 09:56:36 +0100 Subject: [PATCH 19/21] Remove the test, the BZ has been closed WONTFIX (#17141) --- tests/foreman/ui/test_ldap_authentication.py | 66 -------------------- 1 file changed, 66 deletions(-) diff --git a/tests/foreman/ui/test_ldap_authentication.py b/tests/foreman/ui/test_ldap_authentication.py index 1339fdda23..d9517bbfdb 100644 --- a/tests/foreman/ui/test_ldap_authentication.py +++ b/tests/foreman/ui/test_ldap_authentication.py @@ -1043,72 +1043,6 @@ def test_timeout_and_cac_card_ejection(): """ -@pytest.mark.parametrize('ldap_auth_source', ['AD', 'IPA', 'OPENLDAP'], indirect=True) -@pytest.mark.tier2 -def test_verify_attribute_of_users_are_updated( - session, ldap_auth_source, ldap_tear_down, target_sat -): - """Verify if attributes of LDAP user are updated upon first login when - onthefly is disabled - - :id: 163b346c-03be-11eb-acb9-0c7a158cbff4 - - :customerscenario: true - - :steps: - 1. Create authsource with onthefly disabled - 2. Create a user manually and select the authsource created - 3. Attributes of the user (like names and email) should be synced. - - :BZ: 1670397 - - :CaseImportance: Medium - - :expectedresults: The attributes should be synced. - - :parametrized: yes - """ - ldap_data, auth_source = ldap_auth_source - ldap_auth_name = gen_string('alphanumeric') - auth_source_name = f'LDAP-{auth_source.name}' - with session: - session.ldapauthentication.create( - { - 'ldap_server.name': ldap_auth_name, - 'ldap_server.host': ldap_data['ldap_hostname'], - 'ldap_server.server_type': ldap_data['server_type'], - 'account.account_name': ldap_data['ldap_user_name'], - 'account.password': ldap_data['ldap_user_passwd'], - 'account.base_dn': ldap_data['base_dn'], - 'account.onthefly_register': False, - 'account.groups_base_dn': ldap_data['group_base_dn'], - 'attribute_mappings.login': ldap_data['attr_login'], - 'attribute_mappings.first_name': LDAP_ATTR['firstname'], - 'attribute_mappings.last_name': LDAP_ATTR['surname'], - 'attribute_mappings.mail': LDAP_ATTR['mail'], - } - ) - session.user.create( - { - 'user.login': ldap_data['ldap_user_name'], - 'user.auth': auth_source_name, - 'roles.admin': True, - } - ) - with target_sat.ui_session( - user=ldap_data['ldap_user_name'], password=ldap_data['ldap_user_passwd'] - ) as ldapsession: - with pytest.raises(NavigationTriesExceeded) as error: - ldapsession.user.search('') - assert error.typename == 'NavigationTriesExceeded' - with session: - user_values = session.user.read(ldap_data['ldap_user_name']) - assert ldap_data['ldap_user_name'] == user_values['user']['login'] - assert ldap_data['ldap_user_name'] in user_values['user']['firstname'] - assert ldap_data['ldap_user_name'] in user_values['user']['lastname'] - assert ldap_data['ldap_user_name'] in user_values['user']['mail'] - - @pytest.mark.parametrize('ldap_auth_source', ['AD', 'IPA', 'OPENLDAP'], indirect=True) @pytest.mark.tier2 def test_login_failure_if_internal_user_exist( From c06ed073cab3ade5dac55b54b495e44c917c0f3d Mon Sep 17 00:00:00 2001 From: Peter Ondrejka Date: Wed, 11 Dec 2024 13:20:27 +0100 Subject: [PATCH 20/21] customerscenario tags for test_rhcloud_scheduled_insights_sync (#17146) --- tests/foreman/api/test_rhcloud_inventory.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/foreman/api/test_rhcloud_inventory.py b/tests/foreman/api/test_rhcloud_inventory.py index 415639afff..4597ac6d47 100644 --- a/tests/foreman/api/test_rhcloud_inventory.py +++ b/tests/foreman/api/test_rhcloud_inventory.py @@ -314,6 +314,8 @@ def test_rhcloud_scheduled_insights_sync( :Verifies: SAT-22626 :CaseAutomation: Automated + + :customerscenario: true """ org = rhcloud_manifest_org virtual_host, baremetal_host = rhcloud_registered_hosts From f1ca32be4cbc80b01753e71f3acc9efe08fe2284 Mon Sep 17 00:00:00 2001 From: vijay sawant Date: Wed, 11 Dec 2024 20:16:46 +0530 Subject: [PATCH 21/21] delete subscription manifest so it can re imported again (#17142) * delete subscription manifest so it can re imported again * removing test case as discussed in review --- tests/foreman/api/test_subscription.py | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/tests/foreman/api/test_subscription.py b/tests/foreman/api/test_subscription.py index 9c48473313..c112be5c9f 100644 --- a/tests/foreman/api/test_subscription.py +++ b/tests/foreman/api/test_subscription.py @@ -69,21 +69,6 @@ def module_ak(module_sca_manifest_org, rh_repo, custom_repo, module_target_sat): ).create() -@pytest.mark.tier1 -@pytest.mark.pit_server -def test_positive_create(module_sca_manifest, module_target_sat): - """Upload a manifest. - - :id: 6faf9d96-9b45-4bdc-afa9-ec3fbae83d41 - - :expectedresults: Manifest is uploaded successfully - - :CaseImportance: Critical - """ - org = module_target_sat.api.Organization().create() - module_target_sat.upload_manifest(org.id, module_sca_manifest.content) - - @pytest.mark.tier1 def test_positive_refresh(function_sca_manifest_org, request, target_sat): """Upload a manifest and refresh it afterwards.