Skip to content

tests: fix sleep durations - #1853

Closed
vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:wsleep
Closed

vszakats wants to merge 2 commits into
libssh2:masterfrom
vszakats:wsleep

Conversation

@vszakats

@vszakats vszakats commented Apr 11, 2026 •

Copy link
Copy Markdown
Member
  • openssh_fixture: fix overly long retry delay on non-Windows, when
    acquiring docker machine IP.

  • test_ssh2: fix overly short retry delay on Windows, on connect.

Follow-up to a459a25 #996
Follow-up to a88a727
Follow-up to 984d008 #490
Follow-up to cf80f2f

@vszakats vszakats added the tests label Apr 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 corrects Windows-specific sleep behavior in the test suite so retry/backoff delays behave consistently across platforms (Windows Sleep() takes milliseconds, unlike POSIX sleep() which takes seconds).

Changes:

  • Update portable_sleep() in tests/test_ssh2.c to convert seconds to milliseconds for Windows Sleep().
  • Update portable_sleep() in tests/openssh_fixture.c to convert seconds to milliseconds for Windows Sleep().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_ssh2.c Fixes Windows sleep unit conversion in the SSH2 test retry logic.
tests/openssh_fixture.c Fixes Windows sleep unit conversion in the OpenSSH fixture helper.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/openssh_fixture.c Resolved
@vszakats vszakats changed the title tests: fix sleep duration on Windows tests: fix sleep durations Apr 11, 2026
@vszakats
vszakats requested a review from Copilot April 11, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

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 updates test helpers to correct sleep timing on Windows by converting the Sleep() argument from seconds to milliseconds, aligning Windows behavior with POSIX sleep() usage.

Changes:

  • Update portable_sleep() in tests/test_ssh2.c to sleep the intended number of seconds on Windows.
  • Update portable_sleep() in tests/openssh_fixture.c similarly (Windows seconds → milliseconds).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_ssh2.c Fixes Windows retry backoff sleep duration by passing milliseconds to Sleep().
tests/openssh_fixture.c Changes Windows portable_sleep() semantics; impacts retry/backoff timing used elsewhere in this fixture code.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tests/openssh_fixture.c Resolved
@vszakats
vszakats requested a review from Copilot April 11, 2026 02:11

Copilot AI left a comment

Copy link
Copy Markdown

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 adjusts retry/backoff sleep durations in the test suite to use consistent time units across Windows and non-Windows platforms, reducing flaky behavior caused by sleeps that were effectively far too long or too short.

Changes:

  • Fix Windows sleep calls to use milliseconds (Sleep(seconds * 1000)) while keeping POSIX sleep(seconds).
  • Correct the initial docker-machine IP retry delay to be seconds-based (instead of an accidentally huge delay on non-Windows).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/test_ssh2.c Fixes Windows sleep duration so SSH connect retries wait the intended number of seconds.
tests/openssh_fixture.c Fixes Windows sleep duration and corrects docker-machine IP retry backoff start time to seconds-based delay.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

vszakats added a commit to vszakats/libssh2 that referenced this pull request Apr 12, 2026
- openssh_fixture: fix overly long retry delay on non-Windows, when
  acquiring docker machine IP.

- test_ssh2: fix overly short retry delay on Windows, on connect.

Follow-up to a459a25 libssh2#996
Follow-up to a88a727
Follow-up to 984d008 libssh2#490
Follow-up to cf80f2f

Closes libssh2#1853
@vszakats vszakats closed this in 007a36e Apr 13, 2026
@vszakats
vszakats deleted the wsleep branch April 13, 2026 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants