[pipedv1][terraform] Add unit tests for executeApplyStage, executePlanStage, and executeRollbackStage

Đang mở
#7,108 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

@akshat-lakhera đang làm issue này rồi.

Từ ngày 17/10/2026.

  • #7109 của @vishnukothakapu — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
76/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
go, terraform
Lĩnh vực
devops, testing-qa

Hướng nghiên cứu

Bắt đầu với các vị trí TODO trong pkg/app/pipedv1/plugin/terraform/deployment/apply.go, plan.go và rollback.go, sau đó đọc plugin_test.go và thư mục testdata của package. Thêm các unit test cho những trường hợp lỗi và trạng thái được liệt kê, tuân theo hạ tầng kiểm thử hiện có. Công việc được hoàn tất khi tất cả các kịch bản được chỉ định đều được bao phủ và các bài kiểm thử của package đều vượt qua.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

kind/enhancement

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.

Ngôn ngữ chính
Go
Star
1.4k
Fork
391
Merge trung bình
4 ngày 1 giờ
Pull request đã merge (30 ngày)
58

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pipe-cd/pipecd

Tất cả issue của pipe-cd/pipecd

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.