-
Notifications
You must be signed in to change notification settings - Fork 4
Add integration tests to CI pipeline #19
Description
Summary
The CI pipeline runs unit tests but not integration tests. Integration tests exist in `test/integration_test.go` but aren't executed in CI.
Current State
```yaml
.github/workflows/ci.yml
- name: Run tests
run: go test -v -race -coverprofile=coverage.out -covermode=atomic ./...
```
This runs all tests including integration tests, but they may be skipped or fail in CI due to missing dependencies.
Expected Outcome
Option A: Run integration tests with test containers
```yaml
integration-test:
name: Integration Tests
runs-on: ubuntu-latest
needs: [lint]
services:
postgres:
image: postgres:15
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: gomcp_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- name: Run integration tests
env:
POSTGRES_HOST: localhost
POSTGRES_PORT: 5432
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: gomcp_test
run: go test -v -tags=integration ./test/...
```
Option B: Use build tags to separate tests
```go
//go:build integration
package test
// ... integration tests
```
Then run separately:
```yaml
-
name: Run unit tests
run: go test -v ./... -
name: Run integration tests
run: go test -v -tags=integration ./test/...
```
Acceptance Criteria
- Integration tests run in CI
- Tests use service containers or mocks
- Clear separation between unit and integration tests
- Integration test failures don't block unit test results
- Documentation for running integration tests locally