Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Come up with a testing strategy for the logging sink #11

Open
paddycarver opened this issue Sep 2, 2021 · 0 comments
Open

Come up with a testing strategy for the logging sink #11

paddycarver opened this issue Sep 2, 2021 · 0 comments

Comments

@paddycarver
Copy link
Contributor

We introduced a logging sink in #9, but we want to be able to make some assertions about its behavior and automatically test them.

We want to know:

  • That log output doesn't show up in test output by default.
  • That writing to files using TF_LOG_PATH works.
  • That the TF_LOG_CLI environment variable works.
  • That the TF_LOG_PROVIDER environment variable works for the provider under test.
  • That the TF_LOG environment variable works.

We notably do not care if Terraform, the SDKs, or the providers are filtering correctly; we only care that the filtering implemented by the log sink is implemented correctly.

This is tricky, because we're testing the output of tests. We may need to puppet go test around so we can inspect its stderr and stdout.

We could in theory unit test this, but I think the big thing I want tested is that first bullet point, and the problem there generally tends not to be bugs in individual pieces, but individual pieces not fitting together the way we thought they did. And faking unit tests for that first one seems hacky. So I think we want some actual acceptance tests here.

@bflad suggested writing a dummy provider and puppeting it with terraform-exec, running in a os/exec'd go test. I think that's not a bad idea, but it's a bit of a project we may not want to undertake right this second.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant