Skip to content

テスト拡充 & CLI出力のミニマル化(Presenterパターン導入)#39

Merged
harakeishi merged 8 commits intomainfrom
feat/expand-integration-tests
Feb 17, 2026
Merged

テスト拡充 & CLI出力のミニマル化(Presenterパターン導入)#39
harakeishi merged 8 commits intomainfrom
feat/expand-integration-tests

Conversation

@harakeishi
Copy link
Owner

概要

gopose のテストカバレッジを大幅に拡充し、CLI出力をミニマル&クリーンにリデザイン。新規
internal/presenter/ パッケージを SOLID
原則に基づいて導入し、衝突回避結果をテーブル形式で表示するようにした。

変更内容

  • CLI出力のリデザイン
    • internal/presenter/ パッケージを新規作成(Presenter インターフェース + TablePresenter
      実装)
    • text/tabwriter (stdlib) によるカラム整列されたテーブル形式の衝突回避結果表示
    • cmd/up.go の冗長なログ出力を削除し、途中経過は簡潔な1行(Scanning... /
      Resolving...)に統一
    • ユーザー向け出力と構造化ログの責務を分離(logger.Infologger.Debug に降格)
    • 衝突なし時は (none) を明示表示
  • テストカバレッジの拡充
    • internal/presenter/table_test.go: TablePresenter の8テストケース
    • internal/errors/handlers_test.go: エラーハンドラ・ファクトリ関数のユニットテスト
    • internal/scanner/netstat_test.go, port_allocator_test.go:
      netstatパーサー・ポートアロケータのエッジケーステスト
    • internal/integration/pipeline_test.go: Parser→Scanner→Generator パイプライン統合テスト
    • internal/integration/e2e_test.go: tempdir 隔離による E2E テスト
    • cmd/up_test.go: createPortConfig エッジケーステスト追加
    • testdata/integration/: テスト用 compose ファイル3種追加
  • 設計ドキュメント
    • docs/plans/2026-02-17-output-styling-design.md: 出力スタイリング設計書
    • docs/plans/2026-02-17-output-styling-plan.md: 実装計画書

期待すること

  • CLI出力がミニマルになり、衝突回避結果が一目で把握できる
  • --detail フラグによる構造化ログ出力は従来通り維持される
  • テストカバレッジの向上により、リグレッション検知力が高まる

動作確認

項目 証憑(スクショなど) 備考
ポート衝突がある場合に gopose up を実行し、テーブル形式で結果が表示される Port Conflicts:
テーブルに SERVICE/FROM/TO が表示
ネットワーク衝突がある場合に gopose up を実行し、テーブル形式で結果が表示される `Network
Conflicts:` テーブルに NETWORK/FROM/TO が表示
衝突がない場合に gopose up を実行し、(none) が表示される 各テーブルに (none) 行が表示
--dry-run オプションで Dry run: no files written. が表示される
--detail オプションで従来通りの構造化ログが出力される slog 形式のタイムスタンプ付きログ
go test ./... -count=1 が全パッケージ PASS する 10パッケージ全て PASS 確認済み
go vet ./... で問題がないこと 確認済み

harakeishi and others added 8 commits February 17, 2026 15:12
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Change default log level from info to warn
- Add log level filtering for detailed=false mode
- Demote port conflict detection Warn to Info (shown in table instead)
- Propagate level field through WithField/WithFields/WithError

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@harakeishi harakeishi merged commit 33b06c7 into main Feb 17, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant