Skip to content

Commit

Permalink
Merge pull request #34221 from hashicorp/t-http-logging-for-CheckDest…
Browse files Browse the repository at this point in the history
…roy-aws-sdk-go-v2

Add AWS SDK for Go v2 logger to acceptance test `Context`
  • Loading branch information
ewbankkit authored Nov 2, 2023
2 parents 5d26706 + 9ba9179 commit d869136
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions internal/acctest/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
}
Expand All @@ -41,3 +41,10 @@ func testNameContext(ctx context.Context, testName string) context.Context {

return ctx
}

func awsSDKLogger(ctx context.Context) context.Context { // nosemgrep:ci.aws-in-func-name
ctx, logger := baselogging.NewTfLogger(ctx)
ctx = baselogging.RegisterLogger(ctx, logger)

return ctx
}

0 comments on commit d869136

Please sign in to comment.