Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Bug in rfc3339 implementation #123

Closed
ofek opened this issue Mar 18, 2019 · 4 comments
Closed

Bug in rfc3339 implementation #123

ofek opened this issue Mar 18, 2019 · 4 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@ofek
Copy link

ofek commented Mar 18, 2019

This issue can be easily reproduced like so (same on Python 2.7.15):

$ python
Python 3.7.2 (default, Feb 21 2019, 17:35:59) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime, timedelta
>>> from time import sleep
>>> from kubernetes.config.dateutil import UTC, format_rfc3339, parse_rfc3339
>>>
>>> for tz in (None, UTC):
...     dt = parse_rfc3339(datetime.now(tz) + timedelta(seconds=20))
...     sleep(0.5)
...     delta = dt - datetime.now(dt.tzinfo)
...     print('Delta of {} should be ~19.5, and was {}'.format(format_rfc3339(dt), delta.total_seconds()))
...
Delta of 2019-03-18T00:21:17Z should be ~19.5, and was -14380.501032
Delta of 2019-03-18T04:21:17Z should be ~19.5, and was 19.499945

Based on this comment, there is logic that is supposed to coerce naive date times to UTC but it does not appear to be working consistently cc @mbohlool @pokoli

I should also note, this exact example passes on Travis (Xenial):

Job: https://travis-ci.com/DataDog/integrations-core/jobs/185296386#L592
Test: https://github.com/DataDog/integrations-core/blob/e3b1d64dfb1f40ec8e0b311752960ebd488387dd/datadog_checks_base/tests/test_kube_leader.py#L162-L168
Code: https://github.com/DataDog/integrations-core/blob/e3b1d64dfb1f40ec8e0b311752960ebd488387dd/datadog_checks_base/datadog_checks/base/checks/kube_leader/record.py#L75-L83

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 16, 2019
@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jul 16, 2019
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants