From 2490d0af64f98cb40491432f7be43a41e1d70257 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Apr 27 2018 23:59:31 +0000 Subject: Schedule a Workstation upgrade flavor for update tests too It's pretty easy to add Workstation upgrade testing for updates now we did it for FreeIPA, so...let's! Signed-off-by: Adam Williamson --- diff --git a/fedora_openqa/schedule.py b/fedora_openqa/schedule.py index ae95d7c..95e9bfa 100644 --- a/fedora_openqa/schedule.py +++ b/fedora_openqa/schedule.py @@ -351,11 +351,19 @@ def jobs_from_update(update, version, flavors=None, force=False, extraparams=Non 'HDD_1': 'disk_f{0}_server_3_{1}.img'.format(version, arch), }, 'server-upgrade': { + # for upgrade tests run on updates, 'CURRREL' should be the + # release before the release the upgrade is for + 'CURRREL': str(int(version)-1), }, 'workstation': { 'HDD_1': 'disk_f{0}_desktop_4_{1}.img'.format(version, arch), 'DESKTOP': 'gnome', }, + 'workstation-upgrade': { + # for upgrade tests run on updates, 'CURRREL' should be the + # release before the release the upgrade is for + 'CURRREL': str(int(version)-1), + }, } baseparams = { 'DISTRI': 'fedora', @@ -366,9 +374,6 @@ def jobs_from_update(update, version, flavors=None, force=False, extraparams=Non # only obsolete pending jobs for same BUILD (i.e. update) '_ONLY_OBSOLETE_SAME_BUILD': '1', 'START_AFTER_TEST': '', - # for upgrade tests run on updates, 'CURRREL' should be the - # release before the release the upgrade is for - 'CURRREL': str(int(version)-1), } # mark if release is a development release; the tests need to know # also check if release is the oldest current stable, in which diff --git a/tests/test_schedule.py b/tests/test_schedule.py index 8ca4b11..04a457e 100644 --- a/tests/test_schedule.py +++ b/tests/test_schedule.py @@ -408,12 +408,12 @@ def test_jobs_from_update(fakeclient, fakecurr): fakeinst.openqa_request.return_value = {'jobs': [], 'ids': [1]} # simple case ret = schedule.jobs_from_update('FEDORA-2017-b07d628952', '25') - # should get three jobs (as we schedule for three flavors by default) - assert ret == [1, 1, 1] + # should get four jobs (as we schedule for four flavors by default) + assert ret == [1, 1, 1, 1] # find the POST calls posts = [call for call in fakeinst.openqa_request.call_args_list if call[0][0] == 'POST'] - # three flavors by default, three calls - assert len(posts) == 3 + # four flavors by default, four calls + assert len(posts) == 4 parmdicts = [call[0][2] for call in posts] parmdicts.sort() assert parmdicts == [ @@ -436,9 +436,19 @@ def test_jobs_from_update(fakeclient, fakecurr): 'ADVISORY': 'FEDORA-2017-b07d628952', '_ONLY_OBSOLETE_SAME_BUILD': '1', 'START_AFTER_TEST': '', + 'FLAVOR': 'updates-workstation-upgrade', + 'CURRREL': '24', + }, + { + 'DISTRI': 'fedora', + 'VERSION': '25', + 'ARCH': 'x86_64', + 'BUILD': 'Update-FEDORA-2017-b07d628952', + 'ADVISORY': 'FEDORA-2017-b07d628952', + '_ONLY_OBSOLETE_SAME_BUILD': '1', + 'START_AFTER_TEST': '', 'HDD_1': 'disk_f25_server_3_x86_64.img', 'FLAVOR': 'updates-server', - 'CURRREL': '24', }, { 'DISTRI': 'fedora', @@ -451,7 +461,6 @@ def test_jobs_from_update(fakeclient, fakecurr): 'HDD_1': 'disk_f25_desktop_4_x86_64.img', 'FLAVOR': 'updates-workstation', 'DESKTOP': 'gnome', - 'CURRREL': '24', } ] @@ -468,14 +477,14 @@ def test_jobs_from_update(fakeclient, fakecurr): fakeinst.openqa_request.reset_mock() fakecurr.side_effect = ValueError("Well, that was unfortunate") ret = schedule.jobs_from_update('FEDORA-2017-b07d628952', '26') - assert ret == [1, 1, 1] + assert ret == [1, 1, 1, 1] fakecurr.side_effect = None # check we don't schedule upgrade jobs when update is for oldest # stable release fakeinst.openqa_request.reset_mock() ret = schedule.jobs_from_update('FEDORA-2017-b07d628952', '24') - # upgrade flavor skipped, so two jobs + # upgrade flavors skipped, so two jobs assert ret == [1, 1] # test 'flavors' @@ -492,7 +501,7 @@ def test_jobs_from_update(fakeclient, fakecurr): # test dupe detection and 'force' fakeinst.openqa_request.reset_mock() - # this looks like a 'dupe' for the server and server-upgrade flavors + # this looks like a 'dupe' for the server and upgrade flavors fakeinst.openqa_request.return_value = { 'jobs': [ { @@ -505,11 +514,17 @@ def test_jobs_from_update(fakeclient, fakecurr): 'FLAVOR': 'updates-server-upgrade', }, }, + { + 'settings': { + 'FLAVOR': 'updates-workstation-upgrade', + }, + }, ], 'ids': [1], } ret = schedule.jobs_from_update('FEDORA-2017-b07d628952', '25') - # should get one job, as we shouldn't POST for server or server-upgrade + # should get one job, as we shouldn't POST for server, workstation-upgrade + # or server-upgrade assert ret == [1] # find the POST calls posts = [call for call in fakeinst.openqa_request.call_args_list if call[0][0] == 'POST'] @@ -520,8 +535,8 @@ def test_jobs_from_update(fakeclient, fakecurr): # now try with force=True fakeinst.openqa_request.reset_mock() ret = schedule.jobs_from_update('FEDORA-2017-b07d628952', '25', force=True) - # should get three jobs this time - assert ret == [1, 1, 1] + # should get four jobs this time + assert ret == [1, 1, 1, 1] # test extraparams fakeinst.openqa_request.reset_mock()