What would you like to be added:
Three stage-execution functions in the pipedv1 Terraform plugin are marked with // TODO: add test comments but have no unit tests:
pkg/app/pipedv1/plugin/terraform/deployment/apply.go:27 - executeApplyStage
pkg/app/pipedv1/plugin/terraform/deployment/plan.go:28 - executePlanStage
pkg/app/pipedv1/plugin/terraform/deployment/rollback.go:27 - executeRollbackStage
These TODOs were left by the original authors as explicit invitations for contribution. The test infrastructure already exists (plugin_test.go and testdata/ directory in the same package), so no new scaffolding is needed.
Tests should cover at least:
executeApplyStage:
- Failure when
StageLogPersister is unavailable (nil client)
- Failure when
provider.NewTerraformCommand fails (invalid/missing directory)
executePlanStage:
- Failure when
StageLogPersister is unavailable
- Failure when
StageConfig JSON is invalid
StageStatusExited when plan shows no changes and ExitOnNoChanges: true
StageStatusSuccess when plan shows no changes and ExitOnNoChanges: false
executeRollbackStage:
- Failure when
StageLogPersister is unavailable
StageStatusFailure when RunningDeploymentSource.CommitHash is empty (first deployment guard)
- Failure when
provider.NewTerraformCommand fails
Why is this needed:
These functions are core to the Terraform plugin's deployment lifecycle but are completely untested. Adding tests here improves confidence in the pipedv1 plugin architecture and aligns with the project's existing testing patterns already seen in plugin_test.go.
What would you like to be added:
Three stage-execution functions in the pipedv1 Terraform plugin are marked with
// TODO: add testcomments but have no unit tests:pkg/app/pipedv1/plugin/terraform/deployment/apply.go:27-executeApplyStagepkg/app/pipedv1/plugin/terraform/deployment/plan.go:28-executePlanStagepkg/app/pipedv1/plugin/terraform/deployment/rollback.go:27-executeRollbackStageThese TODOs were left by the original authors as explicit invitations for contribution. The test infrastructure already exists (
plugin_test.goandtestdata/directory in the same package), so no new scaffolding is needed.Tests should cover at least:
executeApplyStage:
StageLogPersisteris unavailable (nil client)provider.NewTerraformCommandfails (invalid/missing directory)executePlanStage:
StageLogPersisteris unavailableStageConfigJSON is invalidStageStatusExitedwhen plan shows no changes andExitOnNoChanges: trueStageStatusSuccesswhen plan shows no changes andExitOnNoChanges: falseexecuteRollbackStage:
StageLogPersisteris unavailableStageStatusFailurewhenRunningDeploymentSource.CommitHashis empty (first deployment guard)provider.NewTerraformCommandfailsWhy is this needed:
These functions are core to the Terraform plugin's deployment lifecycle but are completely untested. Adding tests here improves confidence in the pipedv1 plugin architecture and aligns with the project's existing testing patterns already seen in plugin_test.go.