Skip to content

Commit 6ac3296

Browse files
vyadavmsftLiliDeng
authored andcommitted
Fix dynamic supported_os matching
The dynamic connected-environment OS check used SetSpace.check() directly against the node OS MRO. For allow sets, SetSpace.check() requires the capability set to contain every entry in the requirement, so supported_os=[CBLMariner, Ubuntu] was evaluated as CBLMariner AND Ubuntu instead of CBLMariner OR Ubuntu. Observed error: OS type mismatch: requires [Ubuntu, CBLMariner] but VM supports [..., CBLMariner, ...]. Fix the dynamic OS check to use any-of semantics for supported_os and none-of semantics for unsupported_os during connected-environment validation. This keeps precise suite metadata and prevents valid multi-distro cases from being skipped after deployment.
1 parent 94a82b3 commit 6ac3296

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

lisa/testsuite.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,24 @@ def check_environment(
218218
node_os_capability = search_space.SetSpace[Type[OperatingSystem]](
219219
is_allow_set=True, items=type(node.os).__mro__
220220
)
221-
os_result = requirement.os_type.check(node_os_capability)
221+
os_result = search_space.ResultReason()
222+
if requirement.os_type.is_allow_set:
223+
supported_os = set(requirement.os_type)
224+
node_os_types = set(node_os_capability)
225+
if not supported_os.intersection(node_os_types):
226+
os_result.add_reason(
227+
f"requires [{requirement.os_type}] "
228+
f"but VM supports [{node_os_capability}]"
229+
)
230+
else:
231+
excluded_os = set(requirement.os_type).intersection(
232+
node_os_capability
233+
)
234+
if excluded_os:
235+
names = sorted(os_type.__name__ for os_type in excluded_os)
236+
os_result.add_reason(
237+
f"requirements excludes {', '.join(names)}"
238+
)
222239
# If one of OS mismatches, mark the test case is skipped. It
223240
# assumes no more env can meet the requirements, instead of
224241
# checking the rest envs one by one. The reason is this checking

0 commit comments

Comments
 (0)