Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2eb4bd7

Browse files
committed
test(coderd): fix todo for increased accuracy in insights test
1 parent 878d0b3 commit 2eb4bd7

4 files changed

+15
-21
lines changed

coderd/insights_test.go

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

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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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)