Skip to content

tests: harden DVS startup failure handling#4729

Open
StormLiangMS wants to merge 2 commits into
sonic-net:masterfrom
StormLiangMS:fix/dvs-service-startup-flake
Open

tests: harden DVS startup failure handling#4729
StormLiangMS wants to merge 2 commits into
sonic-net:masterfrom
StormLiangMS:fix/dvs-service-startup-flake

Conversation

@StormLiangMS

Copy link
Copy Markdown
Contributor

Why

Azure.sonic-sairedis PR CI intermittently fails in VS/DVS setup. The failure pattern tracked in #4728 shows DVS service readiness timing out while most services remain STOPPED and start.sh/syncd exit. After a failed recreate, follow-on tests can cascade with Redis socket and Docker No such container errors.

What changed

  • Increase default DVS service readiness wait from 60s to 180s.
  • Allow CI/local override via DVS_SERVICE_READY_TIMEOUT.
  • Clear the session-scoped DVS object after destroying it before recreation, so a failed constructor does not leave a stale destroyed DVS reference.
  • Skip session teardown when no DVS object exists, avoiding secondary NoneType/destroyed-container teardown errors after startup failure.

Validation

  • python -m py_compile tests/conftest.py tests/dvslib/dvs_common.py
  • git diff --check

Related

Increase the default DVS service readiness wait to reduce CI flakes under load, keep it configurable via DVS_SERVICE_READY_TIMEOUT, and avoid retaining a destroyed DVS object after failed recreation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Storm Liang <stormliang@microsoft.com>
Copilot AI review requested due to automatic review settings July 2, 2026 01:15
@StormLiangMS
StormLiangMS requested a review from prsunny as a code owner July 2, 2026 01:15
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

Copilot AI 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.

Pull request overview

This PR hardens the VS/DVS pytest harness in sonic-swss to reduce flaky CI failures during DVS startup by extending the service-readiness wait and making DVS lifecycle handling more resilient after startup failures.

Changes:

  • Increased default DVS service readiness timeout from 60s to 180s, with an environment-variable override (DVS_SERVICE_READY_TIMEOUT).
  • Cleared the session-scoped dvs reference after destroy so failed recreations don’t leave a stale destroyed object.
  • Skipped session teardown when no dvs object exists to avoid cascading cleanup errors after startup failures.

Comment thread tests/conftest.py Outdated
FABRIC_NUM_PORTS = 16

SINGLE_ASIC_VOQ_FS = "single_asic_voq_fs"
DEFAULT_DVS_SERVICE_READY_TIMEOUT = int(os.environ.get("DVS_SERVICE_READY_TIMEOUT", "180"))
Fall back to the default DVS service readiness timeout when DVS_SERVICE_READY_TIMEOUT is set to an invalid or empty value, so pytest collection is not broken by malformed environment input.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Storm Liang <stormliang@microsoft.com>
@mssonicbld

Copy link
Copy Markdown
Collaborator

/azp run

@azure-pipelines

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

@StormLiangMS

Copy link
Copy Markdown
Contributor Author

Addressed Copilot review feedback in ca03698: DVS_SERVICE_READY_TIMEOUT parsing is now guarded and falls back to 180 when the environment variable is empty or non-numeric, so pytest collection will not break on malformed input.

@theasianpianist

Copy link
Copy Markdown
Contributor

@StormLiangMS there were some DVS image changes were previously causing VS test issues, these should be fixed by this buildimage PR: sonic-net/sonic-buildimage#28108. Please check if you are still seeing issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants