-
Notifications
You must be signed in to change notification settings - Fork 36
Move to GH actions #58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7c220ff
Move to GH actions
MrLotU db0dad8
Make time based tests less flakey
MrLotU 731ba3e
Merge branch 'master' into gh_actions
MrLotU e139f9e
Add debug output to failing tests
MrLotU 89d36a7
Don't run timing based tests on MacOS
MrLotU 8f58425
Merge branch 'master' into gh_actions
MrLotU 89f94d7
chore: Work around time-flakyness
MrLotU 2652588
chore: Re add swift 5.2 and 5.3
MrLotU 6e6a4ff
chore: Update the histogram test to allow for even more varying CI times
MrLotU d5ab6d2
Merge branch 'master' into gh_actions
MrLotU File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: tests | ||
on: { pull_request: {} } | ||
|
||
jobs: | ||
linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
docker: ['swift:5.2-focal', 'swift:5.3-focal', 'swift:5.4-focal'] | ||
container: ${{ matrix.docker }} | ||
steps: | ||
- name: Check out SwiftPrometheus | ||
uses: actions/checkout@v2 | ||
- name: Run tests with Thread Sanitizer | ||
timeout-minutes: 30 | ||
run: swift test --enable-test-discovery --sanitize=thread | ||
macos: | ||
runs-on: macos-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
toolchain: ['latest', 'latest-stable'] | ||
steps: | ||
- name: Select toolchain | ||
uses: maxim-lobanov/[email protected] | ||
with: | ||
xcode-version: ${{ matrix.toolchain }} | ||
- name: Check out SwiftPrometheus | ||
uses: actions/checkout@v2 | ||
- name: Run tests with Thread Sanitizer | ||
timeout-minutes: 30 | ||
run: swift test --enable-test-discovery --sanitize=thread |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super happy with this solution, but from some checking the MacOS runners make this sleep last somewhere between 0.05 and 0.1 seconds, which makes these tests incredibly flaky. Locally they run just fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any input appreciated. CC @ktoso
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can introduce the concept of time dilation. We used to do this all the time in Akka where we had very slow CI machines and had to adjust timeouts on them for all tests. It's documented a bit here: https://doc.akka.io/docs/akka/current/testing.html#accounting-for-slow-test-systems
This means that we'd do:
delay.dilated
where dilated would beSo in the CI, env we'd just set the TEST_TIME_DILATION_FACTOR=10 or something that makes it happy :-)
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly this would turn this test from sleeping for 0.05 seconds, to sleeping for 50. Which would than require to also update the asserts based on the time dilation, correct? In that case, would that not only make the problem worse?
In this case it's not a timeout that's messing things up, it's measuring the time a
Thread.sleep
takes, and on slow CI machines it takes longer than it's supposed to, resulting in "wrong" metrics.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I wasn't all to clear I guess. In such tests we need to adjust the "expectation" rather than the sleep -- so we'd apply the dilated to the expectation that the time was smaller than something.
All such sleepy tests are pretty meh so let's just give it a good best effort :-)