Commit eaac16b
test: add integration tests with real Consul instance
Add comprehensive integration test suite that runs against a real Consul
instance via Docker Compose. This validates the full election lifecycle
including session management, leader failover, and tag promotion.
Changes:
- Add configs/integration/docker-compose.yaml with minimal Consul setup
- Add internal/ballot/ballot_integration_test.go with 6 integration tests
- Update CI workflow to run integration tests with Consul service container
- Add Makefile with test targets (test, test-integration, etc.)
- Fix releaseSession() to always clear local state even if Destroy fails
Integration tests cover:
- Full election cycle (session, lock, tag promotion)
- Leader failover when session is destroyed
- Tag promotion/demotion
- Health check failure triggers demotion
- Multiple instances competing for leadership
- Session renewal over time
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>1 parent 8ddf12a commit eaac16b
File tree
5 files changed
+479
-5
lines changed- .github/workflows
- configs/integration
- internal/ballot
5 files changed
+479
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
767 | 767 | | |
768 | 768 | | |
769 | 769 | | |
770 | | - | |
771 | | - | |
772 | | - | |
773 | | - | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
774 | 773 | | |
775 | | - | |
| 774 | + | |
| 775 | + | |
776 | 776 | | |
0 commit comments