From f64c41475538895eb02db8f744dbbe6eeb80b356 Mon Sep 17 00:00:00 2001 From: Shubham Ganar Date: Wed, 13 Nov 2024 12:52:37 +0530 Subject: [PATCH] Add test for subnet disk image download Signed-off-by: Shubham Ganar --- tests/foreman/cli/test_bootdisk.py | 51 ++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/tests/foreman/cli/test_bootdisk.py b/tests/foreman/cli/test_bootdisk.py index 7d9cf6ce70a..8adc8a77cdb 100644 --- a/tests/foreman/cli/test_bootdisk.py +++ b/tests/foreman/cli/test_bootdisk.py @@ -12,13 +12,14 @@ """ -from fauxfactory import gen_mac, gen_string +from fauxfactory import gen_ipaddr, gen_mac, gen_string import pytest from robottelo.config import settings -from robottelo.constants import HTTPS_MEDIUM_URL +from robottelo.constants import HTTPS_MEDIUM_URL, SUBNET_IPAM_TYPES +@pytest.mark.upgrade @pytest.mark.rhel_ver_match('[^6]') def test_positive_bootdisk_download_https( request, @@ -90,3 +91,49 @@ def _finalize(): # Check if full-host bootdisk can be downloaded. bootdisk = module_target_sat.cli.Bootdisk.host({'host-id': host['id'], 'full': 'true'}) assert 'Successfully downloaded host disk image' in bootdisk['message'] + + +@pytest.mark.upgrade +def test_positive_bootdisk_subnet_download(module_location, module_org, module_target_sat): + """Verify satellite is able to download subnet disk image. + + :id: ed6da37f-ba3f-43c9-9169-40c818e42136 + + :steps: + 1. Create a subnet + 2. Download the subnet disk image + 3. Check if subnet disk image is downloaded properly + + :expectedresults: subnet disk image is downloaded properly + + :Verifies: SAT-23549 + + :customerscenario: true + """ + capsule = module_target_sat.nailgun_smart_proxy + file_name = gen_string('alpha') + name = gen_string('alpha') + mask = '255.255.255.0' + network = gen_ipaddr() + domain = module_target_sat.cli_factory.make_domain( + {'organization-id': module_org.id, 'location-id': module_location.id} + ) + gateway = gen_ipaddr() + subnet = module_target_sat.cli_factory.make_subnet( + { + 'name': name, + 'mask': mask, + 'network': network, + 'domain-ids': [domain['id']], + 'gateway': gateway, + 'ipam': SUBNET_IPAM_TYPES['dhcp'], + 'tftp-id': capsule.id, + 'discovery-id': capsule.id, + 'remote-execution-proxy-ids': capsule.id, + } + ) + # Check if subnet disk image bootdisk can be downloaded. + bootdisk = module_target_sat.cli.Bootdisk.subnet( + {'subnet-id': subnet['id'], 'file': f'{file_name}'} + ) + assert f'Successfully downloaded subnet disk image to {file_name}' in bootdisk['message']