From b4dc7e9036e33c9d58ab9c548c5d6c887b83cb09 Mon Sep 17 00:00:00 2001 From: Peter Rifel Date: Wed, 17 Jul 2024 20:19:38 -0500 Subject: [PATCH] Use UTC for AWS token tests This ensures the unit tests pass when ran when the current UTC date differs from the local timezone's date. --- upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go b/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go index 642fb11e675c6..731959c853325 100644 --- a/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go +++ b/upup/pkg/fi/cloudup/awsup/aws_authenticator_test.go @@ -120,7 +120,7 @@ func TestCreateTokenV1(t *testing.T) { } t.Logf("decoded: %+v", decoded) - signatureDate := time.Now().Format("20060102") // This might fail if we cross midnight, it seems very unlikely + signatureDate := time.Now().UTC().Format("20060102") amzSignature := "" amzSignedHeaders := "" @@ -269,7 +269,7 @@ func TestCreateTokenV2(t *testing.T) { t.Errorf("unexpected http method: got %q, want %q", decoded.Method, want) } - signatureDate := time.Now().Format("20060102") // This might fail if we cross midnight, it seems very unlikely + signatureDate := time.Now().UTC().Format("20060102") amzSignature := "" amzSignedHeaders := ""