hashicorp / hashicorp/terraform-plugin-log

tfsdklog: Consider Test Sink Support for Acceptance Test Sweepers (No testing.T)

Open
#161 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Go
Stars
23
Forks
11
Avg merge
2d 12h
Merged PRs (30d)
1

Description

### terraform-plugin-log version

```
v0.9.0
```

### Use cases

The provider acceptance testing frameworks offer "sweeper" functionality, which is used to automatically clean up testing environments. That testing-based code has logging that is not currently controlled by terraform-plugin-log or environment variables. Code for reference: https://github.com/hashicorp/terraform-plugin-testing/blob/dfd28ce3509bb39a5106844f7d4a8516dcab512e/helper/resource/testing.go#L96-L284

### Attempted solutions

The `tfsdklog` package has [`RegisterTestSink()`](https://pkg.go.dev/github.com/hashicorp/terraform-plugin-log/tfsdklog#RegisterTestSink), however that requires a `testing.T` which is not available in this use case.

### Proposal

Add a new `tfsdklog` package function similar to `RegisterTestSink`, that can be used within the sweeper code.

### References

None

Contributor guide

Open the contributing guide

Research direction

Start with the tfsdklog package and its RegisterTestSink function, then review the referenced sweeper code in terraform-plugin-testing's helper/resource/testing.go. Determine how a test sink can be registered without testing.T and add coverage for the new entry point; done means sweeper logging can be controlled through tfsdklog.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.