@@ -46,7 +46,7 @@ func TestBatchStats(t *testing.T) {
46
46
47
47
// Given: no data points are added for workspace
48
48
// When: it becomes time to report stats
49
- t1 := time .Now ()
49
+ t1 := database .Now ()
50
50
// Signal a tick and wait for a flush to complete.
51
51
tick <- t1
52
52
f := <- flushed
@@ -59,7 +59,7 @@ func TestBatchStats(t *testing.T) {
59
59
require .Empty (t , stats , "should have no stats for workspace" )
60
60
61
61
// Given: a single data point is added for workspace
62
- t2 := time .Now ()
62
+ t2 := database .Now ()
63
63
t .Logf ("inserting 1 stat" )
64
64
require .NoError (t , b .Add (deps1 .Agent .ID , deps1 .User .ID , deps1 .Template .ID , deps1 .Workspace .ID , randAgentSDKStats (t )))
65
65
@@ -77,7 +77,7 @@ func TestBatchStats(t *testing.T) {
77
77
78
78
// Given: a lot of data points are added for both workspaces
79
79
// (equal to batch size)
80
- t3 := time .Now ()
80
+ t3 := database .Now ()
81
81
done := make (chan struct {})
82
82
83
83
go func () {
@@ -105,15 +105,15 @@ func TestBatchStats(t *testing.T) {
105
105
require .Len (t , stats , 2 , "should have stats for both workspaces" )
106
106
107
107
// Ensures that a subsequent flush pushes all the remaining data
108
- t4 := time .Now ()
108
+ t4 := database .Now ()
109
109
tick <- t4
110
110
f2 := <- flushed
111
111
t .Logf ("flush 4 completed" )
112
112
expectedCount := defaultBufferSize - f
113
113
require .Equal (t , expectedCount , f2 , "did not flush expected remaining rows" )
114
114
115
115
// Ensure that a subsequent flush does not push stale data.
116
- t5 := time .Now ()
116
+ t5 := database .Now ()
117
117
tick <- t5
118
118
f = <- flushed
119
119
require .Zero (t , f , "expected zero stats to have been flushed" )
0 commit comments