Shared test helper to enroll a node in API integration tests

オープン 初心者向け
#295 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
84/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
backend, testing

調査の方向性

issueに記載されている6つの統合テストファイルから始め、繰り返し行われているjoin token、CSR、enrollmentのセットアップを比較します。apps/api/src/testing/にあるtesting helperと、fleetのenrollmentのエントリーポイントを読み、各テストで何を返す必要があるかを特定します。共有helperを追加し、この6つのテストだけを更新して、pnpm test:integrationを実行します。同じテスト数で成功し、これらのテストのどれもfleet/infrastructure/をimportしていなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
TypeScript
スター
2
フォーク
1
平均マージ
7時間 17分
マージ済み PR(30日)
197

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

shipkeepdev/shipkeep のほかの issue

shipkeepdev/shipkeep の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。