Skip to content

[conftest]: Honor skip_check_dut_health marker in yang_validation_check#25263

Merged
yejianquan merged 1 commit into
sonic-net:masterfrom
sakshamkhurana21:sakkhurana/fix-yang-validation-skip-check-dut-health
Jun 15, 2026
Merged

[conftest]: Honor skip_check_dut_health marker in yang_validation_check#25263
yejianquan merged 1 commit into
sonic-net:masterfrom
sakshamkhurana21:sakkhurana/fix-yang-validation-skip-check-dut-health

Conversation

@sakshamkhurana21

Copy link
Copy Markdown
Contributor

Description of PR

Make the autouse yang_validation_check module-scoped fixture in tests/conftest.py
honor the skip_check_dut_health marker, matching the existing precedent set by
core_dump_and_config_check in the same file.

Today, yang_validation_check runs unconditionally for every test module, including
maintenance / recovery / reboot / upgrade / HA modules that intentionally operate
against a transiently unreachable or unhealthy DUT. This causes flakes, see below:

autorestart/test_container_autorestart.py::test_containers_autorestart[vlab-03-None-bgp] ERROR [  5%]

==================================== ERRORS ====================================
_______ ERROR at setup of test_containers_autorestart[vlab-03-None-bgp] ________

item = <Function test_containers_autorestart[vlab-03-None-bgp]>

Summary:
Fixes Flaky test

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • New Test case
    • Skipped for non-supported platforms
  • Test case improvement

Back port request

  • 202311
  • 202405
  • 202411
  • 202505
  • 202511
  • 202512
  • 202605

Approach

What is the motivation for this PR?

test_posttest::test_restore_container_autorestart[vlab-03] (and several other
maintenance modules) is flaky on PR validation runs.

How did you do it?

Added an early-yield gate inside yang_validation_check, immediately after the
existing --skip_yang flag handling, that follows the same idiom used by
core_dump_and_config_check (tests/conftest.py:3117-3119):

for m in request.node.iter_markers():
    if m.name == "skip_check_dut_health":
        logger.info(
            "Skipping YANG validation: module marked skip_check_dut_health"
        )
        yield
        return

Any platform specific information?

N/a

Supported testbed topology if it's a new test case?

N/a

Documentation

N/a

Signed-off-by: sakshamkhurana <sakkhurana@microsoft.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@auspham auspham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved as if the test is marked as skip_dut_health, we should tolerate yang validation as well.

@yejianquan yejianquan merged commit 9725226 into sonic-net:master Jun 15, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants