AT012

Acceptance testsStandard

check for files containing multiple acceptance test function name prefixes

The AT012 analyzer reports likely incorrect uses of multiple TestAcc function name prefixes up to the conventional underscore (_) prefix separator within the same file. Typically, Terraform acceptance tests should use the same naming prefix within one test file so testers can easily run all acceptance tests for the file and not miss associated tests.

Options

Namespaced under the check ID on the command line, as -AT012.ignored-filenames=VALUE.

Flag Default Effect
ignored-filenames none Comma-separated list of file names to ignore

Examples

func TestAccExampleThing1_Test(t *testing.T) { /* ... */ }

func TestAccExampleThing2_Test(t *testing.T) { /* ... */ }
func TestAccExampleThing_Test1(t *testing.T) { /* ... */ }

func TestAccExampleThing_Test2(t *testing.T) { /* ... */ }

Ignoring reports

In addition to the options above, reports can be ignored by adding a //lintignore:AT012 Go code comment before any test declaration to ignore, e.g.

//lintignore:AT012
func TestAccExampleThing1_Test(t *testing.T) { /* ... */ }

//lintignore:AT012
func TestAccExampleThing2_Test(t *testing.T) { /* ... */ }

If a file mainly uses one prefix, the code ignores can be simplified to only the non-conforming test declarations.


This page is generated from passes/AT012/README.md, which lives beside the analyzer.