Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9b4e894
wip
zhouzhuojie Jun 9, 2026
a90d8c7
refactor: split integration test monolith, clean up seed data, remove…
zhouzhuojie Jun 9, 2026
b0ff22d
fix: ensure integration.test is removed before rebuild in CI
zhouzhuojie Jun 9, 2026
39b59ac
fix: use rm -rf for integration.test (may be dir from Docker bind mou…
zhouzhuojie Jun 9, 2026
6b8709c
fix: ensure down runs before test to avoid stale bind-mount dirs
zhouzhuojie Jun 9, 2026
1d6c924
fix: use docker compose cp instead of bind mount for test binary
zhouzhuojie Jun 9, 2026
444d78d
fix: use service name for docker compose cp (not container name)
zhouzhuojie Jun 9, 2026
05e0fb7
fix: copy test binary to /tmp (Alpine has no /app)
zhouzhuojie Jun 9, 2026
17bef9a
fix: pipe binary via cat instead of docker cp, restore total counter,…
zhouzhuojie Jun 9, 2026
6d7f79e
refactor: use golang image for integration-runner, drop host-compiled…
zhouzhuojie Jun 9, 2026
73158e7
fix: use -e FLAGR_SERVER_URL in docker compose exec, add CI matrix
zhouzhuojie Jun 9, 2026
fded237
simplify: remove log collection, output test results directly to CI logs
zhouzhuojie Jun 9, 2026
4840eef
fix: use sh -c with inline env instead of docker compose -e flag
zhouzhuojie Jun 9, 2026
79b044c
fix: pass FLAGR_SERVER_URL from host into container via docker compos…
zhouzhuojie Jun 9, 2026
6440e38
refactor: TestMain loops over FLAGR_SERVER_URLS, remove integration-r…
zhouzhuojie Jun 9, 2026
ae5a3e9
fix: use '.' not './integration_tests/' in integration_tests/Makefile
zhouzhuojie Jun 9, 2026
15aabe0
fix: run go test inside docker compose network via integration-runner…
zhouzhuojie Jun 9, 2026
83db8f9
fix: use env command inside container instead of -e flag for env var …
zhouzhuojie Jun 9, 2026
d46e2bd
fix: use ./integration_tests/ package path (root has no Go files)
zhouzhuojie Jun 9, 2026
2566317
fix: bake FLAGR_SERVER_URLS into docker-compose.yml environment, set …
zhouzhuojie Jun 9, 2026
7a68981
fix: the real root cause was a double-port bug in TestMain URL constr…
zhouzhuojie Jun 9, 2026
fff2874
fix: use Docker Compose list syntax for environment (mapping syntax i…
zhouzhuojie Jun 9, 2026
ca50acd
fix: use docker compose run --rm instead of exec for reliable env var…
zhouzhuojie Jun 9, 2026
665e25e
debug: add diagnostic output to TestMain to see env var values
zhouzhuojie Jun 9, 2026
dbada5f
debug: switch to stdout for env var diagnostic
zhouzhuojie Jun 9, 2026
16dd8c0
debug: use os.Stdout.WriteString + Sync for guaranteed flush
zhouzhuojie Jun 9, 2026
aab729a
fix: hardcode Docker instance URLs as default, use env var only as ov…
zhouzhuojie Jun 9, 2026
50022e7
debug: verify TestMain is called
zhouzhuojie Jun 9, 2026
4449f03
fix: run go test from CI host, add port mappings to docker-compose.yml
zhouzhuojie Jun 9, 2026
bec1432
debug: add init() to verify integration_server.go is compiled
zhouzhuojie Jun 9, 2026
9297b2a
debug: print env var values in TestMain
zhouzhuojie Jun 9, 2026
5bf8f8a
debug: panic at start of TestMain to verify it's called
zhouzhuojie Jun 9, 2026
b6d15c4
fix: rename integration_server.go to _test.go so Go recognizes TestMain
zhouzhuojie Jun 9, 2026
9728af1
fix: remove all debug code, TestMain now works after rename to _test.go
zhouzhuojie Jun 9, 2026
48da89c
refactor: thermo-nuclear code quality review fixes
zhouzhuojie Jun 10, 2026
f9d8767
refactor: address thermo-nuclear code quality review findings
zhouzhuojie Jun 10, 2026
980fe58
fix: remove dead benchEvalRaw, add missing assertions, fix weak Prelo…
zhouzhuojie Jun 10, 2026
a2b032a
fix: apply Go skill best practices
zhouzhuojie Jun 10, 2026
f69c507
ci: run integration benchmarks after tests in CI
zhouzhuojie Jun 10, 2026
b38629a
fix: make prepareServer idempotent for benchmark re-runs
zhouzhuojie Jun 10, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ jobs:
integration_test:
runs-on: ubuntu-latest
steps:
- name: Check out source code
uses: actions/checkout@v4
- run: cd integration_tests && make build-image
- run: cd integration_tests && make down
- run: cd integration_tests && make up
- run: cd integration_tests && make test
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.26"
- name: Build, run Go integration tests, and benchmarks against all instances
run: cd integration_tests && make test-and-bench
e2e_test:
runs-on: ubuntu-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ coverage.txt
/.cursor/
/.sem/
progress.md
integration-bench.txt

7 changes: 7 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Flagr — Go feature flag service with Vue 3 UI.
| `make test` | Go unit tests |
| `make test-e2e` | Build Go binary → start servers via `scripts/e2e-server.sh` → Playwright → cleanup |
| `make swagger` | Regenerate `swagger_gen/` from OpenAPI spec |
| `make test-integration` | Run Go integration tests (auto-starts local server, SQLite) |
| `make bench-integration` | Run HTTP eval benchmarks against local server |

**UI-only** (`browser/flagr-ui/`): `npm run dev` (Vite), `npm run build`, `npm run test:e2e` (needs servers running).

Expand Down Expand Up @@ -45,6 +47,11 @@ Flagr — Go feature flag service with Vue 3 UI.

**E2E tests:** `make test-e2e` — single command. Uses `scripts/e2e-server.sh` (idempotent, port-safe) and Playwright's `webServer` lifecycle. Always works regardless of leftover processes.

**Integration tests:** Three modes:
- **Local** (`make test-integration`): Auto-starts server on random port with SQLite `:memory:`. Run `go test -tags=integration ./integration_tests/` directly.
- **Docker Compose** (`cd integration_tests && make test`): Builds Go test binary, loops over 6 flagr instances (sqlite, mysql, mysql8, postgres9, postgres13, checkr), runs suite against each.
- **Benchmarks** (`make bench-integration`): HTTP eval benchmarks against auto-started server.

**Process management** uses `lsof -ti:<port>` not `pkill -f`, so it never touches processes from other projects.

## Constraints
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ test-e2e: build
@echo "Running Flagr UI e2e tests..."
@cd ./browser/flagr-ui/; npx playwright test

.PHONY: test-integration
test-integration: build
@echo "Running Go integration tests (local auto-start mode)..."
@go test -tags=integration -count=1 -v ./integration_tests/

.PHONY: bench-integration
bench-integration: build
@echo "Running Go integration benchmarks (local auto-start mode)..."
@go test -tags=integration -bench=. -benchmem -count=1 -run=^$$ ./integration_tests/ > integration-bench.txt
@echo "Benchmarks saved to integration-bench.txt"


stop-ui:
@-kill $$(lsof -ti:18000 2>/dev/null) 2>/dev/null; kill $$(lsof -ti:8080 2>/dev/null) 2>/dev/null; sleep 1; echo "Stopped UI services"

Expand Down
2 changes: 2 additions & 0 deletions docs/_sidebar.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- [Overview](flagr_overview.md)
- [Use Cases](flagr_use_cases.md)
- [Debug Console](flagr_debugging.md)
- Development & Testing
- [Testing](home?id=testing)
- Server Configuration
- [Env](flagr_env.md)
- [Notifications](flagr_notifications.md)
Expand Down
58 changes: 58 additions & 0 deletions docs/home.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,61 @@ And alternatively to just run the UI service:
```
make run_ui
```

## Testing

Flagr has three kinds of tests, each serving a different purpose.

### Unit tests

Run the Go unit tests (no external services required):

```bash
make test
```

Or directly:

```bash
go test ./pkg/...
```

### E2E tests (Flagr UI)

Playwright-based end-to-end tests for the Vue 3 UI. Builds the Go
server, starts the backend and UI servers, runs Playwright, then cleans up:

```bash
make test-e2e
```

### Integration tests (API, multi-DB)

HTTP-level integration tests covering all CRUD and eval endpoints.
Seeds ~50 realistic flags across all 12 constraint operators.

**Local mode** — SQLite `:memory:`, auto-starts server on random port:

```bash
make test-integration
```

**Docker Compose mode** — runs the same test suite against 6 flagr
instances (SQLite, MySQL, MySQL 8, PostgreSQL 9, PostgreSQL 13,
checkr/flagr):

```bash
cd integration_tests && make test
```

**HTTP eval benchmarks** — measures end-to-end eval latency through HTTP:

```bash
make bench-integration
```

To run against a single Docker Compose instance:

```bash
cd integration_tests && make test-instance INSTANCE=flagr_with_mysql
```
Loading
Loading