diff --git a/integration-tests/test_motd.py b/integration-tests/test_motd.py index 03bec534..9d45c87b 100644 --- a/integration-tests/test_motd.py +++ b/integration-tests/test_motd.py @@ -1,3 +1,11 @@ +""" +:casecomponent: insights-client +:requirement: RHSS-291297 +:subsystemteam: sst_csi_client_tools +:caseautomation: Automated +:upstream: Yes +""" + import contextlib import conftest import os @@ -39,7 +47,28 @@ def delete_files(): @pytest.mark.usefixtures("register_subman") @pytest.mark.usefixtures("delete_special_files") def test_motd(insights_client): - """MOTD only exists on unregistered system without (.un)registered files.""" + """ + :id: a66a93bb-bbd2-4db0-a2aa-2bb184b11187 + :title: Test MOTD file presence based on registration status + :description: + This test verifies that the MOTD file exists on an unregistered + system and that it is appropriately removed or not recreated upon + registration and unregistration + :reference: + :tier: Tier 1 + :steps: + 1. Verify that MOTD file is present on an unregistered system + 2. Register the insights-client + 3. Verify the MOTD file does not exists after registration + 4. Unregister the insights-client + 5. Cerify the MOTD file still does not exist after unregistration + :expectedresults: + 1. The MOTD file is present + 2. The client registers successfully + 3. The MOTD file is removed + 4. The client unregisters successfully + 5. The MOTD file is still not present + """ # If the system is not registered, the file should be present. insights_client.run("--status") assert os.path.exists(MOTD_PATH) @@ -58,7 +87,26 @@ def test_motd(insights_client): @pytest.mark.usefixtures("register_subman") @pytest.mark.usefixtures("delete_special_files") def test_motd_dev_null(insights_client): - """MOTD should not be touched if it is a /dev/null symlink.""" + """ + :id: 7d48df16-e1af-4158-8a33-1d2cbb9ed22d + :title: Test MOTD remains untouched when symlinked to /dev/null + :description: + This tst ensures that of the MOTD file is a symbolic link to + /dev/null, it is not modified or removed during the client's registration + and unregistration processes + :reference: + :tier: Tier 1 + :steps: + 1. Create a symlink from MOTD_PATH to /dev/null + 2. Run insights-client with --status option + 3. Register the insights-client + 4. Unregister the insights-client + :expectedresults: + 1. The symlink is created successfully + 2. Command runs successfully and MOTD remains a symlink to /dev/null + 3. The client is registered and MOTD stayed unchanged + 4. the client is unregistered and MOTD stayed unchanged + """ with contextlib.ExitStack() as stack: os.symlink(os.devnull, MOTD_PATH) stack.callback(os.unlink, MOTD_PATH) @@ -77,11 +125,20 @@ def test_motd_dev_null(insights_client): @pytest.mark.usefixtures("delete_special_files") def test_motd_message(): """ - On a unregistered system, the registration instructions should - provide the users with complete instructions on: - 1. how to register their system using rhc - 2. what is rhc and what is Red Hat Insights. - Ref: https://issues.redhat.com/browse/CCT-264 + :id: 56d12383-f7bb-4dbe-899c-a1cbd2172a30 + :title: Test MOTD message content for unregistered systems + :description: + This test ensures that on unregistered system, the MOTD provides users + with complete instructions on how to register + :reference: https://issues.redhat.com/browse/CCT-264 + :tier: Tier 1 + :steps: + 1. Ensure the host is unregistered + 2. Read the content of the MOTD file and verify that content matches + the expected message + :expectedresults: + 1. The system is unregistered + 2. The MOTD provides correct registration instructions """ cmd = ["cat", MOTD_SRC] output = subprocess.check_output(cmd, universal_newlines=True)