Skip to content

[sonic-mgmt] Fix test container_checker monit flaky issue. #21218

Merged
StormLiangMS merged 1 commit intosonic-net:masterfrom
prajjwal-arista:fix-msft906-test_container_checker_monit
Nov 13, 2025
Merged

[sonic-mgmt] Fix test container_checker monit flaky issue. #21218
StormLiangMS merged 1 commit intosonic-net:masterfrom
prajjwal-arista:fix-msft906-test_container_checker_monit

Conversation

@prajjwal-arista
Copy link
Contributor

@prajjwal-arista prajjwal-arista commented Nov 6, 2025

Description of PR

Summary:
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing the bugs found in pytest fixture "update_monit_service":

Fixes # 906

Type of change

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

Back port request

  • 202205
  • 202305
  • 202311
  • 202405
  • 202411
  • 202505

Approach

What is the motivation for this PR?

As per issue 906 test_container_checker test is flaky.

How did you do it?

It was found out from the failing vs passing logs that the flakiness is due to monit not alerting timely about the containers going down.
After code inspection it was found out that pytest fixture "update_monit_service" in test_container_checker.py was incorrectly updating the etc/monit/conf.d/sonic-host file before the test would begin.
The issue was tested to be resolved by :

  • fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for container_checker periodicity. (Currently the sed commands are updating the last line rule, which does not correctly update the container_checker alert periodicity rule.)
  • Adds wait_until with a pytest_assert after monit restart, to ensure tests are running when monit is properly up.

How did you verify/test it?

Running the test test_container_checker multiple times with the changes to see pass at each time.

Any platform specific information?

N/A

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

N/A

Documentation

N/A

@mssonicbld
Copy link
Collaborator

/azp run

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Nov 6, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: prajjwal-arista / name: Prajjwal Singh (caa4ba8)

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: aristanetworks/sonic-qual.msft#906
@prajjwal-arista prajjwal-arista force-pushed the fix-msft906-test_container_checker_monit branch from f9b5262 to caa4ba8 Compare November 6, 2025 13:51
@mssonicbld
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@lolyu lolyu left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS
Copy link
Collaborator

hi @ZhaohuiS This could be a reference for flaky issue we are handling.

Copy link
Collaborator

@StormLiangMS StormLiangMS left a comment

Choose a reason for hiding this comment

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

LGTM

@StormLiangMS StormLiangMS merged commit bc87f3a into sonic-net:master Nov 13, 2025
15 checks passed
mssonicbld pushed a commit to mssonicbld/sonic-mgmt that referenced this pull request Nov 18, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
@mssonicbld
Copy link
Collaborator

Cherry-pick PR to 202505: #21337

mssonicbld pushed a commit that referenced this pull request Nov 18, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
@prajjwal-arista prajjwal-arista deleted the fix-msft906-test_container_checker_monit branch November 18, 2025 08:46
vikumarks pushed a commit to vikumarks/sonic-mgmt that referenced this pull request Dec 1, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: vikumarks <[email protected]>
albertovillarreal-keys pushed a commit to albertovillarreal-keys/sonic-mgmt that referenced this pull request Dec 2, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Alberto Villarreal <[email protected]>
opcoder0 pushed a commit to opcoder0/sonic-mgmt that referenced this pull request Dec 8, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: aristanetworks/sonic-qual.msft#906

Signed-off-by: opcoder0 <[email protected]>
dcaugher pushed a commit to dcaugher/sonic-mgmt that referenced this pull request Dec 8, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Dan Caugherty <[email protected]>
nissampa pushed a commit to nissampa/sonic-mgmt_dpu_test that referenced this pull request Dec 9, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Nishanth Sampath Kumar <[email protected]>
selldinesh pushed a commit to selldinesh/sonic-mgmt that referenced this pull request Dec 11, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: selldinesh <[email protected]>
echuawu pushed a commit to echuawu/sonic-mgmt that referenced this pull request Dec 12, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
saravanan-nexthop pushed a commit to saravanan-nexthop/sonic-mgmt that referenced this pull request Dec 15, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Saravanan <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 16, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Guy Shemesh <[email protected]>
AharonMalkin pushed a commit to AharonMalkin/sonic-mgmt that referenced this pull request Dec 16, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Aharon Malkin <[email protected]>
gshemesh2 pushed a commit to gshemesh2/sonic-mgmt that referenced this pull request Dec 21, 2025
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Guy Shemesh <[email protected]>
venu-nexthop pushed a commit to venu-nexthop/sonic-mgmt that referenced this pull request Jan 13, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
yifan-nexthop pushed a commit to nexthop-ai/sonic-mgmt that referenced this pull request Jan 14, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: YiFan Wang <[email protected]>
lakshmi-nexthop pushed a commit to lakshmi-nexthop/sonic-mgmt that referenced this pull request Jan 28, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Lakshmi Yarramaneni <[email protected]>
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Jan 29, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
ytzur1 pushed a commit to ytzur1/sonic-mgmt that referenced this pull request Feb 2, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Yael Tzur <[email protected]>
abhishek-nexthop pushed a commit to nexthop-ai/sonic-mgmt that referenced this pull request Feb 6, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906
rraghav-cisco pushed a commit to rraghav-cisco/sonic-mgmt that referenced this pull request Feb 13, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Raghavendran Ramanathan <[email protected]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…) (sonic-net#21579)

[YangModel][asic_sensors] Add ASIC_SENSORS yang models
abhishek-nexthop pushed a commit to nexthop-ai/sonic-mgmt that referenced this pull request Mar 17, 2026
These changes fix the sonic-mgmt test "container_checker.py" flaky issue by fixing
the following issues in pytest fixture "update_monit_service":
 - fixing bug updating monit conf "/etc/monit/conf.d/sonic-host" for
   container_checker periodicity.
   (Currently the sed commands are updating the last line rule, which does not
    correctly update the container_checker alert periodicity rule.)
 - Adds wait_until after monit restart, to ensure tests are running when monit
   is properly up.

related bug: https://github.com/aristanetworks/sonic-qual.msft/issues/906

Signed-off-by: Abhishek <[email protected]>
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