[pipedv1][terraform] Add unit tests for executeApplyStage, executePlanStage, and executeRollbackStage
维护者通常 2 天内回复
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 76/100
- Issue 类型
- 功能
- 描述清晰度
- 描述清楚
- 活跃度
- 冷清
- 技术栈
- go, terraform
- 领域
- devops, testing-qa
调研方向
先从 pkg/app/pipedv1/plugin/terraform/deployment/apply.go、plan.go 和 rollback.go 中的 TODO 位置开始,然后阅读 plugin_test.go 和 package 的 testdata 目录。遵循现有的测试基础设施,为列出的失败和状态场景添加单元测试。所有指定场景都已覆盖且 package 测试通过,即表示完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- Go
- 星标
- 1.4k
- 派生
- 391
- 平均合并
- 4 天 1 小时
- 30 天内合并 PR
- 58
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
pipe-cd/pipecd 的其他 Issue
-
Applications at the repository root are not triggered by new commits可能已有人在做 @Daksha1611 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 2 天内回复
-
pipedv1 kubernetes plugins ignore trafficRouting.istio.host in K8S_TRAFFIC_ROUTING可能已有人在做 @Dhirenderchoudhary 今天认领。 未关闭
难度 2/5 半天 新手友好度 74/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
pipectl transfer restore application drops backed-up labels可能已有人在做 @bhavishyajain545 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 86/100
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 2 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
docker-compose: postgres healthcheck should probe TCP (pg_isready -h localhost)可能已有人在做 @zezo-mohamed22 今天认领。 未关闭
难度 1/5 1 小时以内 新手友好度 82/100
OneBusAway/watchdog#305 · 1 条评论 ·
维护者通常 1 天内回复
-
self-care self-care:agent-discoverability
难度 2/5 1-3 小时 新手友好度 62/100
githubnext/gh-cao#20928 ·
维护者通常 1 天内回复
-
automation documentation
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
SocialGouv/iterion#3287 ·
维护者通常 1 天内回复