From 46efa80465bd261916220fa3c4fe660bcef0d6fc Mon Sep 17 00:00:00 2001 From: Richard Lee Date: Mon, 24 Dec 2018 23:06:50 -0800 Subject: [PATCH] Fix UTC time conversion bug. 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. --- pkg/token/token_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/token/token_test.go b/pkg/token/token_test.go index 7a10beecc..f470e2867 100644 --- a/pkg/token/token_test.go +++ b/pkg/token/token_test.go @@ -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) )