Change register stream consumer timestamp output format to UNIX per AWS docs#2835
Change register stream consumer timestamp output format to UNIX per AWS docs#2835whummer merged 1 commit intolocalstack:masterlocalstack/localstack:masterfrom elainearbaugh:kinesis-enhanced-fanoutelainearbaugh/localstack:kinesis-enhanced-fanoutCopy head branch name to clipboard
Conversation
a87c073 to
6b8de25
Compare
53fc9db to
3975071
Compare
compared to running against actual aws: Empirically the timestamp returned from AWS seems to always be a float with .0 at the end, so I copied that |
d431862 to
d3e0e66
Compare
d3e0e66 to
870470e
Compare
|
added another test |
|
@whummer not quite sure about the contribution process besides what's in the contribution section of the README, can I get a review please? |
whummer
left a comment
There was a problem hiding this comment.
Thanks for this PR @elainearbaugh ! Added two minor comments - can you please take a look? Thanks
| return microsecond_time[:-4] + microsecond_time[-1] | ||
|
|
||
|
|
||
| def unix_timestamp(time=None): |
There was a problem hiding this comment.
I think we can remove this function and use the existing now_utc() in this file. Note that the two have slightly different behavior:
# logic in the new unix_timestamp() function:
> int(datetime.datetime.utcnow().timestamp())
1597214436
# logic in the existing now_utc() function:
> calendar.timegm(datetime.datetime.utcnow().timetuple())
1597221636
At the time of running, the latter seems to be the correct UNIX epoch timestamp (according to epochconverter.com).
| elif action == '%s.DescribeStreamConsumer' % ACTION_PREFIX: | ||
| consumer_arn = data.get('ConsumerARN') or data['ConsumerName'] | ||
| consumer_name = data.get('ConsumerName') or data['ConsumerARN'] | ||
| creation_timestamp = data.get('ConsumerCreationTimestamp') or data['ConsumerCreationTimestamp'] |
There was a problem hiding this comment.
This can be simplified to:
creation_timestamp = data.get('ConsumerCreationTimestamp')
(Note that in the two lines above, different attribute names are selected as fallbacks if one attribute is not defined.)
There was a problem hiding this comment.
ohhh haha yeah I copied that because I wanted to be consistent but didn't notice there were multiple attributes, thanks
870470e to
68b528b
Compare
|
Made the changes and double checked output with awscli: |
68b528b to
159490c
Compare
159490c to
3a8bd13
Compare
|
@whummer fixed, thank you! Once this is merged would it be possible to release a new bugfix version? I'm using localstack with TestContainers in Java, and the latest stable version of TestContainers basically just allows you to specify a docker image version for localstack (code). So I don't think I can get my tests to work without a new release version/docker image? |
|
Great, thanks for the quick turnaround. We'll release a new version shortly.. 👍 |
Changed register_stream_consumer ConsumerCreationTimestamp output from a formatted string to a UNIX timestamp.
See #2834