Skip to content
Draft
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 @@ -2,6 +2,8 @@

import static io.stargate.sgv2.jsonapi.api.v1.ResponseAssertions.responseIsDDLSuccess;
import static io.stargate.sgv2.jsonapi.api.v1.ResponseAssertions.responseIsError;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.is;

import io.quarkus.test.common.WithTestResource;
Expand Down Expand Up @@ -84,6 +86,27 @@ public void notExisting() {
.body("status.ok", is(1));
}

// [data-api#1186]: handling of non-existing keyspace
@Test
public void nonExistingKeyspace() {
givenHeadersAndJson(
"""
{
"deleteCollection": {
"name": "some-collection"
}
}
""")
.when()
.post(KeyspaceResource.BASE_PATH, "no_such_keyspace")
.then()
.statusCode(200)
.body("$", responseIsError())
.body("errors", hasSize(1))
.body("errors[0].errorCode", is("KEYSPACE_DOES_NOT_EXIST"))
.body("errors[0].message", containsString("no_such_keyspace"));
}

@Test
public void invalidCommand() {
givenHeadersAndJson(
Expand All @@ -98,8 +121,8 @@ public void invalidCommand() {
.then()
.statusCode(200)
.body("$", responseIsError())
.body("errors", hasSize(1))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated change, clean up.

.body("errors[0].errorCode", is("COMMAND_FIELD_INVALID"))
.body("errors[0].exceptionClass", is("JsonApiException"))
.body(
"errors[0].message",
is(
Expand Down
Loading