From 3183ab4ba4e06d88c6fc532aee7844239306171c Mon Sep 17 00:00:00 2001 From: Radek Mynar Date: Mon, 23 Oct 2023 15:41:15 +0200 Subject: [PATCH] satellite and capsule installation improvements --- tests/foreman/installer/test_installer.py | 108 ++++++++-------------- 1 file changed, 41 insertions(+), 67 deletions(-) diff --git a/tests/foreman/installer/test_installer.py b/tests/foreman/installer/test_installer.py index 178707a8f9c..0b61c777723 100644 --- a/tests/foreman/installer/test_installer.py +++ b/tests/foreman/installer/test_installer.py @@ -1306,10 +1306,30 @@ def extract_help(filter='params'): def common_sat_install_assertions(satellite): sat_version = 'stream' if satellite.is_stream else satellite.version assert settings.server.version.release == sat_version + + # no errors/failures in /var/log/messages + # ignore warnings (some messages contain string "error" but they're still only warnings) + # ignore "kernel: GPT: Use GNU Parted to correct GPT errors." + result = satellite.execute( + r'grep -i "error" /var/log/messages | grep -v "\] WARNING" | grep -v GPT' + ) + assert len(result.stdout) == 0 + # no errors/failures in /var/log/foreman/production.log + # ignore warnings + result = satellite.execute(r'grep -i "error" /var/log/foreman/production.log | grep -v "\[W\|"') + assert len(result.stdout) == 0 + # no errors/failures in /var/log/foreman-installer/satellite.log result = satellite.execute( r'grep "\[ERROR" --after-context=100 /var/log/foreman-installer/satellite.log' ) assert len(result.stdout) == 0 + # no errors/failures in /var/log/httpd/* + result = satellite.execute(r'grep -iR "error" /var/log/httpd/*') + assert len(result.stdout) == 0 + # no errors/failures in /var/log/candlepin/* + result = satellite.execute(r'grep -iR "error" /var/log/candlepin/*') + assert len(result.stdout) == 0 + result = satellite.cli.Health.check() assert 'FAIL' not in result.stdout @@ -1332,7 +1352,6 @@ def install_satellite(satellite, installer_args): InstallerCommand(installer_args=installer_args).get_command(), timeout='30m', ) - common_sat_install_assertions(satellite) @pytest.fixture(scope='module') @@ -1361,6 +1380,7 @@ def sat_non_default_install(module_sat_ready_rhels): @pytest.mark.e2e @pytest.mark.tier1 +@pytest.mark.pit def test_capsule_installation(sat_default_install, cap_ready_rhel, default_org): """Run a basic Capsule installation @@ -1395,14 +1415,31 @@ def test_capsule_installation(sat_default_install, cap_ready_rhel, default_org): assert sat_default_install.api.Capsule().search( query={'search': f'name={cap_ready_rhel.hostname}'} )[0] + + # no errors/failures in /var/log/messages + # ignore warnings (some messages contain string "error" but they're still only warnings) + # ignore "kernel: GPT: Use GNU Parted to correct GPT errors." + result = cap_ready_rhel.execute( + r'grep -i "error" /var/log/messages | grep -v "\] WARNING" | grep -v GPT' + ) + assert len(result.stdout) == 0 + # no errors/failures /var/log/foreman-installer/satellite.log result = cap_ready_rhel.execute( r'grep "\[ERROR" --after-context=100 /var/log/foreman-installer/satellite.log' ) assert len(result.stdout) == 0 + # no errors/failures /var/log/foreman-installer/capsule.log result = cap_ready_rhel.execute( r'grep "\[ERROR" --after-context=100 /var/log/foreman-installer/capsule.log' ) assert len(result.stdout) == 0 + # 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 + result = cap_ready_rhel.cli.Health.check() assert 'FAIL' not in result.stdout @@ -1669,71 +1706,6 @@ def test_installer_check_on_ipv6(): """ -@pytest.mark.stubbed -@pytest.mark.tier3 -def test_positive_satellite_installer_logfile_check(): - """Verify the no ERROR or FATAL messages appears in the log file during the satellite - installation - - :id: c2f10f43-c52e-4f32-b3e9-7bc4b07e3b00 - - :steps: - 1. Configure all the repositories(custom and cdn) for satellite installation. - 2. Run yum update -y - 3. Run satellite-installer -y - 4. Check all the relevant log-files for ERROR/FATAL - - :expectedresults: No Unexpected ERROR/FATAL message should appear in the following log - files during the satellite-installation. - - 1. /var/log/messages, - 2. /var/log/foreman/production.log - 3. /var/log/foreman-installer/satellite.log - 4. /var/log/httpd, - 5. /var/log/candlepin - - :CaseLevel: System - - :CaseAutomation: NotAutomated - """ - - -@pytest.mark.stubbed -@pytest.mark.tier3 -def test_positive_capsule_installer_logfile_check(): - """Verify the no ERROR or FATAL messages appears in the log file during the capsule - installation - - :id: cd505a5e-141e-47eb-98d8-a05acd74c3b3 - - :steps: - 1. Install the satellite. - 2. Add all the required cdn and custom repositories in satellite to install - the capsule. - 3. Create life-cycle environment,content view and activation key. - 4. Subscribe the capsule with created activation key. - 5. Run 'yum update -y' on capsule. - 6. Run 'yum install -y satellite-capsule' on capsule. - 7. Create a certificate on satellite for new installed capsule. - 8. Copy capsule certificate from satellite to capsule. - 9. Run the satellite-installer(copy the satellite-installer command from step-7'th - generated output) command on capsule to integrate the capsule with satellite. - 10. Check all the relevant log-files for ERROR/FATAL - - :expectedresults: No Unexpected ERROR/FATAL message should appear in the following log - files during the capsule-installation. - - 1. /var/log/messages - 2. /var/log/foreman-installer/capsule.log - 3. /var/log/httpd - 4. /var/log/foreman-proxy - - :CaseLevel: System - - :CaseAutomation: NotAutomated - """ - - @pytest.mark.tier3 def test_installer_cap_pub_directory_accessibility(capsule_configured): """Verify the public directory accessibility from capsule url after disabling it from the @@ -1791,6 +1763,7 @@ def test_installer_cap_pub_directory_accessibility(capsule_configured): @pytest.mark.tier1 @pytest.mark.build_sanity @pytest.mark.first_sanity +@pytest.mark.pit def test_satellite_installation(installer_satellite): """Run a basic Satellite installation @@ -1806,7 +1779,8 @@ def test_satellite_installation(installer_satellite): :expectedresults: 1. Correct satellite packaged is installed 2. satellite-installer runs successfully - 3. satellite-maintain health check runs successfully + 3. no unexpected errors in logs + 4. satellite-maintain health check runs successfully :CaseImportance: Critical