Skip to content

Commit 138046b

Browse files
committed
test(coderd): fix todo for increased accuracy in insights test
1 parent 7e9a5c9 commit 138046b

4 files changed

+15
-21
lines changed

coderd/insights_test.go

+12-18
Original file line numberDiff line numberDiff line change
@@ -956,15 +956,12 @@ func TestTemplateInsights_Golden(t *testing.T) {
956956
},
957957
},
958958
appUsage: []appUsage{
959-
// TODO(mafredri): This doesn't behave correctly right now
960-
// and will add more usage to the app. This could be
961-
// considered both correct and incorrect behavior.
962-
// { // One hour of usage, but same user and same template app, only count once.
963-
// app: users[0].workspaces[1].apps[0],
964-
// startedAt: frozenWeekAgo,
965-
// endedAt: frozenWeekAgo.Add(time.Hour),
966-
// requests: 1,
967-
// },
959+
{ // One hour of usage, but same user and same template app, only count once.
960+
app: users[0].workspaces[1].apps[0],
961+
startedAt: frozenWeekAgo,
962+
endedAt: frozenWeekAgo.Add(time.Hour),
963+
requests: 1,
964+
},
968965
{
969966
// Different templates but identical apps, apps will be
970967
// combined and usage will be summed.
@@ -1811,15 +1808,12 @@ func TestUserActivityInsights_Golden(t *testing.T) {
18111808
},
18121809
},
18131810
appUsage: []appUsage{
1814-
// TODO(mafredri): This doesn't behave correctly right now
1815-
// and will add more usage to the app. This could be
1816-
// considered both correct and incorrect behavior.
1817-
// { // One hour of usage, but same user and same template app, only count once.
1818-
// app: users[0].workspaces[1].apps[0],
1819-
// startedAt: frozenWeekAgo,
1820-
// endedAt: frozenWeekAgo.Add(time.Hour),
1821-
// requests: 1,
1822-
// },
1811+
{ // One hour of usage, but same user and same template app, only count once.
1812+
app: users[0].workspaces[1].apps[0],
1813+
startedAt: frozenWeekAgo,
1814+
endedAt: frozenWeekAgo.Add(time.Hour),
1815+
requests: 1,
1816+
},
18231817
{
18241818
// Different templates but identical apps, apps will be
18251819
// combined and usage will be summed.

coderd/testdata/insights/template/multiple_users_and_workspaces_three_weeks_second_template.json.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"display_name": "app1",
5454
"slug": "app1",
5555
"icon": "/icon1.png",
56-
"seconds": 21600
56+
"seconds": 25200
5757
}
5858
],
5959
"parameters_usage": []

coderd/testdata/insights/template/multiple_users_and_workspaces_three_weeks_second_template_only_report.json.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"display_name": "app1",
5454
"slug": "app1",
5555
"icon": "/icon1.png",
56-
"seconds": 21600
56+
"seconds": 25200
5757
}
5858
],
5959
"parameters_usage": []

coderd/testdata/insights/template/multiple_users_and_workspaces_week_second_template.json.golden

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"display_name": "app1",
5252
"slug": "app1",
5353
"icon": "/icon1.png",
54-
"seconds": 21600
54+
"seconds": 25200
5555
}
5656
],
5757
"parameters_usage": []

0 commit comments

Comments
 (0)