@@ -299,10 +299,8 @@ func TestInstanceToUsageRecords(t *testing.T) {
299
299
workspaceID := dbtest .GenerateWorkspaceID ()
300
300
teamAttributionID := db .NewTeamAttributionID (teamID )
301
301
instanceId := uuid .New ()
302
- creationTime := db .NewVarcharTime (time .Date (2022 , 05 , 30 , 00 , 00 , 00 , 00 , time .UTC ))
303
302
startedTime := db .NewVarcharTime (time .Date (2022 , 05 , 30 , 00 , 01 , 00 , 00 , time .UTC ))
304
303
stoppingTime := db .NewVarcharTime (time .Date (2022 , 06 , 1 , 1 , 0 , 0 , 0 , time .UTC ))
305
- stoppedTime := db .NewVarcharTime (time .Date (2022 , 06 , 1 , 1 , 1 , 0 , 0 , time .UTC ))
306
304
307
305
scenarios := []struct {
308
306
Name string
@@ -320,10 +318,8 @@ func TestInstanceToUsageRecords(t *testing.T) {
320
318
WorkspaceClass : defaultWorkspaceClass ,
321
319
Type : db .WorkspaceType_Prebuild ,
322
320
UsageAttributionID : teamAttributionID ,
323
- CreationTime : creationTime ,
324
321
StartedTime : startedTime ,
325
322
StoppingTime : stoppingTime ,
326
- StoppedTime : stoppedTime ,
327
323
},
328
324
},
329
325
Expected : []db.WorkspaceInstanceUsage {{
@@ -352,10 +348,8 @@ func TestInstanceToUsageRecords(t *testing.T) {
352
348
Type : db .WorkspaceType_Regular ,
353
349
WorkspaceID : workspaceID ,
354
350
UsageAttributionID : teamAttributionID ,
355
- CreationTime : creationTime ,
356
351
StartedTime : startedTime ,
357
352
StoppingTime : db.VarcharTime {},
358
- StoppedTime : db.VarcharTime {},
359
353
},
360
354
},
361
355
Expected : []db.WorkspaceInstanceUsage {{
@@ -402,7 +396,7 @@ func TestReportGenerator_GenerateUsageReport(t *testing.T) {
402
396
UsageAttributionID : db .NewTeamAttributionID (teamID .String ()),
403
397
StartedTime : db .NewVarcharTime (time .Date (2022 , 05 , 30 , 00 , 01 , 00 , 00 , time .UTC )),
404
398
}),
405
- // No creation time, invalid record
399
+ // No creation time, invalid record, ignored
406
400
dbtest .NewWorkspaceInstance (t , db.WorkspaceInstance {
407
401
ID : uuid .New (),
408
402
UsageAttributionID : db .NewTeamAttributionID (teamID .String ()),
@@ -426,7 +420,7 @@ func TestReportGenerator_GenerateUsageReport(t *testing.T) {
426
420
require .Equal (t , nowFunc (), report .GenerationTime )
427
421
require .Equal (t , startOfMay , report .From )
428
422
// require.Equal(t, startOfJune, report.To) TODO(gpl) This is not true anymore - does it really make sense to test for it?
429
- require .Len (t , report .InvalidSessions , 1 )
423
+ require .Len (t , report .InvalidSessions , 0 )
430
424
require .Len (t , report .UsageRecords , 2 )
431
425
}
432
426
@@ -654,7 +648,6 @@ func TestReconcileWithLedger(t *testing.T) {
654
648
WorkspaceClass : db .WorkspaceClass_Default ,
655
649
Type : db .WorkspaceType_Regular ,
656
650
UsageAttributionID : db .NewTeamAttributionID (uuid .New ().String ()),
657
- CreationTime : db .NewVarcharTime (now .Add (1 * time .Minute )),
658
651
}
659
652
660
653
inserts , updates := reconcileUsageWithLedger ([]db.WorkspaceInstanceForUsage {instance , instance }, nil , pricer , now )
@@ -685,7 +678,6 @@ func TestReconcileWithLedger(t *testing.T) {
685
678
WorkspaceClass : db .WorkspaceClass_Default ,
686
679
Type : db .WorkspaceType_Regular ,
687
680
UsageAttributionID : db .NewTeamAttributionID (uuid .New ().String ()),
688
- CreationTime : db .NewVarcharTime (now .Add (1 * time .Minute )),
689
681
}
690
682
691
683
// the fields in the usage record deliberately do not match the instance, except for the Instance ID.
0 commit comments