mirror of
https://github.com/coder/coder.git
synced 2026-10-31 19:36:41 +08:00
Phase 1 of the Scalable Approach for Adding New IDE Session Types RFC, tracked in #27410. Gives agent session accounting one canonical vocabulary for app names, so later work can report a count per app without the agent and the server disagreeing about what an app is called. - Adds codersdk/appname.go: NormalizeAppName for storage and lookup, and AppFamilyName for the places that need a bounded value, such as a Prometheus label or the Connection_Type enum. - agentssh.Server keeps session counters in a map keyed by normalized name instead of three fixed atomics, dropping entries at zero. - Drops MagicSessionType. Sessions carry plain app names, and unrecognized ones flow through as themselves rather than collapsing to unknown. Wire behavior is unchanged: the agent still reports the four session_count_* fields over Agent API 2.10.
17 lines
369 B
Go
17 lines
369 B
Go
package codersdk
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
// Lookups fold input through NormalizeAppName before probing, so map keys
|
|
// that are not already normalized can never match.
|
|
func TestAppNameFamilyKeysAreNormalized(t *testing.T) {
|
|
t.Parallel()
|
|
for name := range appNameFamilies {
|
|
require.Equal(t, NormalizeAppName(name), name)
|
|
}
|
|
}
|