Skip to content

Fix unstable unit tests (state change handler wasn't invoked)#8

Merged
zjswhhh merged 4 commits intosonic-net:masterfrom
zjswhhh:unstableUnitTests
Dec 1, 2021
Merged

Fix unstable unit tests (state change handler wasn't invoked)#8
zjswhhh merged 4 commits intosonic-net:masterfrom
zjswhhh:unstableUnitTests

Conversation

@zjswhhh
Copy link
Copy Markdown
Collaborator

@zjswhhh zjswhhh commented Nov 29, 2021

Description of PR

Summary:
Fixes # (issue)

Fix unstable unit tests.

People observed that linkmgrd unit tests appeared to be flaky, and kept failing PR checks. After checking the build logs, I found that in most of the failures, the state change handler didn't seem to be invoked: Linkmgrd's composite state remained as it was before the state change was post.

This PR updates code to invoke io_service::reset(), sets the io_service to no longer be in a stopped state, allowing subsequent calls to run_one() to invoke handlers. (When io_service is stopped, any call to run_one() will return immediately without invoking any handler. )

Signed-off-by: Jing Zhang zhangjing@microsoft.com

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

Back port request

  • 201911

Approach

What is the motivation for this PR?

Stabilize linkmgrd unit tests.

How did you do it?

Reset stopped io_service before calling to run_one(), to guarantee state change handlers are invoked as expected.

How did you verify/test it?

Tested building locally.

This issue is hard to reproduce, the current build failure data is 48 times in the last 30 days. We should expect to see improvement after this change.

reset mIoService before run_one()

Revert "reset mIoService before run_one()"

This reverts commit 68c51f5c5d1901dc23017712376d441bc6e6fede.
update unit test MuxStandbyLinkProberUnknownCliSwitchover

Revert "update unit test MuxStandbyLinkProberUnknownCliSwitchover"

This reverts commit 794387ae561706cfe279a677e24f32d247f6195d.

update unit test MuxStandbyLinkProberUnknownCliSwitchover

Revert "update unit test MuxStandbyLinkProberUnknownCliSwitchover"

This reverts commit 71ceab7b248af706882124c93d7bb0135a2397a2.
@zjswhhh zjswhhh linked an issue Nov 29, 2021 that may be closed by this pull request
@zjswhhh zjswhhh linked an issue Nov 29, 2021 that may be closed by this pull request
@zjswhhh zjswhhh requested a review from yxieca December 1, 2021 21:44
@zjswhhh zjswhhh merged commit 6c6151b into sonic-net:master Dec 1, 2021
@zjswhhh zjswhhh deleted the unstableUnitTests branch December 1, 2021 22:23
zjswhhh added a commit to zjswhhh/sonic-linkmgrd that referenced this pull request Dec 15, 2021
…net#8)

Description of PR
Summary:
Fixes # (issue)

Fix unstable unit tests.

People observed that linkmgrd unit tests appeared to be flaky, and kept failing PR checks. After checking the build logs, I found that in most of the failures, the state change handler didn't seem to be invoked: Linkmgrd's composite state remained as it was before the state change was post.

This PR updates code to invoke io_service::reset(), sets the io_service to no longer be in a stopped state, allowing subsequent calls to run_one() to invoke handlers. (When io_service is stopped, any call to run_one() will return immediately without invoking any handler. )

Signed-off-by: Jing Zhang zhangjing@microsoft.com

Type of change
 Bug fix

Approach
What is the motivation for this PR?
Stabilize linkmgrd unit tests.

How did you do it?
Reset stopped io_service before calling to run_one(), to guarantee state change handlers are invoked as expected.

How did you verify/test it?
Tested building locally.

This issue is hard to reproduce, the current build failure data is 2.98% (56/1877 in last 30 days). We should expect to see improvement after this change.
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.

unstable linkmgrd test issue unstable linkmgrd unit test

2 participants