Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add integration tests for timestamps and --nanoseconds resolution timestamps #390

Merged
merged 5 commits into from
Jun 14, 2024

Conversation

phillip-stephens
Copy link
Contributor

Closes #134

@phillip-stephens phillip-stephens marked this pull request as ready for review June 14, 2024 03:13
@phillip-stephens phillip-stephens requested a review from a team as a code owner June 14, 2024 03:13
Comment on lines +949 to +971

def test_timetamps(self):
c = "A"
name = "zdns-testing.com"
cmd, res = self.run_zdns(c, name)
self.assertSuccess(res, cmd)
assert "timestamp" in res
date = datetime.datetime.strptime(res["timestamp"], "%Y-%m-%dT%H:%M:%S%z")
self.assertTrue(date.microsecond == 0) # microseconds should be 0 since we didn't call with --nanoseconds

def test_timetamps_nanoseconds(self):
c = "A --nanoseconds"
name = "zdns-testing.com"
cmd, res = self.run_zdns(c, name)
self.assertSuccess(res, cmd)
assert "timestamp" in res
date = parser.parse(res["timestamp"])
self.assertTrue(date.microsecond != 0)
# microseconds should be non-zero since we called with --nanoseconds. There is a chance it happens to be 0,
# but it is very unlikely. (1 in 1,000,000). Python's datetime.date's smallest unit of time is microseconds,
# so that's why we're using this in place of nanoseconds. It should not affect the test's validity.


Copy link
Contributor Author

@phillip-stephens phillip-stephens Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewers: apologies for the large change-set, my IDE auto-formatter decided to format the file according to PEP 8. These are the only functional, non-format changes

@zakird zakird merged commit 32125e9 into main Jun 14, 2024
4 checks passed
@zakird zakird deleted the phillip/134-timestamp-tests branch June 14, 2024 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add integration test for --nanoseconds and timestamps in general
2 participants