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

Abierto
#7,108 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@akshat-lakhera ya está trabajando en esto.

Desde el 17/10/2026.

  • #7109 de @vishnukothakapu — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
76/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Tranquilo
Stack tecnológico
go, terraform

Línea de trabajo

Comienza por las ubicaciones de TODO en pkg/app/pipedv1/plugin/terraform/deployment/apply.go, plan.go y rollback.go; después, lee plugin_test.go y el directorio testdata del paquete. Añade pruebas unitarias para los casos de fallo y estado indicados, siguiendo la infraestructura de pruebas existente. Se considera terminado cuando todos los escenarios especificados estén cubiertos y las pruebas del paquete pasen.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Go
Estrellas
1.4k
Forks
391
Merge medio
4 d 1 h
PR fusionados (30 d)
58

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pipe-cd/pipecd

Todos los issues de pipe-cd/pipecd

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.