katbyte / tctest

CLI utility to run tests on TC for github PRss

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Additional Test Patterns via Code Comments

bflad opened this issue · comments

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