Skip to content

Commit 935ef10

Browse files
committed
add some more usage and verify golden
1 parent f306099 commit 935ef10

4 files changed

+41
-19
lines changed

coderd/insights_test.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1026,12 +1026,22 @@ func TestTemplateInsights_Golden(t *testing.T) {
10261026
return map[*testWorkspace]testDataGen{
10271027
users[0].workspaces[0]: {
10281028
agentStats: []agentStat{
1029-
{
1029+
{ // One hour of usage.
10301030
startedAt: weekAgo,
10311031
endedAt: weekAgo.Add(time.Hour),
10321032
sessionCountVSCode: 1,
10331033
sessionCountSSH: 1,
10341034
},
1035+
{ // 12 minutes of usage -> 15 minutes.
1036+
startedAt: weekAgo.AddDate(0, 0, 1),
1037+
endedAt: weekAgo.AddDate(0, 0, 1).Add(12 * time.Minute),
1038+
sessionCountSSH: 1,
1039+
},
1040+
{ // 2 minutes of usage -> 10 minutes because it crosses the 5 minute interval boundary.
1041+
startedAt: weekAgo.AddDate(0, 0, 2).Add(4 * time.Minute),
1042+
endedAt: weekAgo.AddDate(0, 0, 2).Add(6 * time.Minute),
1043+
sessionCountJetBrains: 1,
1044+
},
10351045
},
10361046
appUsage: []appUsage{
10371047
{

coderd/testdata/insights/multiple_users_and_workspaces_week_all_templates.json.golden

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"display_name": "JetBrains",
2626
"slug": "jetbrains",
2727
"icon": "/icon/intellij.svg",
28-
"seconds": 0
28+
"seconds": 600
2929
},
3030
{
3131
"template_ids": [
@@ -45,7 +45,7 @@
4545
"display_name": "SSH",
4646
"slug": "ssh",
4747
"icon": "/icon/terminal.svg",
48-
"seconds": 3600
48+
"seconds": 4500
4949
}
5050
],
5151
"parameters_usage": []
@@ -63,16 +63,20 @@
6363
{
6464
"start_time": "2023-08-16T00:00:00Z",
6565
"end_time": "2023-08-17T00:00:00Z",
66-
"template_ids": [],
66+
"template_ids": [
67+
"00000000-0000-0000-0000-000000000001"
68+
],
6769
"interval": "day",
68-
"active_users": 0
70+
"active_users": 1
6971
},
7072
{
7173
"start_time": "2023-08-17T00:00:00Z",
7274
"end_time": "2023-08-18T00:00:00Z",
73-
"template_ids": [],
75+
"template_ids": [
76+
"00000000-0000-0000-0000-000000000001"
77+
],
7478
"interval": "day",
75-
"active_users": 0
79+
"active_users": 1
7680
},
7781
{
7882
"start_time": "2023-08-18T00:00:00Z",

coderd/testdata/insights/multiple_users_and_workspaces_week_deployment_wide.json.golden

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"display_name": "JetBrains",
2626
"slug": "jetbrains",
2727
"icon": "/icon/intellij.svg",
28-
"seconds": 0
28+
"seconds": 600
2929
},
3030
{
3131
"template_ids": [
@@ -45,7 +45,7 @@
4545
"display_name": "SSH",
4646
"slug": "ssh",
4747
"icon": "/icon/terminal.svg",
48-
"seconds": 3600
48+
"seconds": 4500
4949
}
5050
],
5151
"parameters_usage": []
@@ -63,16 +63,20 @@
6363
{
6464
"start_time": "2023-08-16T00:00:00Z",
6565
"end_time": "2023-08-17T00:00:00Z",
66-
"template_ids": [],
66+
"template_ids": [
67+
"00000000-0000-0000-0000-000000000001"
68+
],
6769
"interval": "day",
68-
"active_users": 0
70+
"active_users": 1
6971
},
7072
{
7173
"start_time": "2023-08-17T00:00:00Z",
7274
"end_time": "2023-08-18T00:00:00Z",
73-
"template_ids": [],
75+
"template_ids": [
76+
"00000000-0000-0000-0000-000000000001"
77+
],
7478
"interval": "day",
75-
"active_users": 0
79+
"active_users": 1
7680
},
7781
{
7882
"start_time": "2023-08-18T00:00:00Z",

coderd/testdata/insights/multiple_users_and_workspaces_week_first_template.json.golden

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"display_name": "JetBrains",
2626
"slug": "jetbrains",
2727
"icon": "/icon/intellij.svg",
28-
"seconds": 0
28+
"seconds": 600
2929
},
3030
{
3131
"template_ids": [
@@ -45,7 +45,7 @@
4545
"display_name": "SSH",
4646
"slug": "ssh",
4747
"icon": "/icon/terminal.svg",
48-
"seconds": 3600
48+
"seconds": 4500
4949
}
5050
],
5151
"parameters_usage": []
@@ -63,16 +63,20 @@
6363
{
6464
"start_time": "2023-08-16T00:00:00Z",
6565
"end_time": "2023-08-17T00:00:00Z",
66-
"template_ids": [],
66+
"template_ids": [
67+
"00000000-0000-0000-0000-000000000001"
68+
],
6769
"interval": "day",
68-
"active_users": 0
70+
"active_users": 1
6971
},
7072
{
7173
"start_time": "2023-08-17T00:00:00Z",
7274
"end_time": "2023-08-18T00:00:00Z",
73-
"template_ids": [],
75+
"template_ids": [
76+
"00000000-0000-0000-0000-000000000001"
77+
],
7478
"interval": "day",
75-
"active_users": 0
79+
"active_users": 1
7680
},
7781
{
7882
"start_time": "2023-08-18T00:00:00Z",

0 commit comments

Comments
 (0)