-
Notifications
You must be signed in to change notification settings - Fork 67
SWIFT-1609 Async-ifying the Unified Test Runner and underlying operations #769
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
Conversation
…an be created, iterated, and closed
|
Apologies for a ton of minor commits for compiler directive things - tried switching swiftenv but since I cant run on terminal (weird env problems, can only build via xcode), the version switch didnt actully cascade down. Should be all fixed now + working on resolving an issue with sharding |
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
| #if compiler(>=5.5.2) && canImport(_Concurrency) | ||
| import MongoSwift | ||
| import Nimble | ||
| import NIOPosix |
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.
do we need the NIOPosix import?
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.
No, leftover from elg stuff during debugging. Removed.
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.
doesn't look like this actually got removed
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.
This is actually needed in order to use MultiThreadedEventLoopGroup in this file.
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
kmahar
left a comment
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.
thanks for addressing my comments! I have a few more mostly minor ones.
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
| for (_, client) in clientMap { | ||
| for entity in collEntities { | ||
| _ = try client.db(entity.namespace.db).runCommand( | ||
| _ = try? await client.db(entity.namespace.db).runCommand( |
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.
hmmm, I'd still like to understand why this only shows up now and never came up when the runner was sync. it might point to some subtle behavioral difference we're missing that results from this refactor. I'd think that we should be doing the same operation in the same order we were before. could you maybe link me to an example evergreen run where this happens so I can see the output?
kmahar
left a comment
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.
couple suggestions; otherwise LGTM mod ongoing thread about needing to try? the distinct workaround
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
Co-authored-by: Kaitlin Mahar <kaitlinmahar@gmail.com>
| @@ -0,0 +1,49 @@ | |||
| #if compiler(>=5.5.2) && canImport(_Concurrency) | |||
| import MongoSwift | |||
| import NIOPosix | |||
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.
I think we can get rid of the NIOPosix import
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.
Oops, remnant from experimenting with EventLoopGroup stuff. Removed
| ) | ||
| } catch { | ||
| // DB not explicitly initially created for operation-failure test bc no initialData | ||
| if !(error is MongoError.CommandError) { |
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 make this a little more specific actually, so that we don't ignore arbitrary command errors. the error code for NamespaceNotFound is 26.
let's do something like the logic here so that we only catch and ignore command errors with code 26:
mongo-swift-driver/Tests/MongoSwiftSyncTests/UnifiedTestRunner/UnifiedTestRunner.swift
Line 76 in 2d579e2
| } catch let commandError as MongoError.CommandError where commandError.code == 11601 {} |
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.
Makes sense. Was struggling with the syntax earlier but this really helps. Done.
| ["distinct": .string(entity.name), "key": "_id"] | ||
| ) | ||
| } catch { | ||
| // DB not explicitly initially created for operation-failure test bc no initialData |
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.
can we make this comment a little mores pecific? something like "this command can fail for tests that have no initialData specified and so do not create the namespace, such as the valid-fail/operation-failure.json test"
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.
Done. Moved comment to before the do/catch block
patrickfreed
left a comment
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.
Looks really good! Just have a few minor comments
Tests/MongoSwiftTests/UnifiedTestRunner/EntityDescription.swift
Outdated
Show resolved
Hide resolved
Tests/MongoSwiftTests/UnifiedTestRunner/UnifiedTestRunner.swift
Outdated
Show resolved
Hide resolved
isabelatkinson
left a comment
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.
lgtm, just one nit
| #if compiler(>=5.5.2) && canImport(_Concurrency) | ||
| import MongoSwift | ||
| import Nimble | ||
| import NIOPosix |
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.
doesn't look like this actually got removed
No description provided.