Skip to content

SWIFT-1337, SWIFT-1629, SWIFT-1557, SWIFT-1566: Various maintenance-related changes #773

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 8 commits into from
Aug 29, 2022

Conversation

kmahar
Copy link
Contributor

@kmahar kmahar commented Aug 29, 2022

This is a collection of several minor changes; my original motivation here was dropping Swift 5.1 support and only depending on the necessary NIO modules, but in the process I ended up picking up some various greener build and Evergreen maintenance type changes that we've fallen behind on in recent months.

Included changes:

  • SWIFT-1337: Drop Swift 5.1 support
  • SWIFT-1629: Only depend on necessary NIO modules in the driver
  • SWIFT-1557: Test against MongoDB 6.0 in Evergreen
  • SWIFT-1566: Test MongoDB 5.0 + load balancer support
  • Test against latest MongoDB rapid release in Evergreen
  • Fix sharded cluster unified change stream spec tests on macOS
  • Fix broken testing against development snapshots by updating the Python script to dynamically get the latest dev snapshot from GitHub, similar to how it currently queries for patch releases. (I will port this to BSON after)
  • bump SwiftLint and SwiftFormat versions (installed new versions on my new laptop that found some new violations)

successful patch - failures are:

  • load balancer tests failing due to known new issue (SERVER-69146)
  • it seems like the new test APMTests.testCommandStreamBufferingPolicy perhaps needs a slightly longer timeout - it failed on sharded cluster + SSL + auth + macOS, the notoriously slow combo. I filed a separate ticket about addressing the flakiness: SWIFT-1630

@@ -1087,6 +1205,13 @@ axes:
PYTHON: "/opt/mongodbtoolchain/v3/bin/python3"
VENV_BIN_DIR: "bin"

- id: macos-10.14
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for similar reasons to the BSON PR re limited 10.15 hosts, the Swift 5.2 tests are now run on macOS 10.14

@@ -1418,4 +1554,4 @@ buildvariants:
ssl-auth: "*"
check-leaks: "leaks"
tasks:
- ".5.0"
- ".6.0 !.load-balancer"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we check for leaks on macOS which does not have haproxy installed and so cannot run LB tests.

this explicit skip wasn't necessary before because we were not running LB tests on 5.0

#if compiler(>=5.5.2) && canImport(_Concurrency)
return .upToNextMajor(from: "2.36.0")
#else
return .upToNextMajor(from: "2.15.0")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have left this in and updated this to be NIO 2.32 (the minimum version where the separate modules exist), but there didn't seem to be a huge benefit to doing so as 2.36.0 supports 5.2+, so I thought it was simpler and reasonable to remove the extra complexity here and require everyone to be on 2.36+.

message: "defaultAuthDB contains invalid character: \(character)"
)
}
for character in Self.forbiddenDBCharacters where defaultAuthDB.contains(character) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this and the other change in the file were linter changes due to the version updates. there's a swiftlint rule around preferring "for... where" over a "for" loop with a single nested "if", and I guess swiftlint previously missed these violations

_ = try client.db(entity.namespace.db).runCommand(
["distinct": .string(entity.name), "key": "_id"]
)
} catch let commandError as MongoError.CommandError where commandError.code == 26 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed that after I synced in the unified change stream spec tests, they started to fail on macOS + sharded clusters, with a similar NamespaceNotFound error problem to that Rohan was encountering.
I think this was likely also an issue around the exact namespaces that exist / don't exist at the time those tests are run due to test ordering

if !event.isHeartbeatEvent {
eventTypeSdam.append(event.type)
}
for try await event in client.sdamEventStream() where !event.isHeartbeatEvent {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another linter change

@@ -320,7 +320,7 @@ final class EventLoopBoundMongoClientTests: MongoSwiftTestCase {
defer { try? db.drop().wait() }

let wrongEventLoop = MultiThreadedEventLoopGroup(numberOfThreads: 4).next()
let withSessionFuture: EventLoopFuture<[String]> = elBoundClient.withSession { session in
let withSessionFuture = elBoundClient.withSession { session in
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the explicit annotation is not needed anymore, and that saves us importing NIOCore here

@kmahar kmahar requested a review from patrickfreed August 29, 2022 15:16
@kmahar kmahar marked this pull request as ready for review August 29, 2022 15:16
Copy link
Contributor

@patrickfreed patrickfreed left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! awesome job knocking all these different things out

@kmahar kmahar merged commit 3173036 into main Aug 29, 2022
@kmahar kmahar deleted the SWIFT-1337/drop-5.1 branch August 29, 2022 16:55
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.

2 participants