Skip to content

Fix time-dependent tests#8

Closed
peterzen wants to merge 3 commits intomasterfrom
codex/update-test-fixtures
Closed

Fix time-dependent tests#8
peterzen wants to merge 3 commits intomasterfrom
codex/update-test-fixtures

Conversation

@peterzen
Copy link
Owner

Summary

  • add a nowFunc variable so tests can set the current time
  • override nowFunc in tests so archived DNS fixtures remain valid

Testing


https://chatgpt.com/codex/tasks/task_e_685c886fb510833196ec8fbfb4ee596a

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes time-dependent tests by introducing a mockable time function. The change allows tests to use archived DNS fixture data with DNSSEC signatures that would otherwise expire over time.

Changes:

  • Introduced a nowFunc variable in signedzone.go that defaults to time.Now but can be overridden in tests
  • Replaced direct time.Now() call with nowFunc() in DNSSEC signature validation
  • Added TestMain in main_test.go to set a fixed time (March 15, 2019) for all tests, ensuring RRSIG records in fixture data remain valid

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
signedzone.go Added nowFunc variable and updated RRSIG validity check to use it instead of time.Now()
main_test.go Added TestMain to override nowFunc with a fixed date within the validity period of archived DNSSEC signatures
lookup_test.go Minor whitespace formatting change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@peterzen
Copy link
Owner Author

superseded by #13

@peterzen peterzen closed this Feb 16, 2026
@peterzen peterzen deleted the codex/update-test-fixtures branch February 16, 2026 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants