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

Failing tests (Elixir 1.13) #722

Open
vbaranov opened this issue Aug 26, 2022 · 1 comment
Open

Failing tests (Elixir 1.13) #722

vbaranov opened this issue Aug 26, 2022 · 1 comment

Comments

@vbaranov
Copy link

Steps to reproduce

mix test

Description of issue

elixir --version
Erlang/OTP 24 [erts-12.3.2.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

Elixir 1.13.4 (compiled with Erlang/OTP 24)

Constantly failing tests on branch main (e1c4d42):

....................................................................................................................................................

  1) test now now/0 returns the duration since epoch (DurationTests)
     test/duration_test.exs:137
     Expected the difference between -82 and 500000 (500082) to be less than or equal to 500001
     code: assert_in_delta(difference_microseconds, 500_000, 500_001)
     stacktrace:
       test/duration_test.exs:141: (test)

................................................................................................................................................................................................

  2) test format RFC3339 (DateFormatTest.FormatDefault)
     test/format_default_test.exs:338
     Assertion with == failed
     code:  assert format(date, "{RFC3339}") == {:ok, "0010-09-26T07:00:02+00:50"}
     left:  {:ok, "0010-09-26T07:00:02+00:53"}
     right: {:ok, "0010-09-26T07:00:02+00:50"}
     stacktrace:
       test/format_default_test.exs:360: (test)
@gaiabeatrice
Copy link

gaiabeatrice commented Nov 23, 2022

I can't get the first test to fail, but for test/format_default_test.exs:338 I found out about the following:

If (from within this library) I run

naive = ~N[0010-09-26T07:00:02]
timezone = "Europe/Copenhagen"

Tzdata.TimeZoneDatabase.time_zone_periods_from_wall_datetime(
  naive,
  timezone
)

Which is a function called by Timex.Timezone.Database.time_zone_periods_from_wall_datetime/2, I get

{:ok,
 %{
   from_wall: :min,
   std_offset: 0,
   until_wall: ~N[1893-04-01 00:00:00],
   utc_offset: 3208,
   zone_abbr: "LMT"
 }}

If I convert these 3208 seconds to a more readable format (hh:mm:ss), I get 00:53:28, which is the wrong offset that makes the test fail (+00:53). I think something changed in the database, so this value is now different.

I researched timezone changes in Denmark and I found out the following

The first time a common time was used in Denmark, was in 1890, when Copenhagen local time was used as railway time. This was GMT+0:50:20 from Greenwich.

So it does seem like +00:50 is the correct one and the test shouldn't be changed. Unless new research has happened and the database was updated accordingly.

I think this warrants more research on Tzdata.

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

No branches or pull requests

2 participants