-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add KinD integration tests #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65a45d7 to
f58945d
Compare
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.
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
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.
3aef12d to
7630eda
Compare
Member
deansheather
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM if it passes shellcheck. I don't think adding a job for shellchecking is necessary though.
- 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
36ff121 to
693e95e
Compare
- 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
deansheather
approved these changes
Dec 15, 2025
- 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 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add integration tests that run against a real Kubernetes cluster using KinD (Kubernetes in Docker). This addresses #58.
Changes
New Files
integration_test.go- Integration tests with build tag//go:build integration.github/workflows/integration.yaml- CI workflow for integration testsscripts/kind-setup.sh- Helper script for local developmentTest Coverage
TestIntegration_PodEventsTestIntegration_ReplicaSetEventsTestIntegration_MultiNamespaceTestIntegration_LabelSelectorCI Workflow
The new workflow runs in sequence:
go test ./... -racemainand on all PRsLocal Development
Implementation Notes
fakeAgentAPIto mock the Coder server - this keeps tests fast and focused on validating real Kubernetes informer behaviorNodeSelectorwith non-existent labels to stay in Pending state (avoids needing to actually run containers)Closes #58