Skip to content

Commit

Permalink
Fix UTC time conversion bug.
Browse files Browse the repository at this point in the history
Golang has a weird time formatting system.  It does not do time
zone conversion for you.  If you want to output UTC, you must first
convert your time to UTC.  Previously, this test would only work on
a machine that happened to be in UTC.
  • Loading branch information
llamahunter committed Dec 25, 2018
1 parent 82544ec commit 46efa80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/token/token_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func assertSTSError(t *testing.T, err error) {

var (
now = time.Now()
timeStr = now.Format("20060102T150405Z")
timeStr = now.UTC().Format("20060102T150405Z")
validToken = toToken(validURL)
validURL = fmt.Sprintf("https://sts.amazonaws.com/?action=GetCallerIdentity&x-amz-signedheaders=x-k8s-aws-id&x-amz-expires=60&x-amz-date=%s", timeStr)
)
Expand Down

0 comments on commit 46efa80

Please sign in to comment.