@@ -53,6 +53,7 @@ def test_table_v2_stream(self, aws_client, infrastructure_setup, snapshot):
53
53
54
54
@markers .aws .only_localstack
55
55
def test_stream_spec_and_region_replacement (self , aws_client , region_name ):
56
+ # our V1 and V2 implementation are pretty different, and we need different ways to test it
56
57
ddbstreams = aws_client .dynamodbstreams
57
58
table_name = f"ddb-{ short_uid ()} "
58
59
resources .create_dynamodb_table (
@@ -73,6 +74,14 @@ def test_stream_spec_and_region_replacement(self, aws_client, region_name):
73
74
stream_tables = ddbstreams .list_streams (TableName = "foo" )["Streams" ]
74
75
assert len (stream_tables ) == 0
75
76
77
+ if not config .DDB_STREAMS_PROVIDER_V2 :
78
+ from localstack .services .dynamodbstreams .dynamodbstreams_api import (
79
+ get_kinesis_stream_name ,
80
+ )
81
+
82
+ stream_name = get_kinesis_stream_name (table_name )
83
+ assert stream_name in aws_client .kinesis .list_streams ()["StreamNames" ]
84
+
76
85
# assert stream has been created
77
86
stream_tables = [
78
87
s ["TableName" ] for s in ddbstreams .list_streams (TableName = table_name )["Streams" ]
@@ -90,8 +99,15 @@ def test_stream_spec_and_region_replacement(self, aws_client, region_name):
90
99
aws_client .dynamodb .delete_table (TableName = table_name )
91
100
92
101
def _assert_stream_disabled ():
93
- result = aws_client .dynamodbstreams .describe_stream (StreamArn = table ["LatestStreamArn" ])
94
- assert result ["StreamDescription" ]["StreamStatus" ] == "DISABLED"
102
+ if config .DDB_STREAMS_PROVIDER_V2 :
103
+ _result = aws_client .dynamodbstreams .describe_stream (
104
+ StreamArn = table ["LatestStreamArn" ]
105
+ )
106
+ assert _result ["StreamDescription" ]["StreamStatus" ] == "DISABLED"
107
+ else :
108
+ _stream_tables = [s ["TableName" ] for s in ddbstreams .list_streams ()["Streams" ]]
109
+ assert table_name not in _stream_tables
110
+ assert stream_name not in aws_client .kinesis .list_streams ()["StreamNames" ]
95
111
96
112
# assert stream has been deleted
97
113
retry (_assert_stream_disabled , sleep = 1 , retries = 20 )
0 commit comments