DRIVERS-3006 Consolidate CSOT change stream timeout tests #1888
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.
DRIVERS-3006
Please complete the following before merging:
clusters).
Summary
The DRIVERS ticket reports a contradiction in the following two requirements from specifications:
[1] If a next call fails with a timeout error, drivers MUST NOT invalidate the change stream. The subsequent next call MUST perform a resume attempt to establish a new change stream on the server.
[2] If a resume is required for a next call on a change stream, the timeout MUST apply to the entirety of the initial getMore and all commands sent as part of the resume attempt.
While there appears to be no contradiction, the CSOT change stream test in question should be extended to include case [2].
Go Driver Implementation
Notably, the Go Driver skips this test:
GODRIVER-3380 provides a non-UST repro, you can run it directly here. As noted in the ticket, the fix for this is fairly straightforward in the Go Driver. In our case, [1] is just checking that we don’t invalidate on a timeout error [not current behavior]:
However, even if we made this change, the unified spec test responsible for testing this would still fail since it would be an anti-pattern in Go to use the deadline for a context passed to collection.Watch() for each call to collection.Next(), which is an implicit [at least] requirement of both the specs (see above) and the unified spec test in question:
This commit implements the following acceptance criteria from GODRIVER-3480 required to test the changes:
prestonvasquez/mongo-go-driver@808463a