@@ -16,6 +16,12 @@ import (
1616 "github.com/stretchr/testify/require"
1717)
1818
19+ type TestOptions struct {
20+ TerraformOptions terraform.Options
21+ Assertion func (* testing.T , TerraformOutput )
22+ SkipIdempotentCheck bool
23+ }
24+
1925var copyLock = & KeyedMutex {}
2026
2127type TerraformOutput = map [string ]interface {}
@@ -43,10 +49,20 @@ func (e2eTestExecutor) Logger() logger.TestLogger {
4349}
4450
4551func RunE2ETest (t * testing.T , moduleRootPath , exampleRelativePath string , option terraform.Options , assertion func (* testing.T , TerraformOutput )) {
46- initAndApplyAndIdempotentTest (t , moduleRootPath , exampleRelativePath , option , assertion , e2eTestExecutor {})
52+ initAndApplyAndIdempotentTest (t , moduleRootPath , exampleRelativePath , option , assertion , true , e2eTestExecutor {})
53+ }
54+
55+ func RunE2ETestWithOption (t * testing.T , moduleRootPath , exampleRelativePath string , testOption TestOptions ) {
56+ initAndApplyAndIdempotentTest (t ,
57+ moduleRootPath ,
58+ exampleRelativePath ,
59+ testOption .TerraformOptions ,
60+ testOption .Assertion ,
61+ testOption .SkipIdempotentCheck ,
62+ e2eTestExecutor {})
4763}
4864
49- func initAndApplyAndIdempotentTest (t * testing.T , moduleRootPath string , exampleRelativePath string , option terraform.Options , assertion func (* testing.T , TerraformOutput ), executor testExecutor ) {
65+ func initAndApplyAndIdempotentTest (t * testing.T , moduleRootPath string , exampleRelativePath string , option terraform.Options , assertion func (* testing.T , TerraformOutput ), skipCheckIdempotent bool , executor testExecutor ) {
5066 tryParallel (t )
5167 defer executor .TearDown (t , moduleRootPath , exampleRelativePath )
5268 testDir := filepath .Join (moduleRootPath , exampleRelativePath )
@@ -70,7 +86,11 @@ func initAndApplyAndIdempotentTest(t *testing.T, moduleRootPath string, exampleR
7086 defer destroy (t , option )
7187
7288 initAndApply (t , & option )
73- if err := initAndPlanAndIdempotentAtEasyMode (t , option ); err != nil {
89+ var err error
90+ if ! skipCheckIdempotent {
91+ err = initAndPlanAndIdempotentAtEasyMode (t , option )
92+ }
93+ if err != nil {
7494 t .Fatalf (err .Error ())
7595 }
7696 if assertion != nil {
0 commit comments