Add StreamSummaries to the respose of kinesis.list_streams (#7490)
This commit is contained in:
parent
db862bcf3b
commit
565d2bb251
@ -53,7 +53,14 @@ class KinesisResponse(BaseResponse):
|
|||||||
has_more_streams = True
|
has_more_streams = True
|
||||||
|
|
||||||
return json.dumps(
|
return json.dumps(
|
||||||
{"HasMoreStreams": has_more_streams, "StreamNames": streams_resp}
|
{
|
||||||
|
"HasMoreStreams": has_more_streams,
|
||||||
|
"StreamNames": streams_resp,
|
||||||
|
"StreamSummaries": [
|
||||||
|
stream.to_json_summary()["StreamDescriptionSummary"]
|
||||||
|
for stream in streams
|
||||||
|
],
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def delete_stream(self) -> str:
|
def delete_stream(self) -> str:
|
||||||
|
@ -137,6 +137,26 @@ def test_describe_stream_summary():
|
|||||||
assert stream["StreamName"] == stream_name
|
assert stream["StreamName"] == stream_name
|
||||||
|
|
||||||
|
|
||||||
|
@mock_aws
|
||||||
|
def test_list_streams_stream_discription():
|
||||||
|
conn = boto3.client("kinesis", region_name="us-west-2")
|
||||||
|
|
||||||
|
for i in range(3):
|
||||||
|
conn.create_stream(StreamName=f"stream{i}", ShardCount=i+1)
|
||||||
|
|
||||||
|
resp = conn.list_streams()
|
||||||
|
assert len(resp["StreamSummaries"]) == 3
|
||||||
|
for i, stream in enumerate(resp["StreamSummaries"]):
|
||||||
|
stream_name = f"stream{i}"
|
||||||
|
assert stream["StreamName"] == stream_name
|
||||||
|
assert (
|
||||||
|
stream["StreamARN"]
|
||||||
|
== f"arn:aws:kinesis:us-west-2:{ACCOUNT_ID}:stream/{stream_name}"
|
||||||
|
)
|
||||||
|
assert stream["StreamStatus"] == "ACTIVE"
|
||||||
|
assert stream.get("StreamCreationTimestamp")
|
||||||
|
|
||||||
|
|
||||||
@mock_aws
|
@mock_aws
|
||||||
def test_basic_shard_iterator():
|
def test_basic_shard_iterator():
|
||||||
client = boto3.client("kinesis", region_name="us-west-1")
|
client = boto3.client("kinesis", region_name="us-west-1")
|
||||||
|
@ -12,4 +12,8 @@ def test_list_streams():
|
|||||||
res = test_client.get("/?Action=ListStreams")
|
res = test_client.get("/?Action=ListStreams")
|
||||||
|
|
||||||
json_data = json.loads(res.data.decode("utf-8"))
|
json_data = json.loads(res.data.decode("utf-8"))
|
||||||
assert json_data == {"HasMoreStreams": False, "StreamNames": []}
|
assert json_data == {
|
||||||
|
"HasMoreStreams": False,
|
||||||
|
"StreamNames": [],
|
||||||
|
"StreamSummaries": []
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user