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

x/pkgsite: internal/frontend test fails due to time zone #44128

Closed
ya5u opened this issue Feb 5, 2021 · 3 comments
Closed

x/pkgsite: internal/frontend test fails due to time zone #44128

ya5u opened this issue Feb 5, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@ya5u
Copy link

ya5u commented Feb 5, 2021

My timezone is JST, and I noticed that the test for internal/frontend fails after midnight.
Probably this is due to the timezone, but I'm going into more detail below.

What is your user agent?

$ go version
go version go1.15.7 darwin/amd64

Screenshot

$ go test ./internal/frontend/.
...
    --- FAIL: TestFetchPackageVersionsDetails/want_only_pseudo (0.15s)
        versions_test.go:195: mismatch (-want +got):
              &frontend.VersionsDetails{
              	ThisModule: nil,
              	OtherModules: []*frontend.VersionList{
              		&{
              			VersionListKey: {ModulePath: "test.com/module", Major: "v0"},
              			Versions: []*frontend.VersionSummary{
              				&{
            - 					CommitTime: "Feb  6, 2021",
            + 					CommitTime: "Feb  5, 2021",
              					Link:       "/test.com/module@v0.0.0-20140414041502-4c2ca4d52544/foo",
              					Version:    "v0.0.0-20140414041502-4c2ca4d52544",
              				},
              				&{
            - 					CommitTime: "Feb  6, 2021",
            + 					CommitTime: "Feb  5, 2021",
              					Link:       "/test.com/module@v0.0.0-20140414041501-3c2ca4d52544/foo",
              					Version:    "v0.0.0-20140414041501-3c2ca4d52544",
              				},
              			},
              		},
              	},
              }
FAIL
FAIL	golang.org/x/pkgsite/internal/frontend	24.760s
FAIL

What did you do?

After midnight in JST, execute the following command.

$ go test ./internal/frontend/.

What did you expect to see?

ok  	golang.org/x/pkgsite/internal/frontend	25.147s

What did you see instead?

...
    --- FAIL: TestFetchPackageVersionsDetails/want_only_pseudo (0.15s)
        versions_test.go:195: mismatch (-want +got):
              &frontend.VersionsDetails{
              	ThisModule: nil,
              	OtherModules: []*frontend.VersionList{
              		&{
              			VersionListKey: {ModulePath: "test.com/module", Major: "v0"},
              			Versions: []*frontend.VersionSummary{
              				&{
            - 					CommitTime: "Feb  6, 2021",
            + 					CommitTime: "Feb  5, 2021",
              					Link:       "/test.com/module@v0.0.0-20140414041502-4c2ca4d52544/foo",
              					Version:    "v0.0.0-20140414041502-4c2ca4d52544",
              				},
              				&{
            - 					CommitTime: "Feb  6, 2021",
            + 					CommitTime: "Feb  5, 2021",
              					Link:       "/test.com/module@v0.0.0-20140414041501-3c2ca4d52544/foo",
              					Version:    "v0.0.0-20140414041501-3c2ca4d52544",
              				},
              			},
              		},
              	},
              }
FAIL
FAIL	golang.org/x/pkgsite/internal/frontend	24.760s
FAIL
@gopherbot gopherbot added this to the Unreleased milestone Feb 5, 2021
@jamalc jamalc added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 5, 2021
@jamalc jamalc modified the milestones: Unreleased, pkgsite/unplanned Feb 5, 2021
@jba
Copy link
Contributor

jba commented Feb 12, 2021

What does SHOW TIMEZONE print for your test postgres server? It should be UTC. Our tests create times in UTC.

@ya5u
Copy link
Author

ya5u commented Feb 13, 2021

What does SHOW TIMEZONE print for your test postgres server? It should be UTC. Our tests create times in UTC.

It's Etc/UTC in my postgres server.

discovery-db=# show timezone;
 TimeZone
----------
 Etc/UTC
(1 row)

According to the error message want isn't in UTC, so I think there seems to be any problem in generating the expected value.

@ya5u
Copy link
Author

ya5u commented Feb 15, 2021

@jba
This issue has already fixed by golang/pkgsite@a99e678.
So it no longer reproduces in my environment. Thank you.

@ya5u ya5u closed this as completed Feb 15, 2021
@golang golang locked and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

4 participants