-
Notifications
You must be signed in to change notification settings - Fork 65
SWIFT-1610, SWIFT-1378, SWIFT-1632: Spec tests sync + expose clusterTime on ChangeStreamEvent #775
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
serverOpening, serverClosed, serverHeartbeatStarted, serverHeartbeatSucceeded, | ||
serverHeartbeatFailed | ||
case commandStartedEvent, commandSucceededEvent, commandFailedEvent, connectionCreatedEvent, connectionReadyEvent, | ||
connectionClosedEvent, connectionCheckedInEvent, connectionCheckOutStartedEvent, connectionCheckedOutEvent, |
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.
only actual change here mod reorganizing lines was adding connectionCheckOutStartedEvent
which one of the tests I synced uses
async let topologyType = try self.topologyType() | ||
async let serverVersion = try self.serverVersion() | ||
async let params = try self.serverParameters() | ||
async let topologyType = try await self.topologyType() |
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.
happened to notice while adding new test using this that this method was actually still calling the blocking methods that wait()
to get these values. oops
@@ -182,5 +184,24 @@ final class ChangeStreamTests: MongoSwiftTestCase { | |||
let testRunner = try await UnifiedTestRunner() | |||
try await testRunner.runFiles(tests) | |||
} | |||
|
|||
func testClusterTime() async throws { |
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.
while there is a spec test, we run all of the spec tests with a ChangeStream<BSONDocument>
since some of them do projections, etc. and don't match the model type. so this test is to assert we correctly deserialize the clusterTime when ChangeStreamEvent
is used.
@@ -234,7 +234,7 @@ final class MongoCursorAsyncAwaitTests: MongoSwiftTestCase { | |||
} | |||
|
|||
testAsync { | |||
let opts = CreateCollectionOptions(capped: true, size: 5) | |||
let opts = CreateCollectionOptions(capped: true, max: 5, size: 100_000) |
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 unrelated but this test starting failing against latest once SERVER-67246 went in. size
is actually supposed to be the max size in bytes, not the number of documents (that's what max
is for).
previously the server forced you to have a minimum max size of 4096, so the size
option here was basically ignored. but that restriction was removed and it is now valid to actually have a 5 byte capped collection. due to this, no documents could actually fit in the collection so this test started to fail.
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.
interesting, i'm surprised the previously incorrect value was silently ignored by the server
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 it's interesting; per the docs here:
If the size field is less than or equal to 4096, then the collection will have a cap of 4096 bytes.
@@ -234,7 +234,7 @@ final class MongoCursorAsyncAwaitTests: MongoSwiftTestCase { | |||
} | |||
|
|||
testAsync { | |||
let opts = CreateCollectionOptions(capped: true, size: 5) | |||
let opts = CreateCollectionOptions(capped: true, max: 5, size: 100_000) |
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.
interesting, i'm surprised the previously incorrect value was silently ignored by the server
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! Sorry for the delayed review
I picked up SWIFT-1610 which was a test sync; the sync also brought in the files from SWIFT-1378.
I also picked up SWIFT-1632 which I thought was just a test sync but it turns out we didn't have a
clusterTime
onChangeStreamEvent
. It seems like we decided against that in SWIFT-428 but now that there is a spec test it seems like we'd want to have one for compliance and parity with other drivers.