File tree Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Original file line number Diff line number Diff line change 1111def has_setenv_skip (fpath ):
1212 with open (fpath ) as f :
1313 for line in f :
14- if re .match (r'^\s+os.Setenv\(\"SKIP_' , line ):
14+ if re .match (r'^\s+os.Setenv\(\"( SKIP_|TERRATEST_REGION) ' , line ):
1515 return True
1616 return False
1717
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ def test_skip_uncommented(self):
3434 test_file_path = os .path .join (self .fixture_dir , 'skip_uncommented_test.go' )
3535 self ._check_failure ([test_file_path ], [test_file_path ])
3636
37+ def test_terratest_region_uncommented (self ):
38+ test_file_path = os .path .join (self .fixture_dir , 'terratest_region_uncommented_test.go' )
39+ self ._check_failure ([test_file_path ], [test_file_path ])
40+
3741 def test_multiple_skip_uncommented (self ):
3842 test_file_path = os .path .join (self .fixture_dir , 'multiple_skip_uncommented_test.go' )
3943 self ._check_failure ([test_file_path ], [test_file_path ])
@@ -48,6 +52,7 @@ def test_everything(self):
4852 os .path .join (self .fixture_dir , 'skip_uncommented_test.go' ),
4953 os .path .join (self .fixture_dir , 'multiple_skip_uncommented_test.go' ),
5054 os .path .join (self .fixture_dir , 'nested_uncommented_test.go' ),
55+ os .path .join (self .fixture_dir , 'terratest_region_uncommented_test.go' ),
5156 ]
5257 self ._check_failure (all_test_files , failed_files )
5358
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ func TestWithStages(t *testing.T) {
1212 t .Parallel ()
1313
1414 // Uncomment the items below to skip certain parts of the test
15- os .Setenv ("TERRATEST_REGION " , "eu-west-1 " )
15+ os .Setenv ("THE_ANSWER " , "42 " )
1616 //os.Setenv("SKIP_setup", "true")
1717 //os.Setenv("SKIP_deploy", "true")
1818 //os.Setenv("SKIP_validate", "true")
Original file line number Diff line number Diff line change 1+ package basecase
2+
3+ import (
4+ "os"
5+ "testing"
6+
7+ "github.com/gruntwork-io/terratest/modules/logger"
8+ test_structure "github.com/gruntwork-io/terratest/modules/test-structure"
9+ )
10+
11+ func TestWithStages (t * testing.T ) {
12+ t .Parallel ()
13+
14+ // Uncomment the items below to skip certain parts of the test
15+ os .Setenv ("TERRATEST_REGION" , "eu-west-1" )
16+ //os.Setenv("SKIP_setup", "true")
17+ //os.Setenv("SKIP_deploy", "true")
18+ //os.Setenv("SKIP_validate", "true")
19+ //os.Setenv("SKIP_cleanup", "true")
20+
21+ test_structure .RunTestStage (t , "setup" , func () {
22+ logger .Logf (t , "setup" )
23+ })
24+
25+ defer test_structure .RunTestStage (t , "cleanup" , func () {
26+ logger .Logf (t , "cleanup" )
27+ })
28+
29+ test_structure .RunTestStage (t , "deploy" , func () {
30+ logger .Logf (t , "deploy" )
31+ })
32+
33+ test_structure .RunTestStage (t , "validate" , func () {
34+ logger .Logf (t , "validate" )
35+ })
36+ }
You can’t perform that action at this time.
0 commit comments