Skip to content

Commit

Permalink
DynamoDB: fix wrong error message when key schema invalid (#7685)
Browse files Browse the repository at this point in the history
  • Loading branch information
adutra authored Nov 3, 2023
1 parent 4deb4ac commit 6d69653
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,10 @@ public void verifyKeySchema() {
try (DynamoDBBackend backend = testFactory.createNewBackend()) {
soft.assertThatIllegalStateException()
.isThrownBy(backend::setupSchema)
.withMessageStartingWith("Invalid key schema for table: ");
.withMessage(
"Invalid key schema for table: %s. "
+ "Key schema should be a hash partitioned attribute with the name '%s'.",
TABLE_REFS, KEY_NAME);
}

client.deleteTable(b -> b.tableName(TABLE_REFS));
Expand All @@ -187,7 +190,10 @@ public void verifyKeySchema() {
try (DynamoDBBackend backend = testFactory.createNewBackend()) {
soft.assertThatIllegalStateException()
.isThrownBy(backend::setupSchema)
.withMessageStartingWith("Invalid key schema for table: ");
.withMessage(
"Invalid key schema for table: %s. "
+ "Key schema should be a hash partitioned attribute with the name '%s'.",
TABLE_REFS, KEY_NAME);
}
}
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ private static void verifyKeySchema(TableDescription description) {
throw new IllegalStateException(
String.format(
"Invalid key schema for table: %s. Key schema should be a hash partitioned "
+ "attribute with the name 'id'.",
description.tableName()));
+ "attribute with the name '%s'.",
description.tableName(), KEY_NAME));
}

@Override
Expand Down

0 comments on commit 6d69653

Please sign in to comment.