-
-
Notifications
You must be signed in to change notification settings - Fork 50
Parallelise tests #3749
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
Parallelise tests #3749
Changes from all commits
Commits
Show all changes
61 commits
Select commit
Hold shift + click to select a range
5fe28a6
Add ShellOutCommand.launchDB and removeDB
finestructure 3ea5a3f
Add DatabasePool, DatabasePoolTests
finestructure 35cbe75
Add async retain and release db functions
finestructure 869e859
Bring up databases
finestructure ae9a820
Working SuiteTrait setUp/tearDown (requires Swift 6.1/Xcode 16.3)
finestructure 32c2429
Move DatabasePool to own file
finestructure 48c3d15
Extract Retry into App target
finestructure 00c6ee5
Move top level databasePool property to DatabasePool.shared
finestructure 4e6831e
Extract DatabasePoolSetupTrait
finestructure 3dabb1c
Add .setupDatabasePool to AllTests suite
finestructure 9567d5d
Add withDatabase RAII to withApp + Sendable annotations
finestructure 77a628a
Cleanup
finestructure 2703338
Create and tear down dbs concurrently
finestructure 32c61f4
Move db setup out of TestSupport, make non-static
finestructure c9aa8b1
DatabaseInfo → Database
finestructure a14ffa3
Avoid repeatedly loading dot env files via ConnectionDetails
finestructure 28dcb97
Cleanup, load dotfiles only once
finestructure b3ee76a
Drive pool size via env variable (optional)
finestructure db183f8
Drop database id, base docker name on port
finestructure 45c5a6e
Add DATABASEPOOL_TEARDOWN, optionally tear down all running dbs
finestructure 9faf0a2
Discover and re-use running dbs
finestructure 0993a26
Hardcode databases in CI
finestructure 218b11f
Drop --sanitize=thread
finestructure 2b7e1ff
Drop --no-parallel
finestructure ce8aaa4
Temporarily drop xcbeautify
finestructure ec3c50e
Update db-up-test, db-down-test with new setup
finestructure 1a3814c
Add comment about db setup
finestructure a05459c
Update .env.testing.template
finestructure fe33e52
Switch to swift test temporarily
finestructure 5f21bfc
Add debug logging
finestructure c9dd428
Only run AnalyzerTests
finestructure fd6b0a4
Try and set up dbs
finestructure 2c92e85
Disable db.setup call
finestructure f244e0a
Cleanup
finestructure 072cfd0
Add timeout to queries
finestructure eb6c397
Fix db name
finestructure 4b995a7
Limit precondition
finestructure d155a15
Set DATABASEPOOL_SIZE in ci.yml
finestructure 624711c
Tweaks
finestructure c97d050
Fix typo
finestructure c4df37e
Drop ports sections, rename dbs
finestructure c3cda2a
Make Database index based
finestructure d01e3bb
wip
finestructure 889a16b
Make sure db is configured for the correct host
finestructure 81b3410
Update db scripts
finestructure 59ff2a8
Revert some debug changes
finestructure c1719b7
Re-enable xcbeautify
finestructure 51c1cfb
Re-enable TSan
finestructure 3002bb0
Revert "Re-enable TSan"
finestructure 6d2b526
Bring back xcbeautify in perf test
finestructure 60e5371
Rename db-up|down-test → db-up|dow-ci, start|stop-test-dbs.sh → start…
finestructure 73dba2b
Cleanup
finestructure 695e76a
Drop references to db-up|down-test from Makefile
finestructure ea1dfd2
Update local development
finestructure b0ac336
Update local dev docs
finestructure 40b4b5d
Fix undiscovered docker command on macOS 15.4.1
finestructure 069baef
Cleanup
finestructure fc1d490
Fix QueryPerformanceTests
finestructure 4d54e2d
Update queryPerformance_12_Search_refresh expectation
finestructure 1a2f11a
Drop unused return parameter on configure
finestructure 80b785c
Add comment
finestructure 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 |
---|---|---|
@@ -1,11 +1,18 @@ | ||
{ | ||
"name": "spi-base", | ||
"build": { "dockerfile": "Dockerfile" }, | ||
"extensions": [ | ||
"sswg.swift-lang" | ||
], | ||
"settings": { | ||
"lldb.library": "/usr/lib/liblldb.so" | ||
"forwardPorts": [8080], | ||
"customizations": { | ||
"vscode": { | ||
"extensions": [ | ||
"sswg.swift-lang" | ||
], | ||
"settings": { | ||
"lldb.library": "/usr/lib/liblldb.so" | ||
} | ||
} | ||
}, | ||
"forwardPorts": [8080] | ||
"runArgs": [ | ||
"--network=spi_test" | ||
] | ||
} |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright Dave Verwer, Sven A. Schmidt, and other contributors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
|
||
public enum Retry { | ||
public enum Error: Swift.Error { | ||
case maxAttemptsExceeded | ||
} | ||
|
||
public enum BackoffStrategy { | ||
case constant(Duration) | ||
|
||
func delay(attempt: Int) async throws { | ||
switch self { | ||
case .constant(let duration): | ||
try await Task.sleep(for: duration) | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
@discardableResult | ||
public func run<T>( | ||
maxAttempts: Int = 3, | ||
backoff: Retry.BackoffStrategy = .constant(.milliseconds(100)), | ||
operation: (_ attempt: Int) async throws -> T, | ||
errorLogger logError: ((Error) -> Void) = { print("\($0)") } | ||
) async throws -> T { | ||
var attemptsLeft = maxAttempts | ||
while attemptsLeft > 0 { | ||
let attempt = maxAttempts - attemptsLeft + 1 | ||
do { | ||
return try await operation(attempt) | ||
} catch { | ||
logError(error) | ||
if attemptsLeft != maxAttempts { | ||
try? await backoff.delay(attempt: attempt) | ||
} | ||
attemptsLeft -= 1 | ||
} | ||
} | ||
throw Retry.Error.maxAttemptsExceeded | ||
} | ||
|
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
Oops, something went wrong.
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.
We have to drop TSan again, it keeps triggering when tests are run in parallel. It doesn't seem to be in code directly, it's in NIO. I don't think it's misuse on our end and I can't imagine it's a NIO problem, so perhaps a false positive.