@@ -86,27 +86,27 @@ func TestDeleteOldWorkspaceAgentStats(t *testing.T) {
86
86
// conflicts, verifying DST behavior is beyond the scope of this
87
87
// test.
88
88
// Let's use RxBytes to identify stat entries.
89
- // Stat inserted 6 months + 2 hour ago, should be deleted.
89
+ // Stat inserted 180 days + 2 hour ago, should be deleted.
90
90
first := dbgen .WorkspaceAgentStat (t , db , database.WorkspaceAgentStat {
91
- CreatedAt : now .AddDate (0 , - 6 , 0 ).Add (- 2 * time .Hour ),
91
+ CreatedAt : now .AddDate (0 , 0 , - 180 ).Add (- 2 * time .Hour ),
92
92
ConnectionCount : 1 ,
93
93
ConnectionMedianLatencyMS : 1 ,
94
94
RxBytes : 1111 ,
95
95
SessionCountSSH : 1 ,
96
96
})
97
97
98
- // Stat inserted 6 months - 2 hour ago, should not be deleted before rollup.
98
+ // Stat inserted 180 days - 2 hour ago, should not be deleted before rollup.
99
99
second := dbgen .WorkspaceAgentStat (t , db , database.WorkspaceAgentStat {
100
- CreatedAt : now .AddDate (0 , - 6 , 0 ).Add (2 * time .Hour ),
100
+ CreatedAt : now .AddDate (0 , 0 , - 180 ).Add (2 * time .Hour ),
101
101
ConnectionCount : 1 ,
102
102
ConnectionMedianLatencyMS : 1 ,
103
103
RxBytes : 2222 ,
104
104
SessionCountSSH : 1 ,
105
105
})
106
106
107
- // Stat inserted 6 months - 1 day - 4 hour ago, should not be deleted at all.
107
+ // Stat inserted 179 days - 4 hour ago, should not be deleted at all.
108
108
third := dbgen .WorkspaceAgentStat (t , db , database.WorkspaceAgentStat {
109
- CreatedAt : now .AddDate (0 , - 6 , 0 ). AddDate ( 0 , 0 , 1 ).Add (4 * time .Hour ),
109
+ CreatedAt : now .AddDate (0 , 0 , - 179 ).Add (4 * time .Hour ),
110
110
ConnectionCount : 1 ,
111
111
ConnectionMedianLatencyMS : 1 ,
112
112
RxBytes : 3333 ,
@@ -121,8 +121,8 @@ func TestDeleteOldWorkspaceAgentStats(t *testing.T) {
121
121
var stats []database.GetWorkspaceAgentStatsRow
122
122
var err error
123
123
require .Eventuallyf (t , func () bool {
124
- // Query all stats created not earlier than 7 months ago
125
- stats , err = db .GetWorkspaceAgentStats (ctx , now .AddDate (0 , - 7 , 0 ))
124
+ // Query all stats created not earlier than ~ 7 months ago
125
+ stats , err = db .GetWorkspaceAgentStats (ctx , now .AddDate (0 , 0 , - 210 ))
126
126
if err != nil {
127
127
return false
128
128
}
@@ -144,8 +144,8 @@ func TestDeleteOldWorkspaceAgentStats(t *testing.T) {
144
144
145
145
// then
146
146
require .Eventuallyf (t , func () bool {
147
- // Query all stats created not earlier than 7 months ago
148
- stats , err = db .GetWorkspaceAgentStats (ctx , now .AddDate (0 , - 7 , 0 ))
147
+ // Query all stats created not earlier than ~ 7 months ago
148
+ stats , err = db .GetWorkspaceAgentStats (ctx , now .AddDate (0 , 0 , - 210 ))
149
149
if err != nil {
150
150
return false
151
151
}
0 commit comments