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 11
11
def has_setenv_skip (fpath ):
12
12
with open (fpath ) as f :
13
13
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 ):
15
15
return True
16
16
return False
17
17
Original file line number Diff line number Diff line change @@ -34,6 +34,10 @@ def test_skip_uncommented(self):
34
34
test_file_path = os .path .join (self .fixture_dir , 'skip_uncommented_test.go' )
35
35
self ._check_failure ([test_file_path ], [test_file_path ])
36
36
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
+
37
41
def test_multiple_skip_uncommented (self ):
38
42
test_file_path = os .path .join (self .fixture_dir , 'multiple_skip_uncommented_test.go' )
39
43
self ._check_failure ([test_file_path ], [test_file_path ])
@@ -48,6 +52,7 @@ def test_everything(self):
48
52
os .path .join (self .fixture_dir , 'skip_uncommented_test.go' ),
49
53
os .path .join (self .fixture_dir , 'multiple_skip_uncommented_test.go' ),
50
54
os .path .join (self .fixture_dir , 'nested_uncommented_test.go' ),
55
+ os .path .join (self .fixture_dir , 'terratest_region_uncommented_test.go' ),
51
56
]
52
57
self ._check_failure (all_test_files , failed_files )
53
58
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ func TestWithStages(t *testing.T) {
12
12
t .Parallel ()
13
13
14
14
// 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 " )
16
16
//os.Setenv("SKIP_setup", "true")
17
17
//os.Setenv("SKIP_deploy", "true")
18
18
//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