@@ -49,13 +49,13 @@ func TestTerraformApplyOnMinimalExample(t *testing.T) {
49
49
vars ["ec2_instance_name" ] = rand .UniqueId
50
50
vars ["ec2_image" ] = rand .AmiId
51
51
52
- ao := NewApplyOptions ()
53
- ao .UniqueId = rand .UniqueId
54
- ao .TestName = "Test - TestTerraformApplyOnMinimalExample"
55
- ao .TemplatePath = path .Join (fixtureDir , "minimal-example" )
56
- ao .Vars = vars
52
+ options := NewTerratestOptions ()
53
+ options .UniqueId = rand .UniqueId
54
+ options .TestName = "Test - TestTerraformApplyOnMinimalExample"
55
+ options .TemplatePath = path .Join (fixtureDir , "minimal-example" )
56
+ options .Vars = vars
57
57
58
- _ , err = ApplyAndDestroy (ao )
58
+ _ , err = ApplyAndDestroy (options )
59
59
if err != nil {
60
60
t .Fatalf ("Failed to ApplyAndDestroy: %s" , err .Error ())
61
61
}
@@ -77,13 +77,13 @@ func TestApplyOrDestroyFailsOnTerraformError(t *testing.T) {
77
77
vars ["ec2_instance_name" ] = rand .UniqueId
78
78
vars ["ec2_image" ] = rand .AmiId
79
79
80
- ao := NewApplyOptions ()
81
- ao .UniqueId = rand .UniqueId
82
- ao .TestName = "Test - TestApplyOrDestroyFailsOnTerraformError"
83
- ao .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
84
- ao .Vars = vars
80
+ options := NewTerratestOptions ()
81
+ options .UniqueId = rand .UniqueId
82
+ options .TestName = "Test - TestApplyOrDestroyFailsOnTerraformError"
83
+ options .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
84
+ options .Vars = vars
85
85
86
- _ , err = ApplyAndDestroy (ao )
86
+ _ , err = ApplyAndDestroy (options )
87
87
if err != nil {
88
88
fmt .Printf ("Received expected failure message: %s. Continuing on..." , err .Error ())
89
89
} else {
@@ -109,15 +109,15 @@ func TestTerraformApplyOnMinimalExampleWithRetryableErrorMessages(t *testing.T)
109
109
vars ["ec2_instance_name" ] = rand .UniqueId
110
110
vars ["ec2_image" ] = rand .AmiId
111
111
112
- ao := NewApplyOptions ()
113
- ao .UniqueId = rand .UniqueId
114
- ao .TestName = "Test - TestTerraformApplyOnMinimalExampleWithRetryableErrorMessages"
115
- ao .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
116
- ao .Vars = vars
117
- ao .RetryableTerraformErrors = make (map [string ]string )
118
- ao .RetryableTerraformErrors ["aws_instance.demo: Error launching source instance: InvalidKeyPair.NotFound" ] = "This error was deliberately added to the template."
112
+ options := NewTerratestOptions ()
113
+ options .UniqueId = rand .UniqueId
114
+ options .TestName = "Test - TestTerraformApplyOnMinimalExampleWithRetryableErrorMessages"
115
+ options .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
116
+ options .Vars = vars
117
+ options .RetryableTerraformErrors = make (map [string ]string )
118
+ options .RetryableTerraformErrors ["aws_instance.demo: Error launching source instance: InvalidKeyPair.NotFound" ] = "This error was deliberately added to the template."
119
119
120
- output , err := ApplyAndDestroy (ao )
120
+ output , err := ApplyAndDestroy (options )
121
121
if err != nil {
122
122
if strings .Contains (output , "**TERRAFORM-RETRY**" ) {
123
123
fmt .Println ("Expected error was caught and a retry was attempted." )
@@ -147,15 +147,15 @@ func TestTerraformApplyOnMinimalExampleWithRetryableErrorMessagesDoesNotRetry(t
147
147
vars ["ec2_instance_name" ] = rand .UniqueId
148
148
vars ["ec2_image" ] = rand .AmiId
149
149
150
- ao := NewApplyOptions ()
151
- ao .UniqueId = rand .UniqueId
152
- ao .TestName = "Test - TestTerraformApplyOnMinimalExampleWithRetryableErrorMessagesDoesNotRetry"
153
- ao .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
154
- ao .Vars = vars
155
- ao .RetryableTerraformErrors = make (map [string ]string )
156
- ao .RetryableTerraformErrors ["I'm a message that shouldn't show up in the output" ] = ""
150
+ options := NewTerratestOptions ()
151
+ options .UniqueId = rand .UniqueId
152
+ options .TestName = "Test - TestTerraformApplyOnMinimalExampleWithRetryableErrorMessagesDoesNotRetry"
153
+ options .TemplatePath = path .Join (fixtureDir , "minimal-example-with-error" )
154
+ options .Vars = vars
155
+ options .RetryableTerraformErrors = make (map [string ]string )
156
+ options .RetryableTerraformErrors ["I'm a message that shouldn't show up in the output" ] = ""
157
157
158
- output , err := ApplyAndDestroy (ao )
158
+ output , err := ApplyAndDestroy (options )
159
159
if err != nil {
160
160
if strings .Contains (output , "**TERRAFORM-RETRY**" ) {
161
161
t .Fatalf ("Expected no terraform retry but instead a retry was attempted." )
@@ -196,13 +196,13 @@ func TestTerraformApplyAvoidsForbiddenRegion(t *testing.T) {
196
196
vars ["ec2_instance_name" ] = rand .UniqueId
197
197
vars ["ec2_image" ] = rand .AmiId
198
198
199
- ao := NewApplyOptions ()
200
- ao .UniqueId = rand .UniqueId
201
- ao .TestName = "Test - TestTerraformApplyAvoidsForbiddenRegion"
202
- ao .TemplatePath = path .Join (fixtureDir , "minimal-example" )
203
- ao .Vars = vars
199
+ options := NewTerratestOptions ()
200
+ options .UniqueId = rand .UniqueId
201
+ options .TestName = "Test - TestTerraformApplyAvoidsForbiddenRegion"
202
+ options .TemplatePath = path .Join (fixtureDir , "minimal-example" )
203
+ options .Vars = vars
204
204
205
- _ , err = ApplyAndDestroy (ao )
205
+ _ , err = ApplyAndDestroy (options )
206
206
if err != nil {
207
207
t .Fatalf ("Failed to ApplyAndDestroy: %s" , err .Error ())
208
208
}
0 commit comments