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

Unit tests for weekdayRange fail #46

Closed
samuong opened this issue Jan 20, 2020 · 1 comment · Fixed by #47
Closed

Unit tests for weekdayRange fail #46

samuong opened this issue Jan 20, 2020 · 1 comment · Fixed by #47

Comments

@samuong
Copy link
Owner

samuong commented Jan 20, 2020

            	Error:      	Not equal: 
            	            	expected: false
            	            	actual  : true
            	Test:       	TestWeekdayRange/M-F_UTC_MON
    --- FAIL: TestWeekdayRange/M-F_UTC_SAT (0.00s)
        pacrunner_test.go:327: 
            	Error Trace:	pacrunner_test.go:327
            	Error:      	Not equal: 
            	            	expected: true
            	            	actual  : false
            	Test:       	TestWeekdayRange/M-F_UTC_SAT
    --- FAIL: TestWeekdayRange/SAT_UTC_SUN (0.00s)
        pacrunner_test.go:327: 
            	Error Trace:	pacrunner_test.go:327
            	Error:      	Not equal: 
            	            	expected: true
            	            	actual  : false
            	Test:       	TestWeekdayRange/SAT_UTC_SUN
    --- FAIL: TestWeekdayRange/SAT_UTC_SAT (0.00s)
        pacrunner_test.go:327: 
            	Error Trace:	pacrunner_test.go:327
            	Error:      	Not equal: 
            	            	expected: false
            	            	actual  : true
            	Test:       	TestWeekdayRange/SAT_UTC_SAT
FAIL
FAIL	github.com/samuong/alpaca	0.271s
ok  	github.com/samuong/alpaca/cancelable	0.003s

Will have to investigate more but this is what I'm seeing.

Originally posted by @jamesmoriarty in https://github.com/samuong/alpaca/pull/45/files

@camh-
Copy link
Collaborator

camh- commented Jan 22, 2020

Easily reproduced locally with TZ=UTC go test (once the test is re-enabled by removing/commenting-out the t.Skip)

@camh- camh- closed this as completed in #47 Jan 23, 2020
camh- added a commit that referenced this issue Jan 23, 2020
The TestWeekdayRange test was failing when run in the UTC or
America/Pacific timezone (and probably others). This is because when
parsing a timezone name, that name needs to be defined in for the
current location - from the time.Parse docs:

When parsing a time with a zone abbreviation like MST, if the zone
abbreviation has a defined offset in the current location, then that
offset is used.
Presumably the name "AEST" used in the reference Sunday time is not
defined in other locations.

So use the RFC1123Z format and be explicit about the +1000 offset,
rather than relying on the zone abbreviation.

Fixes: #46

## Commits

* tests: Fix sunday time to properly include timezone

 pacrunner_test.go | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
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 a pull request may close this issue.

2 participants