Skip to content

tests: workaround for intermittent first test failures - #832

Merged
vszakats merged 1 commit into
libssh2:masterfrom
vszakats:tests-flakyness-test
Mar 9, 2023
Merged

vszakats merged 1 commit into
libssh2:masterfrom
vszakats:tests-flakyness-test

Conversation

@vszakats

@vszakats vszakats commented Mar 9, 2023 •

Copy link
Copy Markdown
Member

Flakiness got continously worse these last days. It didn't seem related to recent commits. Flakiness also picked up in GitHub CI runs, something rarely seen before. Manual restart consistently fixed them.

The repeating pattern was the first test (test_hostkey) failing, with libssh2_session_handshake failed (-13): Failed getting banner. Failures came after a lengthy wait, suggesting a timeout.

I then reversed the order of the first two tests, and it turned out that the first test failed again (test_hostkey_hash). Also pointing to a timeout issue.

Then I added a dummy test to "warm up" whatever needs warming up in the layers of CI + Docker + ssh server and their interconnects. This helped, and GitHub CI tests run without failure right for the first time. AppVeyor CI also improved a little.

This patch adds a new first test called test_warmup, that creates a new libssh2 session, and exits with success even if that attempt failed.

A stop-gap solution at best, and there is no guarantee it will continue to fix this or similar future issues, but it's also untenable to have almost every CI run fail for intermittent reasons.

In some cases it's not the first test failing intermittently. That's a different issue, and this patch doesn't fix it.


[ IMO the existing testing technique is on the heavy side with launching Docker machines for each test. It also prevents running tests without Docker, e.g. locally on macOS. It also fails in some of the existing CI machines (seen with GitHub CI MSYS jobs), due to Docker issues. There was #762 to help with this, as a first step. The curl project solved this without Docker. We might tap on those ideas. ]

@vszakats
vszakats marked this pull request as draft March 9, 2023 14:27
@vszakats
vszakats force-pushed the tests-flakyness-test branch from efcc630 to 65b0622 Compare March 9, 2023 14:51
@vszakats vszakats changed the title change test order 1 tests: change test order 1 Mar 9, 2023
@vszakats vszakats changed the title tests: change test order 1 tests: workaround for intermittent test 1 failures Mar 9, 2023
@vszakats vszakats changed the title tests: workaround for intermittent test 1 failures tests: workaround for intermittent test-1 failures Mar 9, 2023
@vszakats
vszakats marked this pull request as ready for review March 9, 2023 18:43
@vszakats vszakats changed the title tests: workaround for intermittent test-1 failures tests: workaround for intermittent first test failures Mar 9, 2023
@vszakats
vszakats force-pushed the tests-flakyness-test branch 2 times, most recently from da1b4ab to 6177032 Compare March 9, 2023 20:07
Flakiness got continously worse these last days. It didn't seem related
to recent commits. Flakiness also picked up in GitHub CI runs, something
rarely seen before. Manual restart consistently fixed them.

The repeating pattern was the _first_ test (`test_hostkey`) failing,
with `libssh2_session_handshake failed (-13): Failed getting banner`.
Failures came after a lengthy wait, suggesting a timeout.

I then reversed the order of the first two tests, and it turned out that
the _first_ test failed again (`test_hostkey_hash`). Also pointing to a
timeout issue.

Then I added a dummy test to "warm up" whatever needs warming up in the
layers of CI + Docker + ssh server and their interconnects. This helped,
and GitHub CI tests run without failure right for the first time.
AppVeyor CI also improved a little.

This patch adds a new first test called `test_warmup`, that creates a
new libssh2 session, and exits with success even if that attempt failed.

A stop-gap solution at best, and there is no guarantee it will continue
to fix this or similar future issues, but it's also untenable to have
almost every CI run fail for intermittent reasons.

In some [1] cases [2] it's not the first test failing intermittently.
That's a different issue, and this patch doesn't fix it.

[1] libssh2#804
[2] https://ci.appveyor.com/project/libssh2org/libssh2/builds/46440828/job/8rej6cq6itg7vc4w#L500
@vszakats
vszakats force-pushed the tests-flakyness-test branch from 6177032 to c645867 Compare March 9, 2023 23:38
@vszakats
vszakats merged commit 40ac6b2 into libssh2:master Mar 9, 2023
@vszakats
vszakats deleted the tests-flakyness-test branch March 9, 2023 23:54
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Flakiness got continously worse these last days. It didn't seem related
to recent commits. Flakiness also picked up in GitHub CI runs, something
rarely seen before. Manual restart consistently fixed them.

The repeating pattern was the _first_ test (`test_hostkey`) failing,
with `libssh2_session_handshake failed (-13): Failed getting banner`.
Failures came after a lengthy wait, suggesting a timeout.

I then reversed the order of the first two tests, and it turned out that
the _first_ test failed again (`test_hostkey_hash`). Also pointing to a
timeout issue.

Then I added a dummy test to "warm up" whatever needs warming up in the
layers of CI + Docker + ssh server and their interconnects. This helped,
and GitHub CI tests run without failure right for the first time.
AppVeyor CI also improved a little.

This patch adds a new first test called `test_warmup`, that creates a
new libssh2 session, and exits with success even if that attempt failed.

A stop-gap solution at best, and there is no guarantee it will continue
to fix this or similar future issues, but it's also untenable to have
almost every CI run fail for intermittent reasons.

In some [1] cases [2] it's not the first test failing intermittently.
That's a different issue, and this patch doesn't fix it.

[1] libssh2#804
[2] https://ci.appveyor.com/project/libssh2org/libssh2/builds/46440828/job/8rej6cq6itg7vc4w#L500
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.

1 participant