Skip to content

Commit

Permalink
test_positive_end_to_end_bulk_update (#6956)
Browse files Browse the repository at this point in the history
* Test the Update All Packages button on Update Packages dialogue
* Use the Host Collection view to get to it.
  • Loading branch information
swadeley committed Jun 12, 2019
1 parent 5d60bd0 commit d2efa8d
Showing 1 changed file with 60 additions and 0 deletions.
60 changes: 60 additions & 0 deletions tests/foreman/ui_airgun/test_contenthost.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
SatelliteToolsRepository,
)
from robottelo.vm import VirtualMachine
from robottelo.api.utils import wait_for_tasks
from datetime import datetime


if not setting_is_set('clients') or not setting_is_set('fake_manifest'):
Expand Down Expand Up @@ -213,6 +215,64 @@ def test_positive_end_to_end(session, repos_collection, vm):
assert not session.contenthost.search(vm.hostname)


@upgrade
@tier3
def test_positive_end_to_end_bulk_update(session, vm):
"""Create VM, set up VM as host, register it as a content host,
read content host details, install a package ( e.g. walrus-0.71) and
use bulk action (Update All Packages) to update the package by name
to a later version.
:id: d460ba30-82c7-11e9-9af5-54ee754f2151
:expectedresults: package installation and update to a later version
are successful.
:BZ: 1712069
:CaseLevel: System
"""
hc_name = gen_string('alpha')
description = gen_string('alpha')
result = vm.run('yum -y install {0}'.format(FAKE_1_CUSTOM_PACKAGE))
assert result.return_code == 0
with session:
# Ensure content host is searchable
assert session.contenthost.search(vm.hostname)[0]['Name'] == vm.hostname

# Update package using bulk action
# use the Host Collection view to access Update Packages dialogue
session.hostcollection.create({
'name': hc_name,
'unlimited_hosts': False,
'max_hosts': 2,
'description': description
})
session.hostcollection.associate_host(hc_name, vm.hostname)
# Update the package by name
timestamp = datetime.utcnow()
session.hostcollection.manage_packages(
hc_name, content_type='Package',
packages=FAKE_1_CUSTOM_PACKAGE_NAME,
action='update_all'
)
# Wait for upload profile event (in case system system slow)
host = entities.Host().search(
query={'search': 'name={}'.format(vm.hostname)})
wait_for_tasks(
search_query='label = Actions::Katello::Host::UploadPackageProfile'
' and resource_id = {}'
' and started_at >= "{}"'.format(
host[0].id, timestamp),
search_rate=10, max_tries=10,
)
# Ensure package updated to a later version
packages = session.contenthost.search_package(vm.hostname, FAKE_2_CUSTOM_PACKAGE_NAME)
assert packages[0]['Installed Package'] == FAKE_2_CUSTOM_PACKAGE
# Delete content host
session.contenthost.delete(vm.hostname)


@tier3
def test_positive_search_by_subscription_status(session, vm):
"""Register host into the system and search for it afterwards by
Expand Down

0 comments on commit d2efa8d

Please sign in to comment.