fix(dynamodb): match the AWS shape of the Kinesis destination responses (#4917)

DisableKinesisStreamingDestination now returns EnableKinesisStreamingConfiguration
with the precision the destination still carries, like AWS does.
Drop DestinationStatusDescription from the Enable and Disable responses. AWS carries
that member on DescribeKinesisStreamingDestination only, where it stays.
Build both responses from one snapshot taken while the call runs, so a concurrent
call on the same destination cannot change the status this answer reports.
Add an SDK compatibility test, because the SDK parses the typed response members
that handcrafted HTTP cannot check.
Document that Enable and Disable report the precision too.
This commit is contained in:
Attila Kis authored and GitHub committed 2026-10-02 13:39:34 -04:00
1 parent 3ce093f208
commit 5de9b0d6c1
6 files changed
+245 -38

No files matched your search

@@ -106,7 +106,11 @@ class DynamoDbKinesisStreamingIntegrationTest {
.statusCode(200)
.body("TableName", equalTo("StreamingTable"))
.body("StreamArn", equalTo(kinesisStreamArn))
.body("DestinationStatus", equalTo("ACTIVE"));
.body("DestinationStatus", equalTo("ACTIVE"))
.body("EnableKinesisStreamingConfiguration.ApproximateCreationDateTimePrecision",
equalTo("MILLISECOND"))
// AWS carries DestinationStatusDescription on Describe only, not on Enable.
.body("$", not(hasKey("DestinationStatusDescription")));
}
@Test
@@ -344,7 +348,13 @@ class DynamoDbKinesisStreamingIntegrationTest {
.post("/")
.then()
.statusCode(200)
.body("DestinationStatus", equalTo("DISABLED"));
.body("TableName", equalTo("StreamingTable"))
.body("StreamArn", equalTo(kinesisStreamArn))
.body("DestinationStatus", equalTo("DISABLED"))
// AWS answers Disable with the destination's configuration too.
.body("EnableKinesisStreamingConfiguration.ApproximateCreationDateTimePrecision",
equalTo("MILLISECOND"))
.body("$", not(hasKey("DestinationStatusDescription")));
}
@Test
@@ -657,7 +667,10 @@ class DynamoDbKinesisStreamingIntegrationTest {
.when()
.post("/")
.then()
.statusCode(200);
.statusCode(200)
// Disable reports the precision the destination still carries, not the default.
.body("EnableKinesisStreamingConfiguration.ApproximateCreationDateTimePrecision",
equalTo("MICROSECOND"));
// No configuration on re-enable means the AWS default, not the previously stored MICROSECOND.
given()
@@ -337,10 +337,15 @@ class NativeDynamoDbTableServiceTest {
void kinesisDestinationTransitionsPersistAndRepeatedTransitionsAreRejected() {
TableDefinition created = tableService.createTable(createRequest(null, NO_SETTINGS), "ACTIVE", REGION);
String resolved = tableService.enableKinesisStreamingDestination(
NativeDynamoDbTableService.KinesisDestination resolved = tableService.enableKinesisStreamingDestination(
created.getTableArn(), STREAM_ARN, KinesisStreamingDestination.PRECISION_MICROSECOND, REGION);
assertEquals(TABLE, resolved, "an ARN input resolves to the canonical table name");
assertEquals(TABLE, resolved.tableName(), "an ARN input resolves to the canonical table name");
assertEquals(STREAM_ARN, resolved.streamArn());
assertEquals("ACTIVE", resolved.destinationStatus());
assertEquals(KinesisStreamingDestination.PRECISION_MICROSECOND,
resolved.approximateCreationDateTimePrecision(),
"the snapshot carries the precision the response echoes");
verify(kinesisService).describeStream(STREAM_NAME, REGION);
KinesisStreamingDestination enabled = reloadFromDisk().findKinesisStreamingDestination(STREAM_ARN)
.orElseThrow();
@@ -352,7 +357,13 @@ class NativeDynamoDbTableServiceTest {
TABLE, STREAM_ARN, KinesisStreamingDestination.PRECISION_MILLISECOND, REGION),
"Table already has an active Kinesis streaming destination with this stream ARN");
assertEquals(TABLE, tableService.disableKinesisStreamingDestination(TABLE, STREAM_ARN, REGION));
NativeDynamoDbTableService.KinesisDestination afterDisable =
tableService.disableKinesisStreamingDestination(TABLE, STREAM_ARN, REGION);
assertEquals(TABLE, afterDisable.tableName());
assertEquals("DISABLED", afterDisable.destinationStatus());
assertEquals(KinesisStreamingDestination.PRECISION_MICROSECOND,
afterDisable.approximateCreationDateTimePrecision(),
"disabling keeps the stored precision so the response can report it");
TableDefinition disabled = reloadFromDisk();
assertEquals(1, disabled.getKinesisStreamingDestinations().size());
assertEquals("DISABLED", disabled.findKinesisStreamingDestination(STREAM_ARN).orElseThrow()