Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.15] fixes in host asserts #16968

Draft
wants to merge 1 commit into
base: 6.15.z
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions tests/foreman/cli/test_host.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,20 @@ def test_positive_create_and_delete(target_sat, module_lce_library, module_publi
)
assert f'{name}.{host.domain.read().name}' == new_host['name']
assert new_host['organization'] == host.organization.name
assert new_host['content-information']['content-view']['name'] == module_published_cv.name
assert (
new_host['content-information']['lifecycle-environment']['name'] == module_lce_library.name
new_host['content-information']['content-view-environments']['1']['content-view']['name']
== module_published_cv.name
)
assert (
new_host['content-information']['content-view-environments']['1']['lifecycle-environment'][
'name'
]
== module_lce_library.name
)
host_interface = target_sat.cli.HostInterface.info(
{'host-id': new_host['id'], 'id': new_host['network-interfaces'][0]['id']}
{'host-id': new_host['id'], 'id': new_host['network-interfaces']['1']['id']}
)
assert host_interface['domain'] == host.domain.read().name

target_sat.cli.Host.delete({'id': new_host['id']})
with pytest.raises(CLIReturnCodeError):
target_sat.cli.Host.info({'id': new_host['id']})
Expand Down Expand Up @@ -536,8 +541,16 @@ def test_positive_create_with_lce_and_cv(
'organization-id': module_org.id,
}
)
assert new_host['content-information']['lifecycle-environment']['name'] == module_lce.name
assert new_host['content-information']['content-view']['name'] == module_promoted_cv.name
assert (
new_host['content-information']['content-view-environments']['1']['lifecycle-environment'][
'name'
]
== module_lce.name
)
assert (
new_host['content-information']['content-view-environments']['1']['content-view']['name']
== module_promoted_cv.name
)


@pytest.mark.cli_host_create
Expand Down Expand Up @@ -703,14 +716,14 @@ def test_positive_list_infrastructure_hosts(
target_sat.cli.Host.update({'name': target_sat.hostname, 'new-organization-id': module_org.id})
# list satellite hosts
hosts = target_sat.cli.Host.list({'search': 'infrastructure_facet.foreman=true'})
assert len(hosts) == 2
assert len(hosts) == 1
hostnames = [host['name'] for host in hosts]
assert rhel7_contenthost.hostname not in hostnames
assert target_sat.hostname in hostnames
# list capsule hosts
hosts = target_sat.cli.Host.list({'search': 'infrastructure_facet.smart_proxy_id=1'})
hostnames = [host['name'] for host in hosts]
assert len(hosts) == 2
assert len(hosts) == 1
assert rhel7_contenthost.hostname not in hostnames
assert target_sat.hostname in hostnames

Expand Down Expand Up @@ -739,10 +752,17 @@ def test_positive_create_inherit_lce_cv(
{'hostgroup-id': hostgroup.id, 'organization-id': module_org.id}
)
assert (
int(host['content-information']['lifecycle-environment']['id'])
int(
host['content-information']['content-view-environments']['1']['lifecycle-environment'][
'id'
]
)
== hostgroup.lifecycle_environment.id
)
assert int(host['content-information']['content-view']['id']) == hostgroup.content_view.id
assert (
int(host['content-information']['content-view-environments']['1']['content-view']['id'])
== hostgroup.content_view.id
)


@pytest.mark.cli_host_create
Expand Down Expand Up @@ -854,14 +874,23 @@ def test_positive_list_with_nested_hostgroup(target_sat):
assert f'{parent_hg_name}/{nested_hg_name}' == hosts[0]['host-group']
host = target_sat.cli.Host.info({'id': hosts[0]['id']})
logger.info(f'Host info: {host}')
assert host['operating-system']['medium'] == options.medium.name
assert host['operating-system']['partition-table'] == options.ptable.name # inherited
assert host['operating-system']['medium']['name'] == options.medium.name
assert host['operating-system']['partition-table']['name'] == options.ptable.name # inherited
if not target_sat.is_stream:
assert 'id' in host['content-information']['lifecycle-environment']
assert int(host['content-information']['lifecycle-environment']['id']) == int(lce.id)
assert int(host['content-information']['content-view']['id']) == int(
content_view.id
) # inherited
assert (
'id'
in host['content-information']['content-view-environments']['1'][
'lifecycle-environment'
]
)
assert int(
host['content-information']['content-view-environments']['1']['lifecycle-environment'][
'id'
]
) == int(lce.id)
assert int(
host['content-information']['content-view-environments']['1']['content-view']['id']
) == int(content_view.id) # inherited


@pytest.mark.cli_host_create
Expand Down