Skip to content

Commit 01afb9b

Browse files
committed
golden files
1 parent 16ec5ad commit 01afb9b

5 files changed

+429
-0
lines changed

coderd/insights_test.go

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,16 @@ func TestTemplateInsights_Golden(t *testing.T) {
922922
}
923923
},
924924
},
925+
{
926+
name: "weekly aggregated deployment wide",
927+
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
928+
return codersdk.TemplateInsightsRequest{
929+
StartTime: frozenWeekAgo.AddDate(0, 0, -3),
930+
EndTime: frozenWeekAgo.AddDate(0, 0, 4),
931+
Interval: codersdk.InsightsReportIntervalWeek,
932+
}
933+
},
934+
},
925935
{
926936
name: "week all templates",
927937
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
@@ -933,6 +943,17 @@ func TestTemplateInsights_Golden(t *testing.T) {
933943
}
934944
},
935945
},
946+
{
947+
name: "weekly aggregated templates",
948+
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
949+
return codersdk.TemplateInsightsRequest{
950+
TemplateIDs: []uuid.UUID{templates[0].id, templates[1].id, templates[2].id},
951+
StartTime: frozenWeekAgo.AddDate(0, 0, -1),
952+
EndTime: frozenWeekAgo.AddDate(0, 0, 6),
953+
Interval: codersdk.InsightsReportIntervalWeek,
954+
}
955+
},
956+
},
936957
{
937958
name: "week first template",
938959
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
@@ -944,6 +965,17 @@ func TestTemplateInsights_Golden(t *testing.T) {
944965
}
945966
},
946967
},
968+
{
969+
name: "weekly aggregated first template",
970+
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
971+
return codersdk.TemplateInsightsRequest{
972+
TemplateIDs: []uuid.UUID{templates[0].id},
973+
StartTime: frozenWeekAgo,
974+
EndTime: frozenWeekAgo.AddDate(0, 0, 7),
975+
Interval: codersdk.InsightsReportIntervalWeek,
976+
}
977+
},
978+
},
947979
{
948980
name: "week second template",
949981
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
@@ -955,6 +987,17 @@ func TestTemplateInsights_Golden(t *testing.T) {
955987
}
956988
},
957989
},
990+
{
991+
name: "three weeks second template",
992+
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
993+
return codersdk.TemplateInsightsRequest{
994+
TemplateIDs: []uuid.UUID{templates[1].id},
995+
StartTime: frozenWeekAgo.AddDate(0, 0, -14),
996+
EndTime: frozenWeekAgo.AddDate(0, 0, 7),
997+
Interval: codersdk.InsightsReportIntervalWeek,
998+
}
999+
},
1000+
},
9581001
{
9591002
name: "week third template",
9601003
makeRequest: func(templates []*testTemplate) codersdk.TemplateInsightsRequest {
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
{
2+
"report": {
3+
"start_time": "2023-08-01T00:00:00Z",
4+
"end_time": "2023-08-22T00:00:00Z",
5+
"template_ids": [
6+
"00000000-0000-0000-0000-000000000002"
7+
],
8+
"active_users": 1,
9+
"apps_usage": [
10+
{
11+
"template_ids": [
12+
"00000000-0000-0000-0000-000000000002"
13+
],
14+
"type": "builtin",
15+
"display_name": "Visual Studio Code",
16+
"slug": "vscode",
17+
"icon": "/icon/code.svg",
18+
"seconds": 3600
19+
},
20+
{
21+
"template_ids": [
22+
"00000000-0000-0000-0000-000000000002"
23+
],
24+
"type": "builtin",
25+
"display_name": "JetBrains",
26+
"slug": "jetbrains",
27+
"icon": "/icon/intellij.svg",
28+
"seconds": 0
29+
},
30+
{
31+
"template_ids": [
32+
"00000000-0000-0000-0000-000000000002"
33+
],
34+
"type": "builtin",
35+
"display_name": "Web Terminal",
36+
"slug": "reconnecting-pty",
37+
"icon": "/icon/terminal.svg",
38+
"seconds": 0
39+
},
40+
{
41+
"template_ids": [
42+
"00000000-0000-0000-0000-000000000002"
43+
],
44+
"type": "builtin",
45+
"display_name": "SSH",
46+
"slug": "ssh",
47+
"icon": "/icon/terminal.svg",
48+
"seconds": 3600
49+
},
50+
{
51+
"template_ids": [
52+
"00000000-0000-0000-0000-000000000002"
53+
],
54+
"type": "app",
55+
"display_name": "app1",
56+
"slug": "app1",
57+
"icon": "/icon1.png",
58+
"seconds": 21600
59+
}
60+
],
61+
"parameters_usage": []
62+
},
63+
"interval_reports": [
64+
{
65+
"start_time": "2023-08-01T00:00:00Z",
66+
"end_time": "2023-08-08T00:00:00Z",
67+
"template_ids": [],
68+
"interval": "week",
69+
"active_users": 0
70+
},
71+
{
72+
"start_time": "2023-08-08T00:00:00Z",
73+
"end_time": "2023-08-15T00:00:00Z",
74+
"template_ids": [],
75+
"interval": "week",
76+
"active_users": 0
77+
},
78+
{
79+
"start_time": "2023-08-15T00:00:00Z",
80+
"end_time": "2023-08-22T00:00:00Z",
81+
"template_ids": [
82+
"00000000-0000-0000-0000-000000000002"
83+
],
84+
"interval": "week",
85+
"active_users": 1
86+
}
87+
]
88+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
{
2+
"report": {
3+
"start_time": "2023-08-12T00:00:00Z",
4+
"end_time": "2023-08-19T00:00:00Z",
5+
"template_ids": [
6+
"00000000-0000-0000-0000-000000000001",
7+
"00000000-0000-0000-0000-000000000002",
8+
"00000000-0000-0000-0000-000000000003"
9+
],
10+
"active_users": 3,
11+
"apps_usage": [
12+
{
13+
"template_ids": [
14+
"00000000-0000-0000-0000-000000000001",
15+
"00000000-0000-0000-0000-000000000002",
16+
"00000000-0000-0000-0000-000000000003"
17+
],
18+
"type": "builtin",
19+
"display_name": "Visual Studio Code",
20+
"slug": "vscode",
21+
"icon": "/icon/code.svg",
22+
"seconds": 7200
23+
},
24+
{
25+
"template_ids": [
26+
"00000000-0000-0000-0000-000000000001",
27+
"00000000-0000-0000-0000-000000000002",
28+
"00000000-0000-0000-0000-000000000003"
29+
],
30+
"type": "builtin",
31+
"display_name": "JetBrains",
32+
"slug": "jetbrains",
33+
"icon": "/icon/intellij.svg",
34+
"seconds": 120
35+
},
36+
{
37+
"template_ids": [
38+
"00000000-0000-0000-0000-000000000001",
39+
"00000000-0000-0000-0000-000000000002",
40+
"00000000-0000-0000-0000-000000000003"
41+
],
42+
"type": "builtin",
43+
"display_name": "Web Terminal",
44+
"slug": "reconnecting-pty",
45+
"icon": "/icon/terminal.svg",
46+
"seconds": 3600
47+
},
48+
{
49+
"template_ids": [
50+
"00000000-0000-0000-0000-000000000001",
51+
"00000000-0000-0000-0000-000000000002",
52+
"00000000-0000-0000-0000-000000000003"
53+
],
54+
"type": "builtin",
55+
"display_name": "SSH",
56+
"slug": "ssh",
57+
"icon": "/icon/terminal.svg",
58+
"seconds": 15120
59+
},
60+
{
61+
"template_ids": [
62+
"00000000-0000-0000-0000-000000000001",
63+
"00000000-0000-0000-0000-000000000002"
64+
],
65+
"type": "app",
66+
"display_name": "app1",
67+
"slug": "app1",
68+
"icon": "/icon1.png",
69+
"seconds": 25380
70+
},
71+
{
72+
"template_ids": [
73+
"00000000-0000-0000-0000-000000000001"
74+
],
75+
"type": "app",
76+
"display_name": "app3",
77+
"slug": "app3",
78+
"icon": "/icon2.png",
79+
"seconds": 3600
80+
},
81+
{
82+
"template_ids": [
83+
"00000000-0000-0000-0000-000000000003"
84+
],
85+
"type": "app",
86+
"display_name": "otherapp1",
87+
"slug": "otherapp1",
88+
"icon": "/icon1.png",
89+
"seconds": 300
90+
}
91+
],
92+
"parameters_usage": []
93+
},
94+
"interval_reports": [
95+
{
96+
"start_time": "2023-08-12T00:00:00Z",
97+
"end_time": "2023-08-19T00:00:00Z",
98+
"template_ids": [
99+
"00000000-0000-0000-0000-000000000001",
100+
"00000000-0000-0000-0000-000000000002",
101+
"00000000-0000-0000-0000-000000000003"
102+
],
103+
"interval": "week",
104+
"active_users": 3
105+
}
106+
]
107+
}
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
2+
"report": {
3+
"start_time": "2023-08-15T00:00:00Z",
4+
"end_time": "2023-08-22T00:00:00Z",
5+
"template_ids": [
6+
"00000000-0000-0000-0000-000000000001"
7+
],
8+
"active_users": 2,
9+
"apps_usage": [
10+
{
11+
"template_ids": [
12+
"00000000-0000-0000-0000-000000000001"
13+
],
14+
"type": "builtin",
15+
"display_name": "Visual Studio Code",
16+
"slug": "vscode",
17+
"icon": "/icon/code.svg",
18+
"seconds": 3600
19+
},
20+
{
21+
"template_ids": [
22+
"00000000-0000-0000-0000-000000000001"
23+
],
24+
"type": "builtin",
25+
"display_name": "JetBrains",
26+
"slug": "jetbrains",
27+
"icon": "/icon/intellij.svg",
28+
"seconds": 120
29+
},
30+
{
31+
"template_ids": [
32+
"00000000-0000-0000-0000-000000000001"
33+
],
34+
"type": "builtin",
35+
"display_name": "Web Terminal",
36+
"slug": "reconnecting-pty",
37+
"icon": "/icon/terminal.svg",
38+
"seconds": 0
39+
},
40+
{
41+
"template_ids": [
42+
"00000000-0000-0000-0000-000000000001"
43+
],
44+
"type": "builtin",
45+
"display_name": "SSH",
46+
"slug": "ssh",
47+
"icon": "/icon/terminal.svg",
48+
"seconds": 7920
49+
},
50+
{
51+
"template_ids": [
52+
"00000000-0000-0000-0000-000000000001"
53+
],
54+
"type": "app",
55+
"display_name": "app1",
56+
"slug": "app1",
57+
"icon": "/icon1.png",
58+
"seconds": 3780
59+
},
60+
{
61+
"template_ids": [
62+
"00000000-0000-0000-0000-000000000001"
63+
],
64+
"type": "app",
65+
"display_name": "app3",
66+
"slug": "app3",
67+
"icon": "/icon2.png",
68+
"seconds": 720
69+
}
70+
],
71+
"parameters_usage": []
72+
},
73+
"interval_reports": [
74+
{
75+
"start_time": "2023-08-15T00:00:00Z",
76+
"end_time": "2023-08-22T00:00:00Z",
77+
"template_ids": [
78+
"00000000-0000-0000-0000-000000000001"
79+
],
80+
"interval": "week",
81+
"active_users": 2
82+
}
83+
]
84+
}

0 commit comments

Comments
 (0)