mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: move stat reporting into workspacestats package (#13386)
This commit is contained in:
@@ -939,32 +939,6 @@ func TestWorkspaceAgentReportStats(t *testing.T) {
|
||||
agentClient.SetSessionToken(r.AgentToken)
|
||||
|
||||
_, err := agentClient.PostStats(context.Background(), &agentsdk.Stats{
|
||||
ConnectionsByProto: map[string]int64{"TCP": 1},
|
||||
// Set connection count to 1 but all session counts to zero to
|
||||
// assert we aren't updating last_used_at for a connections that may
|
||||
// be spawned passively by the dashboard.
|
||||
ConnectionCount: 1,
|
||||
RxPackets: 1,
|
||||
RxBytes: 1,
|
||||
TxPackets: 1,
|
||||
TxBytes: 1,
|
||||
SessionCountVSCode: 0,
|
||||
SessionCountJetBrains: 0,
|
||||
SessionCountReconnectingPTY: 0,
|
||||
SessionCountSSH: 0,
|
||||
ConnectionMedianLatencyMS: 10,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
newWorkspace, err := client.Workspace(context.Background(), r.Workspace.ID)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t,
|
||||
newWorkspace.LastUsedAt.Equal(r.Workspace.LastUsedAt),
|
||||
"%s and %s should not differ", newWorkspace.LastUsedAt, r.Workspace.LastUsedAt,
|
||||
)
|
||||
|
||||
_, err = agentClient.PostStats(context.Background(), &agentsdk.Stats{
|
||||
ConnectionsByProto: map[string]int64{"TCP": 1},
|
||||
ConnectionCount: 1,
|
||||
RxPackets: 1,
|
||||
@@ -979,7 +953,7 @@ func TestWorkspaceAgentReportStats(t *testing.T) {
|
||||
})
|
||||
require.NoError(t, err)
|
||||
|
||||
newWorkspace, err = client.Workspace(context.Background(), r.Workspace.ID)
|
||||
newWorkspace, err := client.Workspace(context.Background(), r.Workspace.ID)
|
||||
require.NoError(t, err)
|
||||
|
||||
assert.True(t,
|
||||
|
||||
Reference in New Issue
Block a user