Fix: ApproximateArrivalTimestamp should be epoch with millisecond precision (#3764)

The Record class was already capturing a unix timestamp, but it was incorrectly
converting it to ISO format when sending back to the client.

Updating the model to return the correct timestamp necessitated a minor change
to one of the tests because `botocore` converts non-timezone aware timestamps
to local time.
This commit is contained in:
Brian Pandola 2021-03-11 00:54:21 -08:00 committed by GitHub
parent a4009e7bd1
commit f96ac40fca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -43,7 +43,7 @@ class Record(BaseModel):
"Data": self.data,
"PartitionKey": self.partition_key,
"SequenceNumber": str(self.sequence_number),
"ApproximateArrivalTimestamp": self.created_at_datetime.isoformat(),
"ApproximateArrivalTimestamp": self.created_at,
}

View File

@ -6,6 +6,7 @@ import time
import boto.kinesis
import boto3
from boto.kinesis.exceptions import ResourceNotFoundException, InvalidArgumentException
from dateutil.tz import tzlocal
from moto import mock_kinesis, mock_kinesis_deprecated
from moto.core import ACCOUNT_ID
@ -378,7 +379,7 @@ def test_get_records_timestamp_filtering():
conn.put_record(StreamName=stream_name, Data="0", PartitionKey="0")
time.sleep(1.0)
timestamp = datetime.datetime.utcnow()
timestamp = datetime.datetime.now(tz=tzlocal())
conn.put_record(StreamName=stream_name, Data="1", PartitionKey="1")