Is it platform specific
marvell
Importance or Severity
High
Description of the bug
The conditional_mark plugin (tests/common/plugins/conditional_mark/__init__.py) for test system_health/test_system_health.py aborts pytest collection on DUTs whose dut_basic_facts do not report branch / build_version (for example the Nokia arm64 BMC platform arm64-nokia_bmc_h6_128-r0).
Any mark rule in tests_mark_conditions.yaml referencing those variables raises NameError: name 'branch' is not defined, which fails the whole collection. Examples that trigger it:
syslog/test_syslog.py -> "branch in ['internal-202012']"
system_health/test_system_health.py::test_service_checker_with_process_exit -> "branch in ['internal-202012']" and "build_version.split('.')[1]..."
Two plugin issues combine to cause this:
evaluate_condition only defaults asic_type, platform, hwsku, and asic_gen to None, so any other fact referenced in a condition (branch, build_version, release) is undefined during eval().
evaluate_conditions applies AND/OR using non short-circuit list comprehensions (all([...]) / any([...])), so every condition is evaluated even after the result is already decided. A rule like branch in ['internal-202012'] followed by build_version.split('.')[1]... still evaluates the second condition and hits AttributeError on a None build_version.
Steps to Reproduce
- Run any pytest suite whose collected tests match a
tests_mark_conditions.yaml rule that references branch or build_version (e.g. system_health/test_system_health.py).
- Target a DUT/image whose
dut_basic_facts does not return branch/build_version, such as the Nokia arm64 BMC (arm64-nokia_bmc_h6_128-r0, topo_type "bmc").
- Collection aborts with
NameError: name 'branch' is not defined (or AttributeError on None.split for the build_version condition).
Actual Behavior and Expected Behavior
Actual: A single obsolete or fact-dependent rule (e.g. the internal-202012 rules) raises during condition evaluation and aborts collection for the entire run on images that report a reduced set of basic facts.
Expected: Missing facts should not crash collection. A condition that references an unavailable fact should evaluate safely (the rule simply does not apply), and evaluation should short-circuit so later fact-dependent conditions are not evaluated once the outcome is already determined.
Relevant log output
system_health/test_system_health.py::test_service_checker_with_process_exit
NameError: name 'branch' is not defined
# and, after guarding branch, the follow-on condition:
AttributeError: 'NoneType' object has no attribute 'split'
Output of show version
platform: arm64-nokia_bmc_h6_128-r0 (Nokia-7220-Th6p-2 BMC)
# dut_basic_facts on this image does not return 'branch' / 'build_version'
Attach files (if any)
Fix in progress via PR #28083: default branch/build_version/release to None in evaluate_condition and switch AND/OR evaluation in evaluate_conditions to short-circuit generator expressions.
Is it platform specific
marvell
Importance or Severity
High
Description of the bug
The
conditional_markplugin (tests/common/plugins/conditional_mark/__init__.py) for testsystem_health/test_system_health.pyaborts pytest collection on DUTs whosedut_basic_factsdo not reportbranch/build_version(for example the Nokia arm64 BMC platformarm64-nokia_bmc_h6_128-r0).Any mark rule in
tests_mark_conditions.yamlreferencing those variables raisesNameError: name 'branch' is not defined, which fails the whole collection. Examples that trigger it:syslog/test_syslog.py->"branch in ['internal-202012']"system_health/test_system_health.py::test_service_checker_with_process_exit->"branch in ['internal-202012']"and"build_version.split('.')[1]..."Two plugin issues combine to cause this:
evaluate_conditiononly defaultsasic_type,platform,hwsku, andasic_gentoNone, so any other fact referenced in a condition (branch,build_version,release) is undefined duringeval().evaluate_conditionsapplies AND/OR using non short-circuit list comprehensions (all([...])/any([...])), so every condition is evaluated even after the result is already decided. A rule likebranch in ['internal-202012']followed bybuild_version.split('.')[1]...still evaluates the second condition and hitsAttributeErroron aNonebuild_version.Steps to Reproduce
tests_mark_conditions.yamlrule that referencesbranchorbuild_version(e.g.system_health/test_system_health.py).dut_basic_factsdoes not returnbranch/build_version, such as the Nokia arm64 BMC (arm64-nokia_bmc_h6_128-r0,topo_type"bmc").NameError: name 'branch' is not defined(orAttributeErroronNone.splitfor thebuild_versioncondition).Actual Behavior and Expected Behavior
Actual: A single obsolete or fact-dependent rule (e.g. the
internal-202012rules) raises during condition evaluation and aborts collection for the entire run on images that report a reduced set of basic facts.Expected: Missing facts should not crash collection. A condition that references an unavailable fact should evaluate safely (the rule simply does not apply), and evaluation should short-circuit so later fact-dependent conditions are not evaluated once the outcome is already determined.
Relevant log output
Output of
show versionplatform: arm64-nokia_bmc_h6_128-r0 (Nokia-7220-Th6p-2 BMC) # dut_basic_facts on this image does not return 'branch' / 'build_version'Attach files (if any)
Fix in progress via PR #28083: default
branch/build_version/releasetoNoneinevaluate_conditionand switch AND/OR evaluation inevaluate_conditionsto short-circuit generator expressions.