-
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
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ac1f200
feat: add KinD integration tests
kacpersaw 6558412
fix: use real clock for integration tests
kacpersaw c731c5f
fix: remove duplicate unit-test job from integration workflow
kacpersaw 7630eda
fix: make integration tests more robust against event ordering
kacpersaw 693e95e
fix: address PR review feedback
kacpersaw d79fcde
chore: add binary to gitignore
kacpersaw 509babe
feat: add Makefile with lint/shellcheck and fmt/shfmt targets
kacpersaw 5bc0fbf
chore: update GitHub Actions dependencies and clean up .gitignore
kacpersaw 762b59f
fix: address remaining PR review comments
kacpersaw 1a8211c
fix: use Go 1.24 in integration workflow to match go.mod
kacpersaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: integration | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
|
|
||
| permissions: | ||
| actions: none | ||
| checks: none | ||
| contents: read | ||
| deployments: none | ||
| issues: none | ||
| packages: none | ||
| pull-requests: none | ||
| repository-projects: none | ||
| security-events: none | ||
| statuses: none | ||
|
|
||
| # Cancel in-progress runs for pull requests when developers push | ||
| # additional changes | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | ||
|
|
||
| jobs: | ||
| integration-test: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | ||
|
|
||
| - name: Setup Go | ||
| uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5 | ||
| with: | ||
| go-version: "~1.22" | ||
|
|
||
| - name: Create KinD cluster | ||
| uses: helm/kind-action@ca7011b09d9a57d57555716e97a4acea579a2b92 # v1 | ||
| with: | ||
| cluster_name: integration-test | ||
|
|
||
| - name: Run integration tests | ||
| run: go test -tags=integration -v -timeout=8m ./... | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,2 @@ | ||
| coder-logstream-kube-* | ||
| build | ||
| buildcoder-logstream-kube | ||
kacpersaw marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,87 @@ | ||
| # Colors for output | ||
| GREEN := $(shell printf '\033[32m') | ||
| RESET := $(shell printf '\033[0m') | ||
| BOLD := $(shell printf '\033[1m') | ||
|
|
||
| # Shell source files - use shfmt to find them (respects .editorconfig) | ||
| SHELL_SRC_FILES := $(shell shfmt -f .) | ||
|
|
||
| .PHONY: all | ||
| all: build | ||
|
|
||
| .PHONY: build | ||
| build: | ||
| go build ./... | ||
|
|
||
| .PHONY: test | ||
| test: | ||
| go test ./... -race | ||
|
|
||
| .PHONY: test/integration | ||
| test/integration: | ||
| go test -tags=integration -v -timeout=8m ./... | ||
|
|
||
| .PHONY: lint | ||
| lint: lint/go lint/shellcheck | ||
|
|
||
| .PHONY: lint/go | ||
| lint/go: | ||
| golangci-lint run --timeout=5m | ||
|
|
||
| .PHONY: lint/shellcheck | ||
| lint/shellcheck: $(SHELL_SRC_FILES) | ||
| echo "--- shellcheck" | ||
| shellcheck --external-sources $(SHELL_SRC_FILES) | ||
|
|
||
| .PHONY: fmt | ||
| fmt: fmt/go fmt/shfmt | ||
|
|
||
| .PHONY: fmt/go | ||
| fmt/go: | ||
| go fmt ./... | ||
|
|
||
| .PHONY: fmt/shfmt | ||
| fmt/shfmt: $(SHELL_SRC_FILES) | ||
| ifdef FILE | ||
| # Format single shell script | ||
| if [[ -f "$(FILE)" ]] && [[ "$(FILE)" == *.sh ]]; then \ | ||
| echo "$(GREEN)==>$(RESET) $(BOLD)fmt/shfmt$(RESET) $(FILE)"; \ | ||
| shfmt -w "$(FILE)"; \ | ||
| fi | ||
| else | ||
| echo "$(GREEN)==>$(RESET) $(BOLD)fmt/shfmt$(RESET)" | ||
| # Only do diff check in CI, errors on diff. | ||
| ifdef CI | ||
| shfmt -d $(SHELL_SRC_FILES) | ||
| else | ||
| shfmt -w $(SHELL_SRC_FILES) | ||
| endif | ||
| endif | ||
|
|
||
| .PHONY: clean | ||
| clean: | ||
| rm -f coder-logstream-kube | ||
|
|
||
| .PHONY: kind/create | ||
| kind/create: | ||
| ./scripts/kind-setup.sh create | ||
|
|
||
| .PHONY: kind/delete | ||
| kind/delete: | ||
| ./scripts/kind-setup.sh delete | ||
|
|
||
| .PHONY: help | ||
| help: | ||
| @echo "Available targets:" | ||
| @echo " build - Build the project" | ||
| @echo " test - Run unit tests" | ||
| @echo " test/integration - Run integration tests (requires KinD cluster)" | ||
| @echo " lint - Run all linters" | ||
| @echo " lint/go - Run golangci-lint" | ||
| @echo " lint/shellcheck - Run shellcheck on shell scripts" | ||
| @echo " fmt - Format all code" | ||
| @echo " fmt/go - Format Go code" | ||
| @echo " fmt/shfmt - Format shell scripts" | ||
| @echo " kind/create - Create KinD cluster for integration tests" | ||
| @echo " kind/delete - Delete KinD cluster" | ||
| @echo " clean - Remove build artifacts" |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.