def test_waive_missing_result(): answers = [ TestResultMissing( subject=test_subject(), test_case_name='test1', scenario='scenario1', source='https://greenwave_tests.example.com', ) ] waived = waive_answers(answers, []) assert answers == waived waivers = [ dict( subject_type='koji_build', subject_identifier='nethack-1.2.3-1.rawhide', product_version='rawhide', testcase='test1', ) ] waived = waive_answers(answers, waivers) expected_json = dict( type='test-result-missing-waived', testcase='test1', subject_type='koji_build', subject_identifier='nethack-1.2.3-1.rawhide', scenario='scenario1', source='https://greenwave_tests.example.com', ) assert 1 == len(waived) assert expected_json == waived[0].to_json()
def test_waive_invalid_gatin_yaml(): answers = [ InvalidRemoteRuleYaml( subject=test_subject(), test_case_name='invalid-gating-yaml', source='https://greenwave_tests.example.com', details='', ) ] waived = waive_answers(answers, []) assert answers == waived waivers = [ dict( subject_type='koji_build', subject_identifier='nethack-1.2.3-1.rawhide', product_version='rawhide', testcase='invalid-gating-yaml', ) ] waived = waive_answers(answers, waivers) assert [] == waived
def waive_answers(self, waivers_retriever): if not self.verbose: for answer in self.answers: if not answer.is_satisfied: self.waiver_filters.append(dict( subject_type=answer.subject.type, subject_identifier=answer.subject.identifier, product_version=self.product_version, testcase=answer.test_case_name, scenario=answer.scenario )) if self.waiver_filters: self.waivers = waivers_retriever.retrieve(self.waiver_filters) else: self.waivers = [] self.answers = waive_answers(self.answers, self.waivers)