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

Tests depend on current machine's timezone and fail #327

Closed
Chosko opened this issue Feb 22, 2016 · 3 comments
Closed

Tests depend on current machine's timezone and fail #327

Chosko opened this issue Feb 22, 2016 · 3 comments
Labels

Comments

@Chosko
Copy link

Chosko commented Feb 22, 2016

I'm running tests on a machine with CET timezone and the result is

Failures:

  1) IceCube::Schedule next_occurrence should not skip ahead a day when called with a date
     Failure/Error: expect( next_hour ).to eq Time.utc(2014, 1, 2, 00, 34 , 56)

       expected: 2014-01-02 00:34:56 UTC
            got: 2014-01-01 12:34:56 UTC

       (compared using ==)

       Diff:
       @@ -1,2 +1,2 @@
       -2014-01-02 00:34:56 UTC
       +2014-01-01 12:34:56 UTC

     # ./spec/examples/schedule_spec.rb:42:in `block (3 levels) in <top (required)>'

  2) IceCube::Schedule occurring_at? should not capture multiple days when called with a date
     Failure/Error: expect( schedule.occurring_at?(Date.new(2014, 1, 1)) ).to eq true

       expected: true
            got: false

       (compared using ==)
     # ./spec/examples/schedule_spec.rb:74:in `block (3 levels) in <top (required)>'

  3) IceCube::Schedule next_occurrences should not skip ahead a day when called with a date
     Failure/Error: expect( next_hours ).to eq [Time.utc(2014, 1, 2, 00, 34 , 56),

       expected: [2014-01-02 00:34:56 UTC, 2014-01-02 01:34:56 UTC]
            got: [2014-01-01 12:34:56 UTC, 2014-01-01 13:34:56 UTC]

       (compared using ==)

       Diff:
       @@ -1,2 +1,2 @@
       -[2014-01-02 00:34:56 UTC, 2014-01-02 01:34:56 UTC]
       +[2014-01-01 12:34:56 UTC, 2014-01-01 13:34:56 UTC]

     # ./spec/examples/schedule_spec.rb:406:in `block (3 levels) in <top (required)>'

  4) IceCube::Schedule previous_occurrence should not skip back a day when called with a date
     Failure/Error: expect( prev_hour ).to eq Time.utc(2014, 1, 1, 23, 34 , 56)

       expected: 2014-01-01 23:34:56 UTC
            got: nil

       (compared using ==)
     # ./spec/examples/schedule_spec.rb:555:in `block (3 levels) in <top (required)>'

  5) IceCube::Schedule previous_occurrences should not skip back a day when called with a date
     Failure/Error: expect( prev_hours ).to eq [Time.utc(2014, 1, 1, 22, 34 , 56),

       expected: [2014-01-01 22:34:56 UTC, 2014-01-01 23:34:56 UTC]
            got: []

       (compared using ==)

       Diff:
       @@ -1,2 +1,2 @@
       -[2014-01-01 22:34:56 UTC, 2014-01-01 23:34:56 UTC]
       +[]

     # ./spec/examples/schedule_spec.rb:591:in `block (3 levels) in <top (required)>'

  6) IceCube::TimeUtil match_zone in UTC converts Date to beginning of date of reference time
     Failure/Error: expect(TimeUtil.match_zone(date, utc_time)).to eq utc_time - 1

       expected: 2014-01-01 00:00:00 UTC
            got: 2013-12-31 00:00:00 UTC

       (compared using ==)

       Diff:
       @@ -1,2 +1,2 @@
       -2014-01-01 00:00:00 UTC
       +2013-12-31 00:00:00 UTC

     # ./spec/examples/time_util_spec.rb:117:in `block (4 levels) in <module:IceCube>'

Finished in 1.48 seconds
961 examples, 6 failures, 2 pending

Failed examples:

rspec ./spec/examples/schedule_spec.rb:37 # IceCube::Schedule next_occurrence should not skip ahead a day when called with a date
rspec ./spec/examples/schedule_spec.rb:68 # IceCube::Schedule occurring_at? should not capture multiple days when called with a date
rspec ./spec/examples/schedule_spec.rb:401 # IceCube::Schedule next_occurrences should not skip ahead a day when called with a date
rspec ./spec/examples/schedule_spec.rb:550 # IceCube::Schedule previous_occurrence should not skip back a day when called with a date
rspec ./spec/examples/schedule_spec.rb:586 # IceCube::Schedule previous_occurrences should not skip back a day when called with a date
rspec ./spec/examples/time_util_spec.rb:116 # IceCube::TimeUtil match_zone in UTC converts Date to beginning of date of reference time
@Chosko Chosko changed the title Tests depends on curren machine's timezone and fail Tests depend on current machine's timezone and fail Feb 22, 2016
@Chosko
Copy link
Author

Chosko commented Feb 22, 2016

Tests pass when changing the machine timezone with timedatectl set-timezone UTC

@avit avit added the bug label Feb 25, 2016
@avit
Copy link
Collaborator

avit commented Feb 25, 2016

Hm, that's strange. I'm pretty sure we test against system time zone by changing ENV['TZ'] but I could be wrong. I can look into it when I have some time.

@MGPalmer
Copy link

+1, got the same errors, my machine is in CEST currently

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants