mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(dynamodb): report a missing GSI on UpdateTable the way AWS does (#4564)
On AWS, deleting or updating a GSI the table does not have fails with ResourceNotFoundException "Requested resource not found: Index <index> for table <table>", with the table name even when TableName is an ARN. Floci used its own message for a delete and a ValidationException for an update.
This commit is contained in:
1 parent
5e2edcb89b
commit
e7e49f9125
3 files changed
+71
-4
No files matched your search
+64
@@ -530,6 +530,70 @@ class DynamoDbIntegrationTest {
|
||||
+ "[PROVISIONED, PAY_PER_REQUEST]"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void updateTableOnAMissingGsiReportsResourceNotFound() {
|
||||
given()
|
||||
.header("X-Amz-Target", "DynamoDB_20120810.CreateTable")
|
||||
.contentType(DYNAMODB_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"TableName": "MissingGsiTable",
|
||||
"KeySchema": [{"AttributeName": "pk", "KeyType": "HASH"}],
|
||||
"AttributeDefinitions": [{"AttributeName": "pk", "AttributeType": "S"}],
|
||||
"BillingMode": "PAY_PER_REQUEST"
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "DynamoDB_20120810.UpdateTable")
|
||||
.contentType(DYNAMODB_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"TableName": "MissingGsiTable",
|
||||
"GlobalSecondaryIndexUpdates": [{"Delete": {"IndexName": "does_not_exist"}}]
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ResourceNotFoundException"))
|
||||
.body("message", equalTo("Requested resource not found: Index does_not_exist for table MissingGsiTable"));
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "DynamoDB_20120810.UpdateTable")
|
||||
.contentType(DYNAMODB_CONTENT_TYPE)
|
||||
.body("""
|
||||
{
|
||||
"TableName": "MissingGsiTable",
|
||||
"GlobalSecondaryIndexUpdates": [
|
||||
{"Update": {"IndexName": "does_not_exist", "OnDemandThroughput": {"MaxReadRequestUnits": 10}}}
|
||||
]
|
||||
}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ResourceNotFoundException"))
|
||||
.body("message", equalTo("Requested resource not found: Index does_not_exist for table MissingGsiTable"));
|
||||
|
||||
given()
|
||||
.header("X-Amz-Target", "DynamoDB_20120810.DeleteTable")
|
||||
.contentType(DYNAMODB_CONTENT_TYPE)
|
||||
.body("""
|
||||
{"TableName": "MissingGsiTable"}
|
||||
""")
|
||||
.when()
|
||||
.post("/")
|
||||
.then()
|
||||
.statusCode(200);
|
||||
}
|
||||
|
||||
@Test
|
||||
void createTableWithGsiAndLsi() {
|
||||
given()
|
||||
|
||||
Reference in new issue
Block a user