Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ project {
copyright_year = 2014

header_ignore = [
# internal catalog metadata (prose)
"META.d/**/*.yaml",

# changie tooling configuration and CHANGELOG entries (prose)
".changes/unreleased/**",
".changie.yaml",
Expand Down
10 changes: 10 additions & 0 deletions META.d/_summary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
schema: 1.1

partition: tf-ecosystem

summary:
owner: team-tf-core-plugins
description: |
Module for testing Terraform providers
visibility: public
16 changes: 0 additions & 16 deletions internal/logging/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ import (
testing "github.com/mitchellh/go-testing-interface"
)

// InitContext creates SDK logger contexts when the provider is running in
// "production" (not under acceptance testing). The incoming context will
// already have the root SDK logger and root provider logger setup from
// terraform-plugin-go tf5server RPC handlers.
func InitContext(ctx context.Context) context.Context {
ctx = tfsdklog.NewSubsystem(ctx, SubsystemHelperSchema,
// All calls are through the HelperSchema* helper functions
tfsdklog.WithAdditionalLocationOffset(1),
tfsdklog.WithLevelFromEnv(EnvTfLogSdkHelperSchema),
// Propagate tf_req_id, tf_rpc, etc. fields
tfsdklog.WithRootFields(),
)

return ctx
}

// InitTestContext registers the terraform-plugin-log/tfsdklog test sink,
// configures the standard library log package, and creates SDK logger
// contexts. The incoming context is expected to be devoid of logging setup.
Expand Down
37 changes: 0 additions & 37 deletions internal/logging/context_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,43 +15,6 @@ import (
"github.com/hashicorp/terraform-plugin-testing/internal/logging"
)

func TestInitContext(t *testing.T) {
t.Parallel()

var output bytes.Buffer

ctx := tfsdklogtest.RootLogger(context.Background(), &output)

// Simulate root logger fields that would have been associated by
// terraform-plugin-go prior to the InitContext() call.
ctx = tfsdklog.SetField(ctx, "tf_rpc", "GetProviderSchema")
ctx = tfsdklog.SetField(ctx, "tf_req_id", "123-testing-123")

ctx = logging.InitContext(ctx)

logging.HelperSchemaTrace(ctx, "test message")

entries, err := tfsdklogtest.MultilineJSONDecode(&output)

if err != nil {
t.Fatalf("unable to read multiple line JSON: %s", err)
}

expectedEntries := []map[string]interface{}{
{
"@level": "trace",
"@message": "test message",
"@module": "sdk.helper_schema",
"tf_rpc": "GetProviderSchema",
"tf_req_id": "123-testing-123",
},
}

if diff := cmp.Diff(entries, expectedEntries); diff != "" {
t.Errorf("unexpected difference: %s", diff)
}
}

func TestTestNameContext(t *testing.T) {
t.Parallel()

Expand Down
5 changes: 0 additions & 5 deletions internal/logging/environment_variables.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,4 @@ const (
// level of SDK helper/resource loggers. Infers root SDK logging level, if
// unset.
EnvTfLogSdkHelperResource = "TF_LOG_SDK_HELPER_RESOURCE"

// EnvTfLogSdkHelperSchema is an environment variable that sets the logging
// level of SDK helper/schema loggers. Infers root SDK logging level, if
// unset.
EnvTfLogSdkHelperSchema = "TF_LOG_SDK_HELPER_SCHEMA"
)
35 changes: 0 additions & 35 deletions internal/logging/helper_schema.go

This file was deleted.

131 changes: 0 additions & 131 deletions internal/logging/helper_schema_test.go

This file was deleted.