@@ -347,6 +347,17 @@ func (runner *TestFileRunner) walkGraph(g *terraform.Graph) tfdiags.Diagnostics
347
347
348
348
switch v := v .(type ) {
349
349
case * graph.NodeTestRun :
350
+ file := v .File ()
351
+ run := v .Run ()
352
+ if file .GetStatus () == moduletest .Error {
353
+ // If the overall test file has errored, we don't keep trying to
354
+ // execute tests. Instead, we mark all remaining run blocks as
355
+ // skipped, print the status, and move on.
356
+ run .Status = moduletest .Skip
357
+ runner .Suite .View .Run (run , file , moduletest .Complete , 0 )
358
+ return
359
+ }
360
+
350
361
// TODO: The execution of a NodeTestRun is currently split between
351
362
// its Execute method and the continuation of the walk callback.
352
363
// Eventually, we should move all the logic related to a test run into
@@ -356,7 +367,7 @@ func (runner *TestFileRunner) walkGraph(g *terraform.Graph) tfdiags.Diagnostics
356
367
if diags .HasErrors () {
357
368
return diags
358
369
}
359
- // continue
370
+ // continue the execution of the test run.
360
371
case graph.GraphNodeExecutable :
361
372
diags = v .Execute (runner .EvalContext )
362
373
return diags
@@ -378,17 +389,6 @@ func (runner *TestFileRunner) walkGraph(g *terraform.Graph) tfdiags.Diagnostics
378
389
runner .Suite .View .Run (run , file , moduletest .Complete , 0 )
379
390
return
380
391
}
381
- file .Lock ()
382
- if file .Status == moduletest .Error {
383
- // If the overall test file has errored, we don't keep trying to
384
- // execute tests. Instead, we mark all remaining run blocks as
385
- // skipped, print the status, and move on.
386
- run .Status = moduletest .Skip
387
- runner .Suite .View .Run (run , file , moduletest .Complete , 0 )
388
- file .Unlock ()
389
- return
390
- }
391
- file .Unlock ()
392
392
393
393
key := run .GetStateKey ()
394
394
if run .Config .ConfigUnderTest != nil {
0 commit comments