Shared test helper to enroll a node in API integration tests

Abierto Apto para principiantes
#295 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
84/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
backend, testing

Línea de trabajo

Empieza por los seis archivos de pruebas de integración enumerados en el issue y compara la configuración repetida de join token, CSR y enrollment. Lee los helpers de testing en apps/api/src/testing/ y los puntos de entrada de enrollment de fleet para identificar qué necesita que devuelva cada prueba. Añade el helper compartido, actualiza solo esas seis pruebas y ejecuta pnpm test:integration; el trabajo está terminado cuando pasa con el mismo número de pruebas y ninguna de esas pruebas importa fleet/infrastructure/.

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

Descripción

good first issue

What

Six integration tests outside the fleet module enroll a test node by importing fleet/infrastructure/ca/x509 directly to build a certificate signing request:

  • apps/api/src/modules/apps/application-domains-http.integration.spec.ts
  • apps/api/src/modules/confirmations/confirmation-http.integration.spec.ts
  • apps/api/src/modules/deployments/agent-actions-http.integration.spec.ts
  • apps/api/src/modules/deployments/allocation-observations.integration.spec.ts
  • apps/api/src/modules/deployments/deployment-pipeline.integration.spec.ts
  • apps/api/src/modules/deployments/pipeline-store.integration.spec.ts

CLAUDE.md says modules never import each other's infrastructure/. Tests are not production code, but the repeated setup also duplicates the same steps: issue a join token, build a CSR, enroll.

Proposed change

Add a shared helper in apps/api/src/testing/ (for example enroll-test-node.ts) that issues a join token, builds the CSR, enrolls a node and returns what the tests need. Use it in the six tests above and remove their direct fleet/infrastructure imports. The tests inside fleet itself can keep theirs.

Done when

  • None of the files listed above imports ../fleet/infrastructure/.
  • pnpm test:integration passes with the same number of tests.
  • Nothing changes outside src/testing/ and the six tests.

Raised in the review of #290.

Lenguaje dominante
TypeScript
Estrellas
2
Forks
1
Merge medio
7 h 17 min
PR fusionados (30 d)
197

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 shipkeepdev/shipkeep

Todos los issues de shipkeepdev/shipkeep

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.