test(coderd): fix todo for increased accuracy in insights test (#12727)

This PR updates the tests in `insights_test.go` to enable commented-out scenarios. This behavior was fixed by previous PRs in this stack. Note that the updated golden files are correct since they are "second template only" meaning that the newly introduced data is considered as expected. In other golden files there is no change since "only count once" is applied.
This commit is contained in:
Mathias Fredriksson 2024-03-25 17:55:53 +02:00 committed by GitHub
parent b183236482
commit 7e183db199
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 15 additions and 21 deletions

View File

@ -956,15 +956,12 @@ func TestTemplateInsights_Golden(t *testing.T) {
},
},
appUsage: []appUsage{
// TODO(mafredri): This doesn't behave correctly right now
// and will add more usage to the app. This could be
// considered both correct and incorrect behavior.
// { // One hour of usage, but same user and same template app, only count once.
// app: users[0].workspaces[1].apps[0],
// startedAt: frozenWeekAgo,
// endedAt: frozenWeekAgo.Add(time.Hour),
// requests: 1,
// },
{ // One hour of usage, but same user and same template app, only count once.
app: users[0].workspaces[1].apps[0],
startedAt: frozenWeekAgo,
endedAt: frozenWeekAgo.Add(time.Hour),
requests: 1,
},
{
// Different templates but identical apps, apps will be
// combined and usage will be summed.
@ -1811,15 +1808,12 @@ func TestUserActivityInsights_Golden(t *testing.T) {
},
},
appUsage: []appUsage{
// TODO(mafredri): This doesn't behave correctly right now
// and will add more usage to the app. This could be
// considered both correct and incorrect behavior.
// { // One hour of usage, but same user and same template app, only count once.
// app: users[0].workspaces[1].apps[0],
// startedAt: frozenWeekAgo,
// endedAt: frozenWeekAgo.Add(time.Hour),
// requests: 1,
// },
{ // One hour of usage, but same user and same template app, only count once.
app: users[0].workspaces[1].apps[0],
startedAt: frozenWeekAgo,
endedAt: frozenWeekAgo.Add(time.Hour),
requests: 1,
},
{
// Different templates but identical apps, apps will be
// combined and usage will be summed.

View File

@ -53,7 +53,7 @@
"display_name": "app1",
"slug": "app1",
"icon": "/icon1.png",
"seconds": 21600
"seconds": 25200
}
],
"parameters_usage": []

View File

@ -53,7 +53,7 @@
"display_name": "app1",
"slug": "app1",
"icon": "/icon1.png",
"seconds": 21600
"seconds": 25200
}
],
"parameters_usage": []

View File

@ -51,7 +51,7 @@
"display_name": "app1",
"slug": "app1",
"icon": "/icon1.png",
"seconds": 21600
"seconds": 25200
}
],
"parameters_usage": []