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 protection from testing against mismatch versions #23

Closed
wants to merge 1 commit into from

Conversation

jjcarstens
Copy link
Member

Just a convenience for test. It adds the ability to look for a <tzpath>/version file. This can then be used to compare your expected TZversion.

In our case, we make sure our version matches Tz.iana_version since that is considered the source of truth in our tests

Just a convenience for test. It adds the ability to look for a `<tzpath>/version`
file. This can then be used to compare your expected TZversion.

In our case, we make sure our version matches `Tz.iana_version` since that
is considered the source of truth in our tests
@doc """
Return the time zone database version

This attempts to read `<tzpath>/version` and returns `:unknown` if non-existent.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this will normally return :unknown since the file version doesn't exist normally. The place that you copied above is only for unit tests.

I've never found any consistency for finding the database version. On MacOS, there's a file called +VERSION that has it. On Ubuntu, the tzdata.zi file lists it as a comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Rereading your comments, I'm not sure if you intended this to be only for unit tests. If so, how about moving this function out of the public API?

@fhunleth
Copy link
Collaborator

fhunleth commented Dec 7, 2022

Closing since the zic version and database are both part of the download from IANA, so they should be the same. The instances that I've seen where there's been a mismatch have been due to stale _build directory contents and that's a Makefile dependency issue.

@fhunleth fhunleth closed this Dec 7, 2022
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.

None yet

2 participants