[pipedv1][terraform] Add unit tests for executeApplyStage, executePlanStage, and executeRollbackStage
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 1.4k
- Forks
- 364
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 84
Description
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-executeApplyStagepkg/app/pipedv1/plugin/terraform/deployment/plan.go:28-executePlanStagepkg/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
StageLogPersisteris unavailable (nil client) - Failure when
provider.NewTerraformCommandfails (invalid/missing directory)
executePlanStage:
- Failure when
StageLogPersisteris unavailable - Failure when
StageConfigJSON is invalid StageStatusExitedwhen plan shows no changes andExitOnNoChanges: trueStageStatusSuccesswhen plan shows no changes andExitOnNoChanges: false
executeRollbackStage:
- Failure when
StageLogPersisteris unavailable StageStatusFailurewhenRunningDeploymentSource.CommitHashis empty (first deployment guard)- Failure when
provider.NewTerraformCommandfails
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TODO locations in pkg/app/pipedv1/plugin/terraform/deployment/apply.go, plan.go, and rollback.go, then read plugin_test.go and the package testdata directory. Add unit tests for the listed failure and status cases, following the existing test infrastructure. Done means all specified scenarios are covered and the package tests pass.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, terraform
- Domain
- devops, testing-qa
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100