diff --git a/conf/manifest.yaml.template b/conf/manifest.yaml.template index 23ce97d80d7..ea82080e3aa 100644 --- a/conf/manifest.yaml.template +++ b/conf/manifest.yaml.template @@ -4,15 +4,12 @@ MANIFEST: # Value of SAT_VERSION setting should be in the form "sat-X.Y", e.g. "sat-6.11" SAT_VERSION: "" OFFLINE_TOKEN: "" - # Manifests with simple content access enabled should not use a quantity higher than 1 for any subscription - # unless doing so is required for a test. SUBSCRIPTION_DATA: # NAME should be an exact match of the subscription name as listed on the Customer Portal - NAME: "" QUANTITY: - NAME: "" QUANTITY: - SIMPLE_CONTENT_ACCESS: "enabled" URL: TOKEN_REQUEST: "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" ALLOCATIONS: "https://api.access.redhat.com/management/v1/allocations" @@ -24,7 +21,6 @@ MANIFEST: QUANTITY: - NAME: "" QUANTITY: - SIMPLE_CONTENT_ACCESS: "disabled" URL: TOKEN_REQUEST: "https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token" ALLOCATIONS: "https://api.access.redhat.com/management/v1/allocations/" diff --git a/pytest_fixtures/component/activationkey.py b/pytest_fixtures/component/activationkey.py index 0f8cb2711e4..8f5775623f7 100644 --- a/pytest_fixtures/component/activationkey.py +++ b/pytest_fixtures/component/activationkey.py @@ -73,6 +73,5 @@ def module_ak_with_synced_repo(module_sca_manifest_org, module_target_sat): 'lifecycle-environment': 'Library', 'content-view': 'Default Organization View', 'organization-id': module_sca_manifest_org.id, - 'auto-attach': False, } ) diff --git a/pytest_fixtures/component/repository.py b/pytest_fixtures/component/repository.py index 2d5d29e0b71..02ee130c236 100644 --- a/pytest_fixtures/component/repository.py +++ b/pytest_fixtures/component/repository.py @@ -89,7 +89,7 @@ def setup_content(module_target_sat, module_org): cvv = cv.read().version[0].read() cvv.promote(data={'environment_ids': lce.id, 'force': False}) ak = module_target_sat.api.ActivationKey( - content_view=cv, max_hosts=100, organization=org, environment=lce, auto_attach=True + content_view=cv, max_hosts=100, organization=org, environment=lce ).create() return ak, org, custom_repo diff --git a/pytest_fixtures/component/rh_cloud.py b/pytest_fixtures/component/rh_cloud.py index c88d16444e4..8242a603c92 100644 --- a/pytest_fixtures/component/rh_cloud.py +++ b/pytest_fixtures/component/rh_cloud.py @@ -51,7 +51,6 @@ def rhcloud_activation_key(module_target_sat_insights, rhcloud_manifest_org): service_level='Self-Support', purpose_usage='test-usage', purpose_role='test-role', - auto_attach=False, ).create() diff --git a/pytest_fixtures/component/taxonomy.py b/pytest_fixtures/component/taxonomy.py index e25a5cd527d..ddbd55eee3d 100644 --- a/pytest_fixtures/component/taxonomy.py +++ b/pytest_fixtures/component/taxonomy.py @@ -140,9 +140,7 @@ def session_sca_manifest(): def module_extra_rhel_sca_manifest(): """Yields a manifest in sca mode with subscriptions determined by the 'manifest_category.extra_rhel_entitlement` setting in conf/manifest.yaml.""" - with Manifester( - manifest_category=settings.manifest.extra_rhel_entitlement, simple_content_access="enabled" - ) as manifest: + with Manifester(manifest_category=settings.manifest.extra_rhel_entitlement) as manifest: yield manifest diff --git a/pytest_fixtures/core/contenthosts.py b/pytest_fixtures/core/contenthosts.py index 79dc3989b8a..7791a2af69f 100644 --- a/pytest_fixtures/core/contenthosts.py +++ b/pytest_fixtures/core/contenthosts.py @@ -140,7 +140,6 @@ def katello_host_tools_host(target_sat, module_org, rhel_contenthost): max_hosts=100, organization=module_org, environment=target_sat.api.LifecycleEnvironment(id=module_org.library.id), - auto_attach=True, ).create() rhel_contenthost.register(module_org, None, ak.name, target_sat, repo_data=f'repo={repo}') rhel_contenthost.install_katello_host_tools() diff --git a/robottelo/cli/host.py b/robottelo/cli/host.py index 0704edac328..e82f89af49c 100644 --- a/robottelo/cli/host.py +++ b/robottelo/cli/host.py @@ -446,23 +446,6 @@ def subscription_remove(cls, options=None): cls.command_sub = 'subscription remove' return cls.execute(cls._construct_command(options)) - @classmethod - def subscription_auto_attach(cls, options=None): - """Auto attach subscription to host - - Usage:: - - hammer host subscription auto-attach [OPTIONS] - - Options:: - - --host HOST_NAME Name to search by - --host-id HOST_ID - -h, --help print help - """ - cls.command_sub = 'subscription auto-attach' - return cls.execute(cls._construct_command(options)) - @classmethod def sc_params(cls, options=None): """List all smart class parameters diff --git a/robottelo/cli/simple_content_access.py b/robottelo/cli/simple_content_access.py deleted file mode 100644 index 6f128a84f17..00000000000 --- a/robottelo/cli/simple_content_access.py +++ /dev/null @@ -1,46 +0,0 @@ -""" -Usage:: - - hammer simple-content-access [OPTIONS] SUBCOMMAND [ARG] ... - -Parameters:: - - SUBCOMMAND subcommand - [ARG] ... subcommand arguments - -Subcommands:: - - disable Disable simple content access for a manifest - enable Enable simple content access for a manifest - status Check if the specified organization has - Simple Content Access enabled - -""" - -from robottelo.cli.base import Base - - -class SimpleContentAccess(Base): - """ - Manipulates Katello engine's simple-content-access command. - """ - - command_base = 'simple-content-access' - - @classmethod - def disable(cls, options=None, timeout=None): - """Disable simple content access for a manifest""" - cls.command_sub = 'disable' - return cls.execute(cls._construct_command(options), ignore_stderr=True, timeout=timeout) - - @classmethod - def enable(cls, options=None, timeout=None): - """Enable simple content access for a manifest""" - cls.command_sub = 'enable' - return cls.execute(cls._construct_command(options), ignore_stderr=True, timeout=timeout) - - @classmethod - def status(cls, options=None, timeout=None): - """Check if the specified organization has Simple Content Access enabled""" - cls.command_sub = 'status' - return cls.execute(cls._construct_command(options), ignore_stderr=True, timeout=timeout) diff --git a/robottelo/host_helpers/satellite_mixins.py b/robottelo/host_helpers/satellite_mixins.py index 4dea6e3f88a..1645685164a 100644 --- a/robottelo/host_helpers/satellite_mixins.py +++ b/robottelo/host_helpers/satellite_mixins.py @@ -171,16 +171,6 @@ def upload_manifest(self, org_id, manifest=None, interface='API', timeout=None): ) return result - def is_sca_mode_enabled(self, org_id): - """This method checks whether Simple Content Access (SCA) mode is enabled for a - given organization. - - :param str org_id: The unique identifier of the organization to check for SCA mode. - :return: A boolean value indicating whether SCA mode is enabled or not. - :rtype: bool - """ - return self.api.Organization(id=org_id).read().simple_content_access - def publish_content_view(self, org, repo_list, name=None): """This method publishes the content view for a given organization and repository list. diff --git a/robottelo/hosts.py b/robottelo/hosts.py index d2edc8307ff..33bed747cf2 100644 --- a/robottelo/hosts.py +++ b/robottelo/hosts.py @@ -740,7 +740,6 @@ def register_contenthost( name=None, username=settings.server.admin_username, password=settings.server.admin_password, - auto_attach=False, serverurl=None, baseurl=None, ): @@ -760,8 +759,6 @@ def register_contenthost( :param releasever: Set a release version :param username: a user name to register the content host with :param password: the user password - :param auto_attach: automatically attach compatible subscriptions to - this system. :param name: name of the system to register, defaults to the hostname :param serverurl: name of the subscription service with which to register the system @@ -789,8 +786,6 @@ def register_contenthost( # if no other methods are provided, we can still try user/pass cmd += userpass # Additional registration modifiers - if auto_attach: - cmd += ' --auto-attach' if releasever: cmd += f' --release {releasever}' if force: diff --git a/tests/foreman/api/test_activationkey.py b/tests/foreman/api/test_activationkey.py index 5f462151be4..9fd4d90d4a1 100644 --- a/tests/foreman/api/test_activationkey.py +++ b/tests/foreman/api/test_activationkey.py @@ -350,23 +350,6 @@ def test_positive_remove_host_collection(module_org, module_target_sat): assert len(act_key.read().host_collection) == 0 -def test_positive_update_auto_attach(target_sat, module_org): - """Create an activation key, then update the auto_attach - field with the inverse boolean value. - - :id: ec225dad-2d27-4b37-989d-1ba2c7f74ac4 - - :expectedresults: The value is changed. - - :CaseImportance: Critical - """ - act_key = target_sat.api.ActivationKey(organization=module_org).create() - act_key_2 = target_sat.api.ActivationKey( - id=act_key.id, organization=module_org, auto_attach=(not act_key.auto_attach) - ).update(['auto_attach']) - assert act_key.auto_attach != act_key_2.auto_attach - - @pytest.mark.upgrade @pytest.mark.parametrize('name', **parametrized(valid_data_list())) def test_positive_delete(name, target_sat): diff --git a/tests/foreman/api/test_host.py b/tests/foreman/api/test_host.py index bc5b8eb5c4d..9f589951b1d 100644 --- a/tests/foreman/api/test_host.py +++ b/tests/foreman/api/test_host.py @@ -1075,19 +1075,64 @@ def test_positive_add_future_subscription_with_ak(): @pytest.mark.stubbed -def test_negative_auto_attach_future_subscription(): - """Run auto-attach on a content host, with a current and future-dated - subscription. +def test_positive_verify_files_with_pxegrub_uefi(): + """Provision a new Host and verify the tftp and dhcpd file + structure is correct + + :id: 0c51c8ad-858c-44e1-8b14-8e0c52c29da1 + + :steps: + + 1. Associate a pxegrub-type provisioning template with the os + 2. Create new host (can be fictive bare metal) with the above OS + and PXE loader set to Grub UEFI + 3. Build the host + + :expectedresults: Verify [/var/lib/tftpboot/] contains the following + dir/file structure: + + grub/bootia32.efi + grtest_positive_verify_files_with_pxegrub_uefiub/bootx64.efi + grub/01-AA-BB-CC-DD-EE-FF + grub/efidefault + grub/shim.efi + + And record in /var/lib/dhcpd/dhcpd.leases points to the bootloader + + :CaseAutomation: NotAutomated + """ - :id: f4a6feec-baf8-40c6-acb3-474b34419a62 + +@pytest.mark.stubbed +def test_positive_verify_files_with_pxegrub_uefi_secureboot(): + """Provision a new Host and verify the tftp and dhcpd file structure is + correct + + :id: ac4d535f-09bb-49db-b38b-90f9bad5fa19 :steps: - 1. Import a manifest with a future-dated and current subscription - 2. Register a content host to the organization - 3. Run auto-attach on the content host + 1. Associate a pxegrub-type provisioning template with the os + 2. Create new host (can be fictive bare metal) with the above OS + and PXE loader set to Grub UEFI SecureBoot + 3. Build the host + + :expectedresults: Verify [/var/lib/tftpboot/] contains the following + dir/file structure: + + grub/bootia32.efi + grub/bootx64.efi + grub/01-AA-BB-CC-DD-EE-FF + grub/efidefault + grub/shim.efi - :expectedresults: Only the current subscription was added to the host + And record in /var/lib/dhcpd/dhcpd.leases points to the bootloader + + :CaseAutomation: NotAutomated + + :CaseComponent: Provisioning + + :Team: Rocket """ diff --git a/tests/foreman/api/test_reporttemplates.py b/tests/foreman/api/test_reporttemplates.py index 113c23153f9..502e0472832 100644 --- a/tests/foreman/api/test_reporttemplates.py +++ b/tests/foreman/api/test_reporttemplates.py @@ -75,7 +75,7 @@ def setup_content(module_sca_manifest_org, module_target_sat): cvv = cv.read().version[0].read() cvv.promote(data={'environment_ids': lce.id, 'force': False}) ak = module_target_sat.api.ActivationKey( - content_view=cv, max_hosts=100, organization=org, environment=lce, auto_attach=True + content_view=cv, max_hosts=100, organization=org, environment=lce ).create() all_content = ak.product_content(data={'content_access_mode_all': '1'})['results'] content_label = [repo['label'] for repo in all_content if repo['name'] == custom_repo.name][0] diff --git a/tests/foreman/api/test_subscription.py b/tests/foreman/api/test_subscription.py index 3e46589b917..efcc363e864 100644 --- a/tests/foreman/api/test_subscription.py +++ b/tests/foreman/api/test_subscription.py @@ -71,7 +71,6 @@ def module_ak(module_sca_manifest_org, rh_repo, custom_repo, module_target_sat): environment=module_target_sat.api.LifecycleEnvironment( id=module_sca_manifest_org.library.id ), - auto_attach=True, ).create() @@ -227,11 +226,6 @@ def test_sca_end_to_end( ) assert result.status == 0, f'Failed to register host: {result.stderr}' assert rhel_contenthost.subscribed - # Check to see if Organization is in SCA Mode - assert ( - target_sat.api.Organization(id=module_sca_manifest_org.id).read().simple_content_access - is True - ) # Verify that you cannot attach a subscription to an activation key in SCA Mode subscription = target_sat.api.Subscription(organization=module_sca_manifest_org).search( query={'search': f'name="{DEFAULT_SUBSCRIPTION_NAME}"'} @@ -347,7 +341,6 @@ def test_positive_expired_SCA_cert_handling(module_sca_manifest_org, rhel_conten max_hosts=100, organization=module_sca_manifest_org, environment=target_sat.api.LifecycleEnvironment(id=module_sca_manifest_org.library.id), - auto_attach=True, ).create() # registering the content host with no content enabled/synced in the org # should create a client SCA cert with no content diff --git a/tests/foreman/cli/test_activationkey.py b/tests/foreman/cli/test_activationkey.py index 65100374f6d..44dcb7b222b 100644 --- a/tests/foreman/cli/test_activationkey.py +++ b/tests/foreman/cli/test_activationkey.py @@ -1276,78 +1276,6 @@ def test_positive_copy_activationkey_and_check_content( assert new_content[0]['name'] == REPOSET['rhst7'] -def test_positive_update_autoattach_toggle(module_org, module_target_sat): - """Update Activation key with inverse auto-attach value - - :id: de3b5fb7-7963-420a-b4c9-c66e78a111dc - - :steps: - - 1. Get the key's current auto attach value. - 2. Update the key with the value's inverse. - 3. Verify key was updated. - - :expectedresults: Activation key is successfully copied - - :CaseImportance: Critical - """ - new_ak = module_target_sat.cli_factory.make_activation_key({'organization-id': module_org.id}) - current_ak_auto_attach = module_target_sat.api.ActivationKey(id=new_ak['id']).read().auto_attach - module_target_sat.cli.ActivationKey.update( - { - 'auto-attach': str(not current_ak_auto_attach), - 'id': new_ak['id'], - 'organization-id': module_org.id, - } - ) - updated_ak_auto_attach = module_target_sat.api.ActivationKey(id=new_ak['id']).read().auto_attach - assert updated_ak_auto_attach == (not current_ak_auto_attach) - - -def test_positive_update_autoattach(module_org, module_target_sat): - """Update Activation key with valid auto-attach values - - :id: 9e18b950-6f0f-4f82-a3ac-ef6aba950a78 - - :expectedresults: Activation key is successfully updated - - :CaseImportance: Critical - """ - new_ak = module_target_sat.cli_factory.make_activation_key({'organization-id': module_org.id}) - for new_value in ('1', '0', 'true', 'false', 'yes', 'no'): - result = module_target_sat.cli.ActivationKey.update( - {'auto-attach': new_value, 'id': new_ak['id'], 'organization-id': module_org.id} - ) - assert result[0]['message'] == 'Activation key updated.' - - -def test_negative_update_autoattach(module_org, module_target_sat): - """Attempt to update Activation key with bad auto-attach value - - :id: 54b6f808-ff54-4e69-a54d-e1f99a4652f9 - - :steps: - - 1. Attempt to update a key with incorrect auto-attach value - 2. Verify that an appropriate error message was returned - - :expectedresults: Activation key is not updated. Appropriate error - shown. - - :CaseImportance: Low - """ - new_ak = module_target_sat.cli_factory.make_activation_key({'organization-id': module_org.id}) - with pytest.raises(CLIReturnCodeError) as exe: - module_target_sat.cli.ActivationKey.update( - { - 'auto-attach': gen_string('utf8'), - 'id': new_ak['id'], - 'organization-id': module_org.id, - } - ) - assert "'--auto-attach': value must be one of" in exe.value.stderr.lower() - - @pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url') def test_positive_content_override(module_org, module_target_sat): """Positive content override diff --git a/tests/foreman/cli/test_reporttemplates.py b/tests/foreman/cli/test_reporttemplates.py index 474156807e5..82e1ae5fee9 100644 --- a/tests/foreman/cli/test_reporttemplates.py +++ b/tests/foreman/cli/test_reporttemplates.py @@ -74,7 +74,6 @@ def local_ak(module_sca_manifest_org, local_environment, local_content_view, mod 'lifecycle-environment-id': local_environment['id'], 'content-view': local_content_view['name'], 'organization-id': module_sca_manifest_org.id, - 'auto-attach': False, } ) diff --git a/tests/foreman/data/hammer_commands.json b/tests/foreman/data/hammer_commands.json index 33380117967..165f419170c 100644 --- a/tests/foreman/data/hammer_commands.json +++ b/tests/foreman/data/hammer_commands.json @@ -442,12 +442,6 @@ "description": "Create an activation key", "name": "create", "options": [ - { - "help": "Auto attach subscriptions upon registration", - "name": "auto-attach", - "shortname": null, - "value": "BOOLEAN" - }, { "help": "Array of content view environment ids to be associated with the activation key. Ignored if content_view_id and lifecycle_environment_id are specified. Requires allow_multiple_content_views setting to be on.", "name": "content-view-environment-ids", @@ -1249,12 +1243,6 @@ "description": "Update an activation key", "name": "update", "options": [ - { - "help": "Auto attach subscriptions upon registration", - "name": "auto-attach", - "shortname": null, - "value": "BOOLEAN" - }, { "help": "Array of content view environment ids to be associated with the activation key. Ignored if content_view_id and lifecycle_environment_id are specified. Requires allow_multiple_content_views setting to be on.", "name": "content-view-environment-ids", @@ -22114,12 +22102,6 @@ "shortname": null, "value": "BOOLEAN" }, - { - "help": "Sets whether the Host will autoheal subscriptions upon checkin", - "name": "autoheal", - "shortname": null, - "value": "BOOLEAN" - }, { "help": "", "name": "build", @@ -22510,12 +22492,6 @@ "shortname": null, "value": "VALUE" }, - { - "help": "Service level to be used for autoheal", - "name": "service-level", - "shortname": null, - "value": "VALUE" - }, { "help": "VALUE/NUMBER Required if host is managed and value is not inherited from host group", "name": "subnet", @@ -24867,31 +24843,6 @@ ], "subcommands": [] }, - { - "description": "Trigger an auto-attach of subscriptions", - "name": "auto-attach", - "options": [ - { - "help": "VALUE/NUMBER Name/id of the host", - "name": "host", - "shortname": null, - "value": null - }, - { - "help": "VALUE/NUMBER Name/id of the host", - "name": "host-id", - "shortname": null, - "value": null - }, - { - "help": "Print help you can find option types and the value an option can accept: One of true/false, yes/no, 1/0 Date and time in YYYY-MM-DD HH:MM:SS or ISO 8601 format Possible values are described in the option's description Path to a file Comma-separated list of key=value. JSON is acceptable and preferred way for such parameters Comma separated list of values. Values containing comma should be quoted or escaped with backslash. JSON is acceptable and preferred way for such parameters Any combination of possible values described in the option's description Numeric value. Integer Comma separated list of values defined by a schema. JSON is acceptable and preferred way for such parameters Value described in the option's description. Mostly simple string", - "name": "help", - "shortname": "h", - "value": null - } - ], - "subcommands": [] - }, { "description": "Override product content defaults", "name": "content-override", @@ -25388,12 +25339,6 @@ "shortname": null, "value": "BOOLEAN" }, - { - "help": "Sets whether the Host will autoheal subscriptions upon checkin", - "name": "autoheal", - "shortname": null, - "value": "BOOLEAN" - }, { "help": "", "name": "build", @@ -25832,12 +25777,6 @@ "shortname": null, "value": "VALUE" }, - { - "help": "Service level to be used for autoheal", - "name": "service-level", - "shortname": null, - "value": "VALUE" - }, { "help": "VALUE/NUMBER Required if host is managed and value is not inherited from host group", "name": "subnet", diff --git a/tests/foreman/destructive/test_remoteexecution.py b/tests/foreman/destructive/test_remoteexecution.py index 062cf372417..2f159fbf59a 100644 --- a/tests/foreman/destructive/test_remoteexecution.py +++ b/tests/foreman/destructive/test_remoteexecution.py @@ -95,7 +95,6 @@ def test_positive_use_alternate_directory( 'lifecycle-environment': 'Library', 'content-view': 'Default Organization View', 'organization-id': default_org.id, - 'auto-attach': False, } ) result = client.register(default_org, default_location, ak.name, target_sat) diff --git a/tests/foreman/endtoend/test_api_endtoend.py b/tests/foreman/endtoend/test_api_endtoend.py index 732d89827a8..42818aaec18 100644 --- a/tests/foreman/endtoend/test_api_endtoend.py +++ b/tests/foreman/endtoend/test_api_endtoend.py @@ -426,7 +426,6 @@ '/api/hosts/:host_id/subscriptions', '/api/hosts/:host_id/subscriptions/add_subscriptions', '/api/hosts/:host_id/subscriptions/remove_subscriptions', - '/api/hosts/:host_id/subscriptions/auto_attach', '/api/hosts/:host_id/subscriptions/available_release_versions', '/api/hosts/:host_id/subscriptions/enabled_repositories', '/api/hosts/:host_id/subscriptions/content_override', @@ -492,7 +491,6 @@ '/api/hosts/bulk/remove_host_collections', '/api/hosts/bulk/add_subscriptions', '/api/hosts/bulk/remove_subscriptions', - '/api/hosts/bulk/auto_attach', '/api/hosts/bulk/applicable_errata', '/api/hosts/bulk/installable_errata', '/api/hosts/bulk/available_incremental_updates', diff --git a/tests/foreman/ui/test_contenthost.py b/tests/foreman/ui/test_contenthost.py index b5975fc9135..b9cfbdacf25 100644 --- a/tests/foreman/ui/test_contenthost.py +++ b/tests/foreman/ui/test_contenthost.py @@ -47,7 +47,7 @@ def host_ui_default(module_target_sat): @pytest.fixture(scope='module') def module_org(module_target_sat): - org = module_target_sat.api.Organization(simple_content_access=False).create() + org = module_target_sat.api.Organization().create() # adding remote_execution_connect_by_ip=Yes at org level module_target_sat.api.Parameter( name='remote_execution_connect_by_ip', diff --git a/tests/foreman/ui/test_reporttemplates.py b/tests/foreman/ui/test_reporttemplates.py index e3aaeecae9d..2c99bc05986 100644 --- a/tests/foreman/ui/test_reporttemplates.py +++ b/tests/foreman/ui/test_reporttemplates.py @@ -59,7 +59,7 @@ def module_setup_content(module_sca_manifest_org, module_target_sat): cvv = cv.read().version[0].read() cvv.promote(data={'environment_ids': lce.id}) ak = module_target_sat.api.ActivationKey( - content_view=cv, organization=org, environment=lce, auto_attach=True + content_view=cv, organization=org, environment=lce ).create() all_content = ak.product_content(data={'content_access_mode_all': '1'})['results'] content_label = [repo['label'] for repo in all_content if repo['name'] == custom_repo.name][0] diff --git a/tests/foreman/ui/test_rhc.py b/tests/foreman/ui/test_rhc.py index ff0ac228b58..088a6232f8c 100644 --- a/tests/foreman/ui/test_rhc.py +++ b/tests/foreman/ui/test_rhc.py @@ -72,7 +72,6 @@ def fixture_setup_rhc_satellite( manifester = Manifester( allocation_name=module_rhc_org.name, manifest_category=settings.manifest.golden_ticket, - simple_content_access="enabled", ) rhcloud_manifest = manifester.get_manifest() module_target_sat.upload_manifest(module_rhc_org.id, rhcloud_manifest.content) @@ -99,7 +98,6 @@ def fixture_setup_rhc_satellite( content_view=content_view, organization=module_rhc_org, environment=module_target_sat.api.LifecycleEnvironment(id=module_rhc_org.library.id), - auto_attach=True, ).create() logger.debug( f"Activation key: {ak} \n CV: {content_view} \n Organization: {module_rhc_org}" diff --git a/tests/new_upgrades/test_subscription.py b/tests/new_upgrades/test_subscription.py index 9e7758e5e85..4bdab3fd3f9 100644 --- a/tests/new_upgrades/test_subscription.py +++ b/tests/new_upgrades/test_subscription.py @@ -20,7 +20,6 @@ from manifester import Manifester import pytest -from robottelo import constants from robottelo.config import settings from robottelo.utils.shared_resource import SharedResource @@ -93,132 +92,3 @@ def test_manifest_scenario_refresh(manifest_scenario_refresh_setup): data={'organization_id': org.id} ) assert history[0]['statusMessage'] == "Subscriptions deleted by foreman_admin" - - -@pytest.fixture -def subscription_auto_attach_setup( - subscription_upgrade_shared_satellite, - upgrade_action, - rhel_contenthost, - subscription_upgrade_manifest, -): - """Create content host and register with Satellite - - :steps: - 1. Before Satellite upgrade. - 2. Create new Organization and Location. - 3. Upload a manifest in it. - 4. Create a AK with 'auto-attach False' and without Subscription add in it. - 5. Create a content host. - - :expectedresults: - 1. Content host should be created. - """ - target_sat = subscription_upgrade_shared_satellite - manifest = subscription_upgrade_manifest - with SharedResource(target_sat.hostname, upgrade_action, target_sat=target_sat) as sat_upgrade: - test_name = f'auto_attach_upgrade_{gen_alpha()}' - # Simultaneously creating multiple orgs has a high failure rate, - # so stagger the API calls. - xdist_worker_splay = int(os.environ.get('PYTEST_XDIST_WORKER')[-1]) * 10 - sleep(xdist_worker_splay) - org = target_sat.api.Organization(name=f'{test_name}_org').create() - target_sat.upload_manifest(org.id, manifest.content) - location = target_sat.api.Location(name=f'{test_name}_location').create() - library_id = int( - target_sat.cli.LifecycleEnvironment.list( - {'organization-id': org.id, 'library': 'true'} - )[0]['id'] - ) - lce = target_sat.api.LifecycleEnvironment( - name=f'{test_name}_lce', organization=org, prior=library_id - ).create() - if rhel_contenthost.os_version.major > 7: - rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo( - constants.REPOS[f'rhel{rhel_contenthost.os_version.major}_bos'], org.id - ) - else: - rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo( - constants.REPOS[f'rhel{rhel_contenthost.os_version.major}'], org.id - ) - rh_repo = target_sat.api.Repository(id=rh_repo_id).read() - assert rh_repo.content_counts['rpm'] >= 1 - content_view = target_sat.publish_content_view(org, rh_repo, f'{test_name}_content_view') - content_view.version[-1].promote(data={'environment_ids': lce.id}) - subscription = target_sat.api.Subscription(organization=org.id).search( - query={'search': f'name="{constants.DEFAULT_SUBSCRIPTION_NAME}"'} - ) - assert len(subscription) - activation_key = target_sat.api.ActivationKey( - name=f'{test_name}_ak', - content_view=content_view, - organization=org.id, - environment=lce, - auto_attach=False, - ).create() - rhel_contenthost.api_register( - target_sat, - organization=org, - location=location, - activation_keys=[activation_key.name], - ) - assert rhel_contenthost.subscribed - test_data = Box( - { - 'rhel_client': rhel_contenthost, - 'org': org, - 'satellite': target_sat, - } - ) - sat_upgrade.ready() - yield test_data - - -@pytest.mark.subscription_upgrades -@pytest.mark.rhel_ver_list([7, 8, 9, 10]) -@pytest.mark.no_containers -@pytest.mark.manifester -def test_subscription_scenario_auto_attach(subscription_auto_attach_setup): - """Run subscription auto-attach on pre-upgrade content host registered - with Satellite. - - :id: 940fc78c-ffa6-4d9a-9c4b-efa1b9480a22 - - :steps: - 1. Run subscription auto-attach on content host. - 2. Delete the manifest from the Satellite - - :expectedresults: After upgrade, - 1. Pre-upgrade content host should get subscribed. - 2. All the cleanup should be completed successfully. - """ - rhel_contenthost = subscription_auto_attach_setup.rhel_client - target_sat = subscription_auto_attach_setup.satellite - org = subscription_auto_attach_setup.org - result = rhel_contenthost.execute('yum install -y zsh') - assert result.status == 0, 'package was not installed' - sub = target_sat.api.Subscription(organization=org) - sub.delete_manifest(data={'organization_id': org.id}) - assert len(sub.search()) == 0 - - -@pytest.mark.subscription_upgrades -@pytest.mark.rhel_ver_match([settings.content_host.default_rhel_version]) -@pytest.mark.no_containers -@pytest.mark.manifester -def test_candlepin_hung_transaction(subscription_auto_attach_setup): - """Check that no open Candlepin transactions are present after upgrading - - :id: b2d8f844-3e9c-4c25-87a8-b9a2a21738b9 - - :steps: - After upgrade, check the Candlepin database for dangling transactions. - - :expectedresults: - No dangling transactions are present in the Candlepin database. - """ - result = subscription_auto_attach_setup.satellite.execute( - 'sudo -u postgres psql -d candlepin -c "SELECT * FROM pg_stat_activity WHERE state IN (\'idle in transaction\');"' - ) - assert result.status == 0 - assert 'idle in transaction' not in result.stdout diff --git a/tests/robottelo/test_hammer.py b/tests/robottelo/test_hammer.py index 225138cebfe..9d38dcc7e4b 100644 --- a/tests/robottelo/test_hammer.py +++ b/tests/robottelo/test_hammer.py @@ -457,7 +457,6 @@ def test_parse(self): ' UUID: uuid1', ' Last Checkin: 2019-12-13 00:00:00 UTC', ' Release Version:', - ' Autoheal: true', ' Registered To: keziah', ' Registered At: 2019-12-13 00:00:00 UTC', ' Registered by Activation Keys:', @@ -520,7 +519,6 @@ def test_parse(self): 'uuid': 'uuid1', 'last-checkin': '2019-12-13 00:00:00 UTC', 'release-version': '', - 'autoheal': 'true', 'registered-to': 'keziah', 'registered-at': '2019-12-13 00:00:00 UTC', 'registered-by-activation-keys': ['ak1'], diff --git a/tests/upgrades/test_subscription.py b/tests/upgrades/test_subscription.py index bfbfa59dbd3..65edddbed21 100644 --- a/tests/upgrades/test_subscription.py +++ b/tests/upgrades/test_subscription.py @@ -12,13 +12,8 @@ """ -from manifester import Manifester import pytest -from robottelo import constants -from robottelo.config import settings -from robottelo.hosts import ContentHost - class TestManifestScenarioRefresh: """ @@ -72,108 +67,3 @@ def test_post_manifest_scenario_refresh(self, request, target_sat, pre_upgrade_d data={'organization_id': org.id} ) assert history[0]['statusMessage'] == "Subscriptions deleted by foreman_admin" - - -class TestSubscriptionAutoAttach: - """ - The scenario to test auto-attachment of subscription on the client registered before - upgrade. - """ - - network_type = settings.server.network_type - - @pytest.mark.rhel_ver_list([7, 8, 9]) - @pytest.mark.no_containers - @pytest.mark.pre_upgrade - def test_pre_subscription_scenario_auto_attach( - self, - target_sat, - save_test_data, - rhel_contenthost, - sca_manifest_org_for_upgrade, - sca_manifest_for_upgrade, - ): - """Create content host and register with Satellite - - :id: preupgrade-940fc78c-ffa6-4d9a-9c4b-efa1b9480a22 - - :steps: - 1. Before Satellite upgrade. - 2. Create new Organization and Location. - 3. Upload a manifest in it. - 4. Create a AK with 'auto-attach False' and without Subscription add in it. - 5. Create a content host. - - :expectedresults: - 1. Content host should be created. - """ - _, manifester = sca_manifest_for_upgrade - org = sca_manifest_org_for_upgrade - rhel_contenthost._skip_context_checkin = True - lce = target_sat.api.LifecycleEnvironment(organization=org).create() - if rhel_contenthost.os_version.major > 7: - rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo( - constants.REPOS[f'rhel{rhel_contenthost.os_version.major}_bos'], org.id - ) - else: - rh_repo_id = target_sat.api_factory.enable_sync_redhat_repo( - constants.REPOS[f'rhel{rhel_contenthost.os_version.major}'], org.id - ) - rh_repo = target_sat.api.Repository(id=rh_repo_id).read() - assert rh_repo.content_counts['rpm'] >= 1 - content_view = target_sat.publish_content_view(org, rh_repo) - content_view.version[-1].promote(data={'environment_ids': lce.id}) - subscription = target_sat.api.Subscription(organization=org.id).search( - query={'search': f'name="{constants.DEFAULT_SUBSCRIPTION_NAME}"'} - ) - assert len(subscription) - activation_key = target_sat.api.ActivationKey( - content_view=content_view, - organization=org, - environment=lce, - auto_attach=False, - ).create() - rhel_contenthost.register(org, None, activation_key.name, target_sat) - assert rhel_contenthost.subscribed - save_test_data( - { - 'rhel_client': rhel_contenthost.hostname, - 'org_name': org.name, - 'allocation_uuid': manifester.allocation_uuid, - } - ) - - @pytest.mark.parametrize( - 'pre_upgrade_data', - [f'rhel7-{network_type}', f'rhel8-{network_type}', f'rhel9-{network_type}'], - indirect=True, - ) - @pytest.mark.post_upgrade(depend_on=test_pre_subscription_scenario_auto_attach) - @pytest.mark.manifester - def test_post_subscription_scenario_auto_attach(self, request, target_sat, pre_upgrade_data): - """Run subscription auto-attach on pre-upgrade content host registered - with Satellite. - - :id: postupgrade-940fc78c-ffa6-4d9a-9c4b-efa1b9480a22 - - :steps: - 1. Run subscription auto-attach on content host. - 2. Delete the content host, activation key, location & organization. - - :expectedresults: After upgrade, - 1. Pre-upgrade content host should get subscribed. - 2. All the cleanup should be completed successfully. - """ - rhel_contenthost = ContentHost.get_host_by_hostname(pre_upgrade_data.rhel_client) - result = rhel_contenthost.execute('yum install -y zsh') - assert result.status == 0, 'package was not installed' - org = target_sat.api.Organization().search( - query={'search': f'name={pre_upgrade_data.org_name}'} - )[0] - request.addfinalizer(org.delete) - sub = target_sat.api.Subscription(organization=org) - sub.delete_manifest(data={'organization_id': org.id}) - assert len(sub.search()) == 0 - manifester = Manifester(manifest_category=settings.manifest.golden_ticket) - request.addfinalizer(manifester.delete_subscription_allocation) - manifester.allocation_uuid = pre_upgrade_data.allocation_uuid