mirror of
https://github.com/kubeshark/kubeshark.git
synced 2026-08-19 04:16:35 +00:00
golangci-lint-action@v3 pins `latest` to v1.64.8, which is built with go1.24 and refuses to run now that go.mod targets 1.25.0: can't load config: the Go language version (go1.24) used to build golangci-lint is lower than the targeted Go version (1.25.0) Move the job to golangci-lint-action@v7 + v2.8.0 and add a .golangci.yml mirroring the hub repo's v2 config: govet, staticcheck, ineffassign and unused, plus gofmt/goimports as formatters. Fixes for the issues that surfaced: - ST1005: lowercase error strings, drop trailing '!' in connect/hub.go - SA4011: kubernetes/watch.go had a `break` inside a `select` default that broke the select rather than the loop, i.e. a no-op; removed - QF1008: drop the embedded ChartPathOptions selector in helm.go - QF1003: tagged switch on r.URL.Path in mcp_test.go - QF1004: strings.Replace(..., -1) -> strings.ReplaceAll - gofmt -s and goimports with a local prefix across the tree errcheck is not in the enabled set, matching hub.
Integration Tests
This directory contains integration tests that run against a real Kubernetes cluster.
Prerequisites
- Kubernetes cluster - A running cluster accessible via
kubectl - kubectl - Configured with appropriate context
- Go 1.21+ - For running tests
Running Tests
# Run all integration tests
make test-integration
# Run specific command tests
make test-integration-mcp
# Run with verbose output
make test-integration-verbose
# Run with custom timeout (default: 5m)
INTEGRATION_TIMEOUT=10m make test-integration
Environment Variables
| Variable | Default | Description |
|---|---|---|
KUBESHARK_BINARY |
Auto-built | Path to pre-built kubeshark binary |
INTEGRATION_TIMEOUT |
5m |
Test timeout duration |
KUBECONFIG |
~/.kube/config |
Kubernetes config file |
INTEGRATION_SKIP_CLEANUP |
false |
Skip cleanup after tests (for debugging) |
Test Structure
integration/
├── README.md # This file
├── common_test.go # Shared test helpers
├── mcp_test.go # MCP command integration tests
├── tap_test.go # Tap command tests (future)
└── ... # Additional command tests
Writing New Tests
- Create
<command>_test.gowith build tag//go:build integration - Use helpers from
common_test.go:requireKubernetesCluster(t),getKubesharkBinary(t),cleanupKubeshark(t, binary)
CI/CD Integration
# JSON output for CI parsing
go test -tags=integration -json ./integration/...