hashicorp / hashicorp/terraform-plugin-log
tfsdklog: Consider Test Sink Support for Acceptance Test Sweepers (No testing.T)
- 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
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