From 5a9c97147ed8b2b5096acc31c33e028e5ebad512 Mon Sep 17 00:00:00 2001 From: Matt Jia Date: Jul 05 2017 01:48:04 +0000 Subject: add a policy for Bodhi --- diff --git a/conf/policies/fedora.yaml b/conf/policies/fedora.yaml index e69de29..53b5e28 100644 --- a/conf/policies/fedora.yaml +++ b/conf/policies/fedora.yaml @@ -0,0 +1,11 @@ +# Tasktron release-critical tasks rule +# https://github.com/fedora-infra/fmn/blob/develop/fmn/rules/taskotron.py#L5 +--- !Policy +id: "taskotron_release_critical_tasks" +product_versions: + - fedora-26 +decision_context: bodhi_update_push_stable +rules: + - !PassingTestCaseRule {test_case_name: dist.abicheck} + - !PassingTestCaseRule {test_case_name: dist.rpmdeplint} + - !PassingTestCaseRule {test_case_name: dist.upgradepath} \ No newline at end of file diff --git a/functional-tests/test_api_v1.py b/functional-tests/test_api_v1.py index c7fe377..1af2e57 100644 --- a/functional-tests/test_api_v1.py +++ b/functional-tests/test_api_v1.py @@ -77,6 +77,12 @@ all_rpmdiff_testcase_names = [ 'dist.rpmdiff.comparison.xml_validity', ] +TASKTRON_RELEASE_CRITICAL_TASKS = [ + 'dist.abicheck', + 'dist.rpmdeplint', + 'dist.upgradepath', +] + def test_cannot_make_decision_without_product_version(requests_session, greenwave_server): data = { @@ -258,3 +264,27 @@ def test_unrestricted_policy_is_always_satisfied( expected_summary = 'no tests are required' assert res_data['summary'] == expected_summary assert res_data['unsatisfied_requirements'] == [] + + +def test_bodhi_push_update_stable_policy( + requests_session, greenwave_server, testdatabuilder): + nvr = testdatabuilder.unique_nvr() + for testcase_name in TASKTRON_RELEASE_CRITICAL_TASKS: + testdatabuilder.create_result(item=nvr, + testcase_name=testcase_name, + outcome='PASSED') + data = { + 'decision_context': 'bodhi_update_push_stable', + 'product_version': 'fedora-26', + 'subject': [nvr] + } + r = requests_session.post(greenwave_server.url + 'api/v1.0/decision', + headers={'Content-Type': 'application/json'}, + data=json.dumps(data)) + assert r.status_code == 200 + res_data = r.json() + assert res_data['policies_satisified'] is True + assert res_data['applicable_policies'] == ['taskotron_release_critical_tasks'] + expected_summary = 'all required tests passed' + assert res_data['summary'] == expected_summary + assert res_data['unsatisfied_requirements'] == []