Fix response data-types for kinesis operations (#4736)
This commit is contained in:
parent
307104417b
commit
ee6b2bfff8
@ -86,7 +86,7 @@ class Shard(BaseModel):
|
|||||||
self.records[sequence_number] = Record(
|
self.records[sequence_number] = Record(
|
||||||
partition_key, data, sequence_number, explicit_hash_key
|
partition_key, data, sequence_number, explicit_hash_key
|
||||||
)
|
)
|
||||||
return sequence_number
|
return str(sequence_number)
|
||||||
|
|
||||||
def get_min_sequence_number(self):
|
def get_min_sequence_number(self):
|
||||||
if self.records:
|
if self.records:
|
||||||
@ -121,16 +121,16 @@ class Shard(BaseModel):
|
|||||||
"StartingHashKey": str(self.starting_hash),
|
"StartingHashKey": str(self.starting_hash),
|
||||||
},
|
},
|
||||||
"SequenceNumberRange": {
|
"SequenceNumberRange": {
|
||||||
"StartingSequenceNumber": self.get_min_sequence_number(),
|
"StartingSequenceNumber": str(self.get_min_sequence_number()),
|
||||||
},
|
},
|
||||||
"ShardId": self.shard_id,
|
"ShardId": self.shard_id,
|
||||||
}
|
}
|
||||||
if self.parent:
|
if self.parent:
|
||||||
response["ParentShardId"] = self.parent
|
response["ParentShardId"] = self.parent
|
||||||
if not self.is_open:
|
if not self.is_open:
|
||||||
response["SequenceNumberRange"][
|
response["SequenceNumberRange"]["EndingSequenceNumber"] = str(
|
||||||
"EndingSequenceNumber"
|
self.get_max_sequence_number()
|
||||||
] = self.get_max_sequence_number()
|
)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
@ -226,7 +226,8 @@ def test_put_records():
|
|||||||
InvalidArgumentException
|
InvalidArgumentException
|
||||||
)
|
)
|
||||||
|
|
||||||
conn.put_record(stream_name, data, partition_key)
|
response = conn.put_record(stream_name, data, partition_key)
|
||||||
|
response["SequenceNumber"].should.equal("1")
|
||||||
|
|
||||||
response = conn.describe_stream(stream_name)
|
response = conn.describe_stream(stream_name)
|
||||||
shard_id = response["StreamDescription"]["Shards"][0]["ShardId"]
|
shard_id = response["StreamDescription"]["Shards"][0]["ShardId"]
|
||||||
@ -256,7 +257,10 @@ def test_put_records_boto3():
|
|||||||
data = b"hello world"
|
data = b"hello world"
|
||||||
partition_key = "1234"
|
partition_key = "1234"
|
||||||
|
|
||||||
client.put_record(StreamName=stream_name, Data=data, PartitionKey=partition_key)
|
response = client.put_record(
|
||||||
|
StreamName=stream_name, Data=data, PartitionKey=partition_key
|
||||||
|
)
|
||||||
|
response["SequenceNumber"].should.equal("1")
|
||||||
|
|
||||||
resp = client.get_shard_iterator(
|
resp = client.get_shard_iterator(
|
||||||
StreamName=stream_name, ShardId=shard_id, ShardIteratorType="TRIM_HORIZON"
|
StreamName=stream_name, ShardId=shard_id, ShardIteratorType="TRIM_HORIZON"
|
||||||
|
Loading…
Reference in New Issue
Block a user