Skip to content

Commit

Permalink
reproduce demo bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Senic committed Mar 8, 2023
1 parent 7d3b627 commit 08a3092
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ private Uni<Supplier<CommandResult>> insertOrdered(QueryExecutor queryExecutor)
.collect()
.in(InsertOperationPage::new, (agg, in) -> agg.aggregate(in, null))

// use object identity to resolve to Supplier<CommandResult>
.map(i -> i)

// in case upstream propagated FailFastInsertException
// ensure to construct correctly the information about inserted documents
.onFailure(FailFastInsertException.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import static org.hamcrest.Matchers.blankString;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
Expand Down Expand Up @@ -395,6 +396,47 @@ public void orderedDuplicateIds() {
.body("errors", is(nullValue()));
}

@Test
public void orderedDuplicateIdsNoNamespace() {
String json =
"""
{
"insertMany": {
"documents": [
{
"_id": "doc4",
"username": "user4"
},
{
"_id": "doc4",
"username": "user4_duplicate"
},
{
"_id": "doc5",
"username": "user5"
}
]
}
}
""";

given()
.header(HttpConstants.AUTHENTICATION_TOKEN_HEADER_NAME, getAuthToken())
.contentType(ContentType.JSON)
.body(json)
.when()
.post(CollectionResource.BASE_PATH, "something_else", collectionName)
.then()
.statusCode(200)
.body("status.insertedIds", is(empty()))
.body("data", is(nullValue()))
.body(
"errors[0].message",
startsWith(
"Failed to insert document with _id doc4: INVALID_ARGUMENT: keyspace something_else does not exist"))
.body("errors[0].exceptionClass", is("StatusRuntimeException"));
}

@Test
public void unordered() {
String json =
Expand Down

0 comments on commit 08a3092

Please sign in to comment.