@@ -49,13 +49,13 @@ func TestTerraformApplyOnMinimalExample(t *testing.T) {
4949 vars ["ec2_instance_name" ] = rand .UniqueId
5050 vars ["ec2_image" ] = rand .AmiId
5151
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
5757
58- _ , err = ApplyAndDestroy (ao )
58+ _ , err = ApplyAndDestroy (options )
5959 if err != nil {
6060 t .Fatalf ("Failed to ApplyAndDestroy: %s" , err .Error ())
6161 }
@@ -77,13 +77,13 @@ func TestApplyOrDestroyFailsOnTerraformError(t *testing.T) {
7777 vars ["ec2_instance_name" ] = rand .UniqueId
7878 vars ["ec2_image" ] = rand .AmiId
7979
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
8585
86- _ , err = ApplyAndDestroy (ao )
86+ _ , err = ApplyAndDestroy (options )
8787 if err != nil {
8888 fmt .Printf ("Received expected failure message: %s. Continuing on..." , err .Error ())
8989 } else {
@@ -109,15 +109,15 @@ func TestTerraformApplyOnMinimalExampleWithRetryableErrorMessages(t *testing.T)
109109 vars ["ec2_instance_name" ] = rand .UniqueId
110110 vars ["ec2_image" ] = rand .AmiId
111111
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."
119119
120- output , err := ApplyAndDestroy (ao )
120+ output , err := ApplyAndDestroy (options )
121121 if err != nil {
122122 if strings .Contains (output , "**TERRAFORM-RETRY**" ) {
123123 fmt .Println ("Expected error was caught and a retry was attempted." )
@@ -147,15 +147,15 @@ func TestTerraformApplyOnMinimalExampleWithRetryableErrorMessagesDoesNotRetry(t
147147 vars ["ec2_instance_name" ] = rand .UniqueId
148148 vars ["ec2_image" ] = rand .AmiId
149149
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" ] = ""
157157
158- output , err := ApplyAndDestroy (ao )
158+ output , err := ApplyAndDestroy (options )
159159 if err != nil {
160160 if strings .Contains (output , "**TERRAFORM-RETRY**" ) {
161161 t .Fatalf ("Expected no terraform retry but instead a retry was attempted." )
@@ -196,13 +196,13 @@ func TestTerraformApplyAvoidsForbiddenRegion(t *testing.T) {
196196 vars ["ec2_instance_name" ] = rand .UniqueId
197197 vars ["ec2_image" ] = rand .AmiId
198198
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
204204
205- _ , err = ApplyAndDestroy (ao )
205+ _ , err = ApplyAndDestroy (options )
206206 if err != nil {
207207 t .Fatalf ("Failed to ApplyAndDestroy: %s" , err .Error ())
208208 }
0 commit comments