Files
coder/support/version_test.go
T
Rowan Smith b163b4c950 feat: support bundle updates to enable pprof and telemetry collection (#21486)
- Adds pprof collection support now that we have the listeners
automatically starting (requires Coder server 2.28.0+, includes a
version check). Collects heap, allocs, profile (30s), block, mutex,
goroutine, threadcreate, trace (30s), cmdline, symbol. Performs capture
for 30 seconds and emits a log line stating as such. Enable capture by
supplying the `--pprof` flag or `CODER_SUPPORT_BUNDLE_PPROF` env var.
Collection of pprof data from both coderd and the Coder agent occurs.
- Adds collection of Prometheus metrics, also requires 2.28.0+
- Adds the ability to include a template in the bundle independently of
supplying the details of a running workspace by supplying the
`--template` flag or `CODER_SUPPORT_BUNDLE_TEMPLATE` env var
- Captures a list of workspaces the user has access to. Defaults to a
max of 10, configurable via `--workspaces-total-cap` /
`CODER_SUPPORT_BUNDLE_WORKSPACES_TOTAL_CAP`
- Collects additional stats from the coderd deployment (aggregated
workspace/session metrics), as well as entitlements via license and
dismissed health checks.

created with help from mux
2026-01-20 10:28:52 +11:00

37 lines
792 B
Go

package support_test
import (
"testing"
"github.com/coder/coder/v2/support"
)
func TestVersionSupportsPprof(t *testing.T) {
t.Parallel()
tests := []struct {
version string
want bool
}{
{"", false},
{"v2.27.0", false},
{"v2.27.9", false},
{"v2.28.0", true},
{"v2.28.1", true},
{"v2.29.0", true},
{"v3.0.0", true},
{"2.28.0", true}, // without v prefix
{"2.27.0", false}, // without v prefix
{"v2.28.0-devel+abc123", true}, // dev version
{"v2.27.0-devel+abc123", false},
}
for _, tt := range tests {
t.Run(tt.version, func(t *testing.T) {
t.Parallel()
got := support.VersionSupportsPprof(tt.version)
if got != tt.want {
t.Errorf("versionSupportsPprof(%q) = %v, want %v", tt.version, got, tt.want)
}
})
}
}