@@ -162,6 +162,7 @@ func TestEngineChecksumVerification(t *testing.T) {
162162 // open the file and write some data
163163 file , err := os .OpenFile (fullPath , os .O_APPEND | os .O_WRONLY , 0600 )
164164 require .NoError (t , err )
165+
165166 nonExecutableData := []byte {0x00 }
166167 if _ , err := file .Write (nonExecutableData ); err != nil {
167168 require .NoError (t , err )
@@ -186,12 +187,14 @@ func TestEngineDisableChecksumCheck(t *testing.T) {
186187 if err != nil {
187188 return err
188189 }
190+
189191 if strings .HasSuffix (filepath .Base (path ), "_SHA256SUMS" ) {
190192 // clean checksum list
191193 if err := os .Truncate (path , 0 ); err != nil {
192194 return err
193195 }
194196 }
197+
195198 return nil
196199 })
197200 require .NoError (t , err )
@@ -291,14 +294,14 @@ func TestNoEngineFlagDisablesEngine(t *testing.T) {
291294 rootPath := filepath .Join (tmpEnvPath , testFixtureOpenTofuEngine )
292295
293296 // First, verify engine is used when experiment is enabled
294- stdout , stderr , err := helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --working-dir " + rootPath )
297+ _ , stderr , err := helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --working-dir " + rootPath )
295298 require .NoError (t , err )
296299 assert .Contains (t , stderr , "Tofu Initialization started" )
297300 assert .Contains (t , stderr , "Tofu Initialization completed" )
298301 assert .Contains (t , stderr , "Tofu Shutdown completed" )
299302
300303 // Then, verify engine is NOT used when --no-engine flag is set
301- stdout , stderr , err = helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --no-engine --working-dir " + rootPath )
304+ stdout , stderr , err : = helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --no-engine --working-dir " + rootPath )
302305 require .NoError (t , err )
303306 assert .NotContains (t , stderr , "Tofu Initialization started" )
304307 assert .NotContains (t , stderr , "Tofu Initialization completed" )
@@ -313,14 +316,14 @@ func TestNoEngineFlagWithExperimentFlag(t *testing.T) {
313316 rootPath := filepath .Join (tmpEnvPath , testFixtureOpenTofuEngine )
314317
315318 // Verify engine is used when --experiment iac-engine is set
316- stdout , stderr , err := helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --experiment iac-engine --working-dir " + rootPath )
319+ _ , stderr , err := helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --experiment iac-engine --working-dir " + rootPath )
317320 require .NoError (t , err )
318321 assert .Contains (t , stderr , "Tofu Initialization started" )
319322 assert .Contains (t , stderr , "Tofu Initialization completed" )
320323 assert .Contains (t , stderr , "Tofu Shutdown completed" )
321324
322325 // Verify engine is NOT used when both --experiment iac-engine and --no-engine are set
323- stdout , stderr , err = helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --experiment iac-engine --no-engine --working-dir " + rootPath )
326+ stdout , stderr , err : = helpers .RunTerragruntCommandWithOutput (t , "terragrunt plan --non-interactive --tf-forward-stdout --experiment iac-engine --no-engine --working-dir " + rootPath )
324327 require .NoError (t , err )
325328 assert .NotContains (t , stderr , "Tofu Initialization started" )
326329 assert .NotContains (t , stderr , "Tofu Initialization completed" )
@@ -337,14 +340,14 @@ func TestNoEngineFlagWithRunAll(t *testing.T) {
337340 rootPath := filepath .Join (tmpEnvPath , testFixtureOpenTofuRunAll )
338341
339342 // Verify engine is used in run --all when experiment is enabled
340- stdout , stderr , err := helpers .RunTerragruntCommandWithOutput (t , fmt .Sprintf ("terragrunt run --all --non-interactive --tf-forward-stdout --working-dir %s -- plan -no-color" , rootPath ))
343+ _ , stderr , err := helpers .RunTerragruntCommandWithOutput (t , fmt .Sprintf ("terragrunt run --all --non-interactive --tf-forward-stdout --working-dir %s -- plan -no-color" , rootPath ))
341344 require .NoError (t , err )
342345 assert .Contains (t , stderr , "Tofu Initialization started" )
343346 assert .Contains (t , stderr , "Tofu Initialization completed" )
344347 assert .Contains (t , stderr , "Tofu Shutdown completed" )
345348
346349 // Verify engine is NOT used in run --all when --no-engine is set
347- stdout , stderr , err = helpers .RunTerragruntCommandWithOutput (t , fmt .Sprintf ("terragrunt run --all --non-interactive --tf-forward-stdout --no-engine --working-dir %s -- plan -no-color" , rootPath ))
350+ stdout , stderr , err : = helpers .RunTerragruntCommandWithOutput (t , fmt .Sprintf ("terragrunt run --all --non-interactive --tf-forward-stdout --no-engine --working-dir %s -- plan -no-color" , rootPath ))
348351 require .NoError (t , err )
349352 assert .NotContains (t , stderr , "Tofu Initialization started" )
350353 assert .NotContains (t , stderr , "Tofu Initialization completed" )
@@ -362,6 +365,7 @@ func setupEngineCache(t *testing.T) (string, string) {
362365 helpers .CleanupTerraformFolder (t , testFixtureOpenTofuRunAll )
363366 tmpEnvPath := helpers .CopyEnvironment (t , testFixtureOpenTofuRunAll )
364367 rootPath := filepath .Join (tmpEnvPath , testFixtureOpenTofuRunAll )
368+
365369 return cacheDir , rootPath
366370}
367371
@@ -379,12 +383,14 @@ func setupLocalEngine(t *testing.T) string {
379383 if err := os .MkdirAll (engineDir , 0755 ); err != nil {
380384 require .NoError (t , err )
381385 }
386+
382387 _ , err := getter .GetAny (t .Context (), engineDir , downloadURL )
383388 require .NoError (t , err )
384389
385390 helpers .CopyAndFillMapPlaceholders (t , filepath .Join (testFixtureLocalEngine , "terragrunt.hcl" ), filepath .Join (rootPath , config .DefaultTerragruntConfigPath ), map [string ]string {
386391 "__engine_source__" : filepath .Join (engineDir , engineAssetName ),
387392 })
393+
388394 return rootPath
389395}
390396
@@ -394,5 +400,6 @@ func testEngineVersion() string {
394400 if ! found {
395401 return "v0.0.16"
396402 }
403+
397404 return value
398405}
0 commit comments