Skip to content

/healthエンドポイントの追加とStoreテストによるカバレッジ向上#12

Merged
mohadayo merged 1 commit intomainfrom
feat/health-endpoint-and-store-tests
Apr 8, 2026
Merged

/healthエンドポイントの追加とStoreテストによるカバレッジ向上#12
mohadayo merged 1 commit intomainfrom
feat/health-endpoint-and-store-tests

Conversation

@mohadayo
Copy link
Copy Markdown
Owner

@mohadayo mohadayo commented Apr 8, 2026

変更概要

  • GET /health エンドポイントを新規追加(コンテナ/K8s対応)
  • store_test.go を新規作成してStoreメソッドを直接テスト
  • テストカバレッジを 83.8% → 89.7% に向上

詳細

新機能: /health エンドポイント

  • レスポンス形式: JSON
  • フィールド: status, service, uptime, timestamp

新規 store_test.go

  • TestNewStore / TestCreateListAndGetList / TestGetListNonExistent
  • TestAddItemToNonExistentList / TestAddItemAndRetrieve
  • TestDeleteListReturnValues / TestUniqueTokens
  • TestConcurrentCreateList / TestConcurrentAddItem (並行テスト)
  • TestGetEnv (環境変数読み取り関数のテスト)

対応 Issue

Closes #11

動作確認手順

  1. go test -v -race ./... で全テストがパスすることを確認
  2. go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out でカバレッジ確認
  3. サーバー起動後 curl http://localhost:8080/health でJSONレスポンスを確認

- handler.go: GET /health エンドポイントを追加(JSON形式でstatus/service/uptime/timestampを返す)
- handler_test.go: TestHealthEndpoint テストを追加
- store_test.go: 新規作成 - Store メソッドの直接テスト・並行テストを追加
  - TestNewStore, TestCreateListAndGetList, TestGetListNonExistent
  - TestAddItemToNonExistentList, TestAddItemAndRetrieve
  - TestDeleteListReturnValues, TestUniqueTokens
  - TestConcurrentCreateList, TestConcurrentAddItem (race condition 検証)
  - TestGetEnv
- カバレッジ: 83.8% → 89.7% に向上

Closes #11
@mohadayo mohadayo merged commit 98e6a41 into main Apr 8, 2026
@mohadayo mohadayo deleted the feat/health-endpoint-and-store-tests branch April 8, 2026 18:34
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.

ヘルスチェックエンドポイントの追加・Store直接テストによるカバレッジ向上

1 participant