Skip to content

Commit

Permalink
fix(manager): don't shadow module test script exit code
Browse files Browse the repository at this point in the history
This was redeclaring the `testRC` var defined in the outer scope. The
`err` var already exists in this scope from the prior calls, so both of
these vars can be updated to just assignment, no declaration needed (and
thus no shadowing). This preserves the test script's exit code, rather
than always returning 0 because it was in the wrong scope.
  • Loading branch information
tjhop committed Jun 22, 2024
1 parent f7f4100 commit 60dc660
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion internal/manager/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (mgr *Manager) RunModule(ctx context.Context, logger *slog.Logger, mod Modu
return fmt.Errorf("Failed to template script: %s", err)
}

testRC, err := shell.Run(ctx, runID, mod.m.Test, renderedTest, allVars)
testRC, err = shell.Run(ctx, runID, mod.m.Test, renderedTest, allVars)
switch {
case err != nil:
// if test script for a module fails, log a warning for user and continue with apply
Expand Down

0 comments on commit 60dc660

Please sign in to comment.