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

Take inline overrides into account in mandatory_include and bootstrap_include sections of a test plan (BugFix) #1079

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions checkbox-ng/plainbox/impl/unit/test_testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,30 @@ def test_nested_tesplan__multiple_namespaces(self):
self.assertIsInstance(qual_list[1].matcher, OperatorMatcher)
self.assertEqual(qual_list[1].matcher.value, 'ns2::Bar')
self.assertEqual(qual_list[1].inclusive, True)


class TestTestPlanUnitSupport(TestCase):

def setUp(self):
self.provider1 = mock.Mock(name='provider1', spec_set=IProvider1)
self.provider1.namespace = 'ns1'
self.tp1 = TestPlanUnit({
"id": "tp1",
"unit": "test plan",
"name": "An example test plan 1",
"mandatory_include": "mandatory_job certification_status=blocker",
"include": "job1 certification_status=non-blocker",
}, provider=self.provider1)
self.provider1.unit_list = []
self.tp1.provider_list = [self.provider1,]
self.provider1.unit_list.append(self.tp1)

def test_inline_override(self):
support = TestPlanUnitSupport(self.tp1)
self.assertEqual(
support.override_list,
[
("^ns1::job1$", [("certification_status", "non-blocker")]),
("^ns1::mandatory_job$", [("certification_status", "blocker")])
]
)
2 changes: 2 additions & 0 deletions checkbox-ng/plainbox/impl/unit/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,8 @@ def visit_IncludeStmt_node(self, node: IncludeStmt):
override_list.append((pattern, field_value_list))

V().visit(IncludeStmtList.parse(testplan.include))
if testplan.mandatory_include:
V().visit(IncludeStmtList.parse(testplan.mandatory_include))
pieqq marked this conversation as resolved.
Show resolved Hide resolved
for tp_unit in testplan.get_nested_part():
override_list.extend(self._get_inline_overrides(tp_unit))
return override_list
Loading