@@ -78,11 +78,11 @@ func TestCollectInsights(t *testing.T) {
78
78
{WorkspaceBuildID : build1 .ID , Name : param2 .Name , Value : "true" },
79
79
{WorkspaceBuildID : build1 .ID , Name : param3 .Name , Value : "789" },
80
80
})
81
- // _ = dbgen.WorkspaceBuildParameters(t, db, []database.WorkspaceBuildParameter{
82
- // {WorkspaceBuildID: build2.ID, Name: param1.Name, Value: "Baz"},
83
- // {WorkspaceBuildID: build2.ID, Name: param2.Name, Value: "false "},
84
- // {WorkspaceBuildID: build2.ID, Name: param3.Name, Value: "999"},
85
- // })
81
+ _ = dbgen .WorkspaceBuildParameters (t , db , []database.WorkspaceBuildParameter {
82
+ {WorkspaceBuildID : build2 .ID , Name : param1 .Name , Value : "Baz" },
83
+ {WorkspaceBuildID : build2 .ID , Name : param2 .Name , Value : "true " },
84
+ {WorkspaceBuildID : build2 .ID , Name : param3 .Name , Value : "999" },
85
+ })
86
86
)
87
87
88
88
// Start an agent so that we can generate stats.
@@ -96,13 +96,13 @@ func TestCollectInsights(t *testing.T) {
96
96
97
97
// Fake app stats
98
98
_ , err = agentClients [0 ].PostStats (context .Background (), & agentsdk.Stats {
99
- // ConnectionsByProto can't be nil, otherwise stats get rejected
100
- ConnectionsByProto : map [string ]int64 {"TCP" : 1 },
101
99
// ConnectionCount must be positive as database query ignores stats with no active connections at the time frame
102
- ConnectionCount : 1 ,
103
- SessionCountSSH : 99 ,
104
- // SessionCountJetBrains, SessionCountVSCode must be positive, but the exact value is ignored.
100
+ ConnectionsByProto : map [string ]int64 {"TCP" : 1 },
101
+ ConnectionCount : 1 ,
102
+ ConnectionMedianLatencyMS : 15 ,
103
+ // Session counts must be positive, but the exact value is ignored.
105
104
// Database query approximates it to 60s of usage.
105
+ SessionCountSSH : 99 ,
106
106
SessionCountJetBrains : 47 ,
107
107
SessionCountVSCode : 34 ,
108
108
})
@@ -137,17 +137,17 @@ func TestCollectInsights(t *testing.T) {
137
137
SessionEndedAt : refTime .Add (2 * time .Minute ).Add (- time .Second ),
138
138
Requests : 1 ,
139
139
},
140
- // {
141
- // UserID: user.ID,
142
- // WorkspaceID: workspace2.ID,
143
- // AgentID: agent2.ID,
144
- // AccessMethod: "path",
145
- // SlugOrPort: app2.Slug,
146
- // SessionID: uuid.New(),
147
- // SessionStartedAt: time.Now(). Add(- time.Minute),
148
- // SessionEndedAt: time.Now(). Add(- time.Minute).Add(30 * time.Second),
149
- // Requests: 1,
150
- // },
140
+ {
141
+ UserID : user .ID ,
142
+ WorkspaceID : workspace2 .ID ,
143
+ AgentID : agent2 .ID ,
144
+ AccessMethod : "path" ,
145
+ SlugOrPort : app2 .Slug ,
146
+ SessionID : uuid .New (),
147
+ SessionStartedAt : refTime . Add (2 * time .Minute ),
148
+ SessionEndedAt : refTime . Add (2 * time .Minute ).Add (30 * time .Second ),
149
+ Requests : 1 ,
150
+ },
151
151
})
152
152
require .NoError (t , err , "want no error inserting app stats" )
153
153
0 commit comments