mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(kinesis): reject DeleteStream on a missing stream and honour EnforceConsumerDeletion (#8459)
* fix(kinesis): reject DeleteStream on a missing stream and honour EnforceConsumerDeletion * fix(kinesis): serialize stream deletion with consumer registration * fix(kinesis): refuse RegisterStreamConsumer for a stream that no longer exists
This commit is contained in:
1 parent
3f64a4514a
commit
2f99c0ae8c
6 files changed
+130
-6
No files matched your search
@@ -116,6 +116,29 @@ class KinesisJsonHandlerTest {
|
||||
assertEquals("99", event.path("ChildShards").get(0).path("HashKeyRange").path("EndingHashKey").asText());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteStream_missingStream_returnsResourceNotFound() {
|
||||
ObjectNode request = MAPPER.createObjectNode().put("StreamName", "nope");
|
||||
|
||||
AwsException e = assertThrows(AwsException.class, () -> handler.handle("DeleteStream", request, REGION));
|
||||
|
||||
assertEquals("ResourceNotFoundException", e.getErrorCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
void deleteStream_withConsumers_honoursEnforceConsumerDeletion() {
|
||||
createStream("test-stream");
|
||||
service.registerStreamConsumer(STREAM_ARN, "c1", REGION);
|
||||
ObjectNode request = MAPPER.createObjectNode().put("StreamName", "test-stream");
|
||||
|
||||
AwsException e = assertThrows(AwsException.class, () -> handler.handle("DeleteStream", request, REGION));
|
||||
assertEquals("ResourceInUseException", e.getErrorCode());
|
||||
|
||||
request.put("EnforceConsumerDeletion", true);
|
||||
assertThat(handler.handle("DeleteStream", request, REGION).getStatus(), is(200));
|
||||
assertTrue(service.listStreamConsumers(STREAM_ARN, REGION).isEmpty());
|
||||
}
|
||||
|
||||
// Retention is measured against the service clock, so a test that plants a fixed arrival
|
||||
// timestamp pins the clock just after it instead of relying on the wall clock.
|
||||
private void useClockFixedAt(Instant now) {
|
||||
|
||||
Reference in new issue
Block a user