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

Support for Additional Test Patterns via Code Comments #49

Open
bflad opened this issue Nov 18, 2020 · 0 comments
Open

Support for Additional Test Patterns via Code Comments #49

bflad opened this issue Nov 18, 2020 · 0 comments

Comments

@bflad
Copy link
Contributor

bflad commented Nov 18, 2020

Description

Currently, tctest checks for test patterns in the _test.go filename of modified PR files. Most of the time this is great and covers what should be tested, however there are scenarios where it may be desirable or necessary to use other test patterns:

  • Test declarations in other files: In Terraform Providers, services may only allow 1 resource to exist so testing is serialized across many resources and the test declaration is in a separate shared file.
  • Additional testing desired: In Terraform Providers, resources may also have an associated data source, which will be in a separate test file. Otherwise, there may also be other resources or testing that use the changing functionality.

Proposal

Support the ability to declare additional test patterns via code comments. Go convention is //XXX with no space for programatic comments. Including an additional :add: field to the comment for future proofing (e.g. if we wanted to have the ability to programmatically skip tests too).

Proposal 1

//tctest:add:TestAccExample

Personally, I think this this more desirable since it gives full control to run singular tests.

Proposal 2

//tctest:add:path/to/other/file_test.go
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