From f58417c6fa33b82bab81987beda04aebc390c7c2 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 2 Nov 2023 11:39:02 -0400 Subject: [PATCH 1/2] Add AWS SDK for Go v2 logger to acceptance test Context. --- internal/acctest/context.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/internal/acctest/context.go b/internal/acctest/context.go index cd602bcb603..c3c8d6acd55 100644 --- a/internal/acctest/context.go +++ b/internal/acctest/context.go @@ -7,6 +7,7 @@ import ( "context" "testing" + baselogging "github.com/hashicorp/aws-sdk-go-base/v2/logging" "github.com/hashicorp/terraform-plugin-log/tflog" "github.com/hashicorp/terraform-plugin-log/tfsdklog" helperlogging "github.com/hashicorp/terraform-plugin-sdk/v2/helper/logging" @@ -16,10 +17,9 @@ func Context(t *testing.T) context.Context { helperlogging.SetOutput(t) ctx := context.Background() - ctx = tfsdklog.RegisterTestSink(ctx, t) - ctx = logger(ctx, t, "acctest") + ctx = awsSDKLogger(ctx) return ctx } @@ -41,3 +41,10 @@ func testNameContext(ctx context.Context, testName string) context.Context { return ctx } + +func awsSDKLogger(ctx context.Context) context.Context { + ctx, logger := baselogging.NewTfLogger(ctx) + ctx = baselogging.RegisterLogger(ctx, logger) + + return ctx +} From 9ba91790fb9501cec19eee4a50c8e32dc20d7594 Mon Sep 17 00:00:00 2001 From: Kit Ewbank Date: Thu, 2 Nov 2023 12:02:52 -0400 Subject: [PATCH 2/2] Fix semgrep 'ci.aws-in-func-name'. --- internal/acctest/context.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/acctest/context.go b/internal/acctest/context.go index c3c8d6acd55..8982c232244 100644 --- a/internal/acctest/context.go +++ b/internal/acctest/context.go @@ -42,7 +42,7 @@ func testNameContext(ctx context.Context, testName string) context.Context { return ctx } -func awsSDKLogger(ctx context.Context) context.Context { +func awsSDKLogger(ctx context.Context) context.Context { // nosemgrep:ci.aws-in-func-name ctx, logger := baselogging.NewTfLogger(ctx) ctx = baselogging.RegisterLogger(ctx, logger)