(t *testing.T)
| 382 | } |
| 383 | |
| 384 | func TestTemplateInsights_Golden(t *testing.T) { |
| 385 | t.Parallel() |
| 386 | |
| 387 | // Prepare test data types. |
| 388 | type templateParameterOption struct { |
| 389 | name string |
| 390 | value string |
| 391 | } |
| 392 | type templateParameter struct { |
| 393 | name string |
| 394 | description string |
| 395 | options []templateParameterOption |
| 396 | } |
| 397 | type templateApp struct { |
| 398 | name string |
| 399 | icon string |
| 400 | } |
| 401 | type testTemplate struct { |
| 402 | name string |
| 403 | parameters []*templateParameter |
| 404 | apps []templateApp |
| 405 | |
| 406 | // Filled later. |
| 407 | id uuid.UUID |
| 408 | } |
| 409 | type buildParameter struct { |
| 410 | templateParameter *templateParameter |
| 411 | value string |
| 412 | } |
| 413 | type workspaceApp templateApp |
| 414 | type testWorkspace struct { |
| 415 | name string |
| 416 | template *testTemplate |
| 417 | buildParameters []buildParameter |
| 418 | |
| 419 | // Filled later. |
| 420 | id uuid.UUID |
| 421 | user any // *testUser, but it's not available yet, defined below. |
| 422 | agentID uuid.UUID |
| 423 | apps []*workspaceApp |
| 424 | agentClient *agentsdk.Client |
| 425 | } |
| 426 | type testUser struct { |
| 427 | name string |
| 428 | workspaces []*testWorkspace |
| 429 | |
| 430 | client *codersdk.Client |
| 431 | sdk codersdk.User |
| 432 | } |
| 433 | |
| 434 | // Represent agent stats, to be inserted via stats batcher. |
| 435 | type agentStat struct { |
| 436 | // Set a range via start/end, multiple stats will be generated |
| 437 | // within the range. |
| 438 | startedAt time.Time |
| 439 | endedAt time.Time |
| 440 | |
| 441 | sessionCountVSCode int64 |
nothing calls this directly
no test coverage detected