@@ -203,6 +203,7 @@ func TestDeleteOldProvisionerDaemons(t *testing.T) {
203
203
t .Parallel ()
204
204
205
205
db , _ := dbtestutil .NewDB (t )
206
+ defaultOrg := dbgen .Organization (t , db , database.Organization {})
206
207
logger := slogtest .Make (t , & slogtest.Options {IgnoreErrors : true })
207
208
208
209
ctx , cancel := context .WithTimeout (context .Background (), testutil .WaitShort )
@@ -213,24 +214,26 @@ func TestDeleteOldProvisionerDaemons(t *testing.T) {
213
214
// given
214
215
_ , err := db .UpsertProvisionerDaemon (ctx , database.UpsertProvisionerDaemonParams {
215
216
// Provisioner daemon created 14 days ago, and checked in just before 7 days deadline.
216
- Name : "external-0" ,
217
- Provisioners : []database.ProvisionerType {"echo" },
218
- Tags : database.StringMap {provisionersdk .TagScope : provisionersdk .ScopeOrganization },
219
- CreatedAt : now .Add (- 14 * 24 * time .Hour ),
220
- LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 7 * 24 * time .Hour ).Add (time .Minute )},
221
- Version : "1.0.0" ,
222
- APIVersion : proto .CurrentVersion .String (),
217
+ Name : "external-0" ,
218
+ Provisioners : []database.ProvisionerType {"echo" },
219
+ Tags : database.StringMap {provisionersdk .TagScope : provisionersdk .ScopeOrganization },
220
+ CreatedAt : now .Add (- 14 * 24 * time .Hour ),
221
+ LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 7 * 24 * time .Hour ).Add (time .Minute )},
222
+ Version : "1.0.0" ,
223
+ APIVersion : proto .CurrentVersion .String (),
224
+ OrganizationID : defaultOrg .ID ,
223
225
})
224
226
require .NoError (t , err )
225
227
_ , err = db .UpsertProvisionerDaemon (ctx , database.UpsertProvisionerDaemonParams {
226
228
// Provisioner daemon created 8 days ago, and checked in last time an hour after creation.
227
- Name : "external-1" ,
228
- Provisioners : []database.ProvisionerType {"echo" },
229
- Tags : database.StringMap {provisionersdk .TagScope : provisionersdk .ScopeOrganization },
230
- CreatedAt : now .Add (- 8 * 24 * time .Hour ),
231
- LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 8 * 24 * time .Hour ).Add (time .Hour )},
232
- Version : "1.0.0" ,
233
- APIVersion : proto .CurrentVersion .String (),
229
+ Name : "external-1" ,
230
+ Provisioners : []database.ProvisionerType {"echo" },
231
+ Tags : database.StringMap {provisionersdk .TagScope : provisionersdk .ScopeOrganization },
232
+ CreatedAt : now .Add (- 8 * 24 * time .Hour ),
233
+ LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 8 * 24 * time .Hour ).Add (time .Hour )},
234
+ Version : "1.0.0" ,
235
+ APIVersion : proto .CurrentVersion .String (),
236
+ OrganizationID : defaultOrg .ID ,
234
237
})
235
238
require .NoError (t , err )
236
239
_ , err = db .UpsertProvisionerDaemon (ctx , database.UpsertProvisionerDaemonParams {
@@ -241,9 +244,10 @@ func TestDeleteOldProvisionerDaemons(t *testing.T) {
241
244
provisionersdk .TagScope : provisionersdk .ScopeUser ,
242
245
provisionersdk .TagOwner : uuid .NewString (),
243
246
},
244
- CreatedAt : now .Add (- 9 * 24 * time .Hour ),
245
- Version : "1.0.0" ,
246
- APIVersion : proto .CurrentVersion .String (),
247
+ CreatedAt : now .Add (- 9 * 24 * time .Hour ),
248
+ Version : "1.0.0" ,
249
+ APIVersion : proto .CurrentVersion .String (),
250
+ OrganizationID : defaultOrg .ID ,
247
251
})
248
252
require .NoError (t , err )
249
253
_ , err = db .UpsertProvisionerDaemon (ctx , database.UpsertProvisionerDaemonParams {
@@ -254,10 +258,11 @@ func TestDeleteOldProvisionerDaemons(t *testing.T) {
254
258
provisionersdk .TagScope : provisionersdk .ScopeUser ,
255
259
provisionersdk .TagOwner : uuid .NewString (),
256
260
},
257
- CreatedAt : now .Add (- 6 * 24 * time .Hour ),
258
- LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 6 * 24 * time .Hour )},
259
- Version : "1.0.0" ,
260
- APIVersion : proto .CurrentVersion .String (),
261
+ CreatedAt : now .Add (- 6 * 24 * time .Hour ),
262
+ LastSeenAt : sql.NullTime {Valid : true , Time : now .Add (- 6 * 24 * time .Hour )},
263
+ Version : "1.0.0" ,
264
+ APIVersion : proto .CurrentVersion .String (),
265
+ OrganizationID : defaultOrg .ID ,
261
266
})
262
267
require .NoError (t , err )
263
268
0 commit comments