Skip to content

Skip test on MongoDB releases prior to 4.4. #1269

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 1 commit into from
Dec 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ public abstract class AbstractRetryableWritesTest {
private JsonPoweredCrudTestHelper helper;

public AbstractRetryableWritesTest(final String filename, final String description, final String databaseName, final BsonArray data,
final BsonDocument definition, final boolean skipTest) {
final BsonDocument definition, final boolean skipTest) {
assumeFalse("MongoDB releases prior to 4.4 incorrectly add errorLabels as a field withing the writeConcernError document "
+ "instead of as a top-level field. Rather than handle that in code, we skip the test on older server versions.",
description.equals("InsertOne fails after multiple retryable writeConcernErrors") && serverVersionLessThan(4, 4));
this.filename = filename;
this.description = description;
this.databaseName = databaseName;
Expand Down Expand Up @@ -166,7 +169,7 @@ private void assertExceptionState(final Exception e, final BsonValue expectedRes
MongoException mongoException = (MongoException) e;
for (String curErrorLabel : getErrorLabelsContainField(expectedResult)) {
assertTrue(String.format("Expected error label '%s but found labels '%s' for operation %s",
curErrorLabel, mongoException.getErrorLabels(), operationName),
curErrorLabel, mongoException.getErrorLabels(), operationName),
mongoException.hasErrorLabel(curErrorLabel));
}
}
Expand All @@ -176,7 +179,7 @@ private void assertExceptionState(final Exception e, final BsonValue expectedRes
MongoException mongoException = (MongoException) e;
for (String curErrorLabel : getErrorLabelsOmitField(expectedResult)) {
assertFalse(String.format("Expected error label '%s omitted but found labels '%s' for operation %s",
curErrorLabel, mongoException.getErrorLabels(), operationName),
curErrorLabel, mongoException.getErrorLabels(), operationName),
mongoException.hasErrorLabel(curErrorLabel));
}
}
Expand Down