mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(dynamodb): use the current AWS wording for Scan validation errors (#5504)
This commit is contained in:
1 parent
3bdb07deac
commit
c047da882e
7 files changed
+64
-47
No files matched your search
+1
-2
@@ -341,8 +341,7 @@ class DynamoDbAccessPathIntegrationTest {
|
||||
""".formatted(TABLE))
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", equalTo("The provided starting key is invalid: "
|
||||
+ "The provided key element does not match the schema"));
|
||||
.body("message", equalTo("The provided starting key is invalid"));
|
||||
|
||||
request("DynamoDB_20120810.Query", """
|
||||
{
|
||||
|
||||
+1
-1
@@ -1078,7 +1078,7 @@ class DynamoDbIntegrationTest {
|
||||
.then()
|
||||
.statusCode(400)
|
||||
.body("__type", equalTo("ValidationException"))
|
||||
.body("message", equalTo("Must specify the AttributesToGet or "
|
||||
.body("message", equalTo("1 validation error detected: Must specify the AttributesToGet or "
|
||||
+ "ProjectionExpression when choosing to get SPECIFIC_ATTRIBUTES"));
|
||||
}
|
||||
|
||||
|
||||
+36
-6
@@ -1043,7 +1043,7 @@ class NativeDynamoDbJsonHandlerTest {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Segment": 0, "TotalSegments": 1000001}
|
||||
"""));
|
||||
assertEquals("1 validation error detected: Value '1000001' at 'totalSegments' failed to "
|
||||
assertEquals("1 validation error detected: Value at 'TotalSegments' failed to "
|
||||
+ "satisfy constraint: Member must have value less than or equal to 1000000", ex.getMessage());
|
||||
}
|
||||
|
||||
@@ -1066,7 +1066,7 @@ class NativeDynamoDbJsonHandlerTest {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Segment": -1, "TotalSegments": 4}
|
||||
"""));
|
||||
assertEquals("1 validation error detected: Value '-1' at 'segment' failed to satisfy constraint: "
|
||||
assertEquals("1 validation error detected: Value at 'Segment' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 0", ex.getMessage());
|
||||
}
|
||||
|
||||
@@ -1075,22 +1075,52 @@ class NativeDynamoDbJsonHandlerTest {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Segment": 0, "TotalSegments": 0}
|
||||
"""));
|
||||
assertEquals("1 validation error detected: Value '0' at 'totalSegments' failed to satisfy constraint: "
|
||||
assertEquals("1 validation error detected: Value at 'TotalSegments' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 1", ex.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanReportsTotalSegmentsBeforeSegmentWhenBothAreOutOfRange() {
|
||||
void scanReportsSegmentBeforeTotalSegmentsWhenBothAreOutOfRange() {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Segment": -1, "TotalSegments": 0}
|
||||
"""));
|
||||
assertEquals("2 validation errors detected: "
|
||||
+ "Value '0' at 'totalSegments' failed to satisfy constraint: "
|
||||
+ "Value at 'Segment' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 0; "
|
||||
+ "Value at 'TotalSegments' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 1", ex.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanReportsLimitAndSegmentTogetherBeforeTheTableLookup() {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Missing", "Limit": 0, "Segment": -1, "TotalSegments": 2}
|
||||
"""));
|
||||
assertEquals("2 validation errors detected: "
|
||||
+ "Value at 'Limit' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 1; "
|
||||
+ "Value '-1' at 'segment' failed to satisfy constraint: "
|
||||
+ "Value at 'Segment' failed to satisfy constraint: "
|
||||
+ "Member must have value greater than or equal to 0", ex.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanRejectsASegmentNotBelowTotalSegments() {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Segment": 5, "TotalSegments": 5}
|
||||
"""));
|
||||
assertEquals("The Segment parameter is zero-based and must be less than parameter TotalSegments",
|
||||
ex.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanPrefixesTheMissingProjectionForSpecificAttributes() {
|
||||
AwsException ex = expectValidationException("Scan", json("""
|
||||
{"TableName": "Users", "Select": "SPECIFIC_ATTRIBUTES"}
|
||||
"""));
|
||||
assertEquals("1 validation error detected: Must specify the AttributesToGet or ProjectionExpression "
|
||||
+ "when choosing to get SPECIFIC_ATTRIBUTES", ex.getMessage());
|
||||
}
|
||||
|
||||
@Test
|
||||
void scanAcceptsSegmentsAtTheBounds() throws Exception {
|
||||
createUsersTable("eu-west-1");
|
||||
|
||||
Reference in new issue
Block a user