Skip to content

fix(coderd): use stable sorting for insights and improve test coverage #9250

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 33 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
ffc7391
test(coderd): add extended template insights test suite
mafredri Aug 22, 2023
95ad848
add initial golden files
mafredri Aug 22, 2023
d4d58cf
add some more usage and verify golden
mafredri Aug 22, 2023
e4f901a
fixes
mafredri Aug 22, 2023
f333170
add an hour of app usage
mafredri Aug 22, 2023
6fb49a9
add 15 min of app usage -> active user on last day
mafredri Aug 22, 2023
e9a967e
add placeholder data
mafredri Aug 22, 2023
9879462
add identical usage in two templates for one user
mafredri Aug 22, 2023
fc1a98d
test app merging
mafredri Aug 22, 2023
f14ddf6
fix(codersdk): use url values for query params
mafredri Aug 22, 2023
8a60568
improve stability of template id
mafredri Aug 22, 2023
7d93d13
add sao paulo tz test (invalid interval times)
mafredri Aug 22, 2023
f9fdb47
fix start/end time tz returned in interval report
mafredri Aug 22, 2023
54638b0
cleanup
mafredri Aug 22, 2023
7b0ac4c
refactor template creation with stable IDs
mafredri Aug 23, 2023
1e7d860
add parameter test
mafredri Aug 23, 2023
9d96052
refactor
mafredri Aug 23, 2023
930d7ef
add parameter no data test
mafredri Aug 23, 2023
07cdc0b
add 1h usage to other user
mafredri Aug 23, 2023
73367d1
add usage outside of utc timeframe
mafredri Aug 23, 2023
c2a0496
add third user with ssh and web term usage
mafredri Aug 23, 2023
b738799
add third user app usage
mafredri Aug 23, 2023
79bdbf9
add webterminal app usage
mafredri Aug 23, 2023
ce2bb78
use stable sorting in Go and minor query tweaks and fakedb fixes
mafredri Aug 23, 2023
0896439
use github.com/google/go-cmp/cmp for diffs
mafredri Aug 23, 2023
5b4733a
restructure
mafredri Aug 23, 2023
3607a80
more fakedb fixes
mafredri Aug 23, 2023
688e1d0
fix fakedb logic bugs
mafredri Aug 23, 2023
8c294d0
fix commented code
mafredri Aug 23, 2023
decbdfe
fix test bug
mafredri Aug 24, 2023
870aff1
add test for tpl1 param4 option2
mafredri Aug 24, 2023
75a96d7
add outside timeframe tests for apps
mafredri Aug 24, 2023
e72e265
remove previous insights test in favor of new one
mafredri Aug 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add initial golden files
  • Loading branch information
mafredri committed Aug 23, 2023
commit 95ad848bcd500c22ced764afb82255571af2fbd7
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"report": {
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"active_users": 1,
"apps_usage": [
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Visual Studio Code",
"slug": "vscode",
"icon": "/icon/code.svg",
"seconds": 3600
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "JetBrains",
"slug": "jetbrains",
"icon": "/icon/intellij.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Web Terminal",
"slug": "reconnecting-pty",
"icon": "/icon/terminal.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "SSH",
"slug": "ssh",
"icon": "/icon/terminal.svg",
"seconds": 3600
}
],
"parameters_usage": []
},
"interval_reports": [
{
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-16T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"interval": "day",
"active_users": 1
},
{
"start_time": "2023-08-16T00:00:00Z",
"end_time": "2023-08-17T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-17T00:00:00Z",
"end_time": "2023-08-18T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-18T00:00:00Z",
"end_time": "2023-08-19T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-19T00:00:00Z",
"end_time": "2023-08-20T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-20T00:00:00Z",
"end_time": "2023-08-21T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-21T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"report": {
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"active_users": 1,
"apps_usage": [
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Visual Studio Code",
"slug": "vscode",
"icon": "/icon/code.svg",
"seconds": 3600
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "JetBrains",
"slug": "jetbrains",
"icon": "/icon/intellij.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Web Terminal",
"slug": "reconnecting-pty",
"icon": "/icon/terminal.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "SSH",
"slug": "ssh",
"icon": "/icon/terminal.svg",
"seconds": 3600
}
],
"parameters_usage": []
},
"interval_reports": [
{
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-16T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"interval": "day",
"active_users": 1
},
{
"start_time": "2023-08-16T00:00:00Z",
"end_time": "2023-08-17T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-17T00:00:00Z",
"end_time": "2023-08-18T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-18T00:00:00Z",
"end_time": "2023-08-19T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-19T00:00:00Z",
"end_time": "2023-08-20T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-20T00:00:00Z",
"end_time": "2023-08-21T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-21T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"report": {
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"active_users": 1,
"apps_usage": [
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Visual Studio Code",
"slug": "vscode",
"icon": "/icon/code.svg",
"seconds": 3600
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "JetBrains",
"slug": "jetbrains",
"icon": "/icon/intellij.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "Web Terminal",
"slug": "reconnecting-pty",
"icon": "/icon/terminal.svg",
"seconds": 0
},
{
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"type": "builtin",
"display_name": "SSH",
"slug": "ssh",
"icon": "/icon/terminal.svg",
"seconds": 3600
}
],
"parameters_usage": []
},
"interval_reports": [
{
"start_time": "2023-08-15T00:00:00Z",
"end_time": "2023-08-16T00:00:00Z",
"template_ids": [
"00000000-0000-0000-0000-000000000001"
],
"interval": "day",
"active_users": 1
},
{
"start_time": "2023-08-16T00:00:00Z",
"end_time": "2023-08-17T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-17T00:00:00Z",
"end_time": "2023-08-18T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-18T00:00:00Z",
"end_time": "2023-08-19T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-19T00:00:00Z",
"end_time": "2023-08-20T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-20T00:00:00Z",
"end_time": "2023-08-21T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
},
{
"start_time": "2023-08-21T00:00:00Z",
"end_time": "2023-08-22T00:00:00Z",
"template_ids": [],
"interval": "day",
"active_users": 0
}
]
}
Loading