Commit 8ea3f21
authored
feat: add KinD integration tests (#141)
* feat: add KinD integration tests
Add integration tests that run against a real Kubernetes cluster using
KinD (Kubernetes in Docker). This addresses #58.
Changes:
- Add integration_test.go with tests for:
- Pod events (create/delete)
- ReplicaSet events
- Multi-namespace support
- Label selector filtering
- Add .github/workflows/integration.yaml CI workflow that:
- Runs lint and unit tests first
- Then runs integration tests with KinD
- 10 minute timeout
- Add scripts/kind-setup.sh for local development
- Update README.md with integration test documentation
The integration tests use the existing fakeAgentAPI to mock the Coder
server, focusing on validating real Kubernetes informer behavior.
* fix: use real clock for integration tests
The integration tests were using quartz.NewMock(t) which creates a mock
clock that doesn't advance automatically. This caused timeouts when
waiting for log source registration because the timers in the log
queuer never fired.
Changes:
- Remove mock clock usage from all integration tests
- Use real clock (nil) which is the default
- Reduce logDebounce to 5s for faster test execution
- Increase informer sync wait to 1s for reliability
* fix: remove duplicate unit-test job from integration workflow
* fix: make integration tests more robust against event ordering
The tests now use waitForLogContaining which continuously collects
logs until finding the expected message, rather than expecting
specific messages in the first batch of logs received.
This fixes flaky tests caused by Kubernetes scheduling events
arriving before pod lifecycle events.
* fix: address PR review feedback
- Add safety check to prevent running integration tests against
non-KinD clusters (detects localhost/127.0.0.1/kind in host)
- Use SHA pinning for GitHub Actions with version comments
- Add INTEGRATION_TEST_UNSAFE=1 escape hatch for special cases
* chore: add binary to gitignore
* feat: add Makefile with lint/shellcheck and fmt/shfmt targets
- Add Makefile with build, test, lint, and fmt targets
- Fix shellcheck warnings in scripts/helm.sh and scripts/version.sh
- Format shell scripts with shfmt
* chore: update GitHub Actions dependencies and clean up .gitignore
- Update actions/checkout to v6.0.1
- Update actions/setup-go to v6.1.0
- Update helm/kind-action to v1.13.0
- Remove buildcoder-logstream-kube from .gitignore
* fix: address remaining PR review comments
- Fix safety check logic: check INTEGRATION_TEST_UNSAFE env var
before calling t.Fatalf, not after
- Fix .gitignore: add coder-logstream-kube and build/ on separate lines
* fix: use Go 1.24 in integration workflow to match go.mod1 parent db7bcb7 commit 8ea3f21
File tree
9 files changed
+814
-18
lines changed- .github/workflows
- scripts
9 files changed
+814
-18
lines changed| 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 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
1 | 2 | | |
2 | | - | |
| 3 | + | |
| 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 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
0 commit comments