@@ -174,12 +174,11 @@ func TestListFreightFromWarehouse(t *testing.T) {
174
174
},
175
175
},
176
176
{
177
- name : "success with VerifiedIn and VerifiedBefore options" ,
177
+ name : "success with VerifiedIn and RequiredSoakTime options" ,
178
178
opts : & ListWarehouseFreightOptions {
179
- ApprovedFor : testStage ,
180
- VerifiedIn : []string {testUpstreamStage },
181
- VerifiedBefore : & metav1.Time {Time : time .Now ().Add (- 1 * time .Hour )},
182
- },
179
+ ApprovedFor : testStage ,
180
+ VerifiedIn : []string {testUpstreamStage },
181
+ RequiredSoakTime : ptr .To (time .Hour )},
183
182
objects : []client.Object {
184
183
& kargoapi.Freight { // This should not be returned
185
184
ObjectMeta : metav1.ObjectMeta {
@@ -196,7 +195,9 @@ func TestListFreightFromWarehouse(t *testing.T) {
196
195
ApprovedFor : map [string ]kargoapi.ApprovedStage {testStage : {}},
197
196
// Doesn't matter that it's verified upstream, because this is the
198
197
// wrong warehouse
199
- VerifiedIn : map [string ]kargoapi.VerifiedStage {testUpstreamStage : {}},
198
+ VerifiedIn : map [string ]kargoapi.VerifiedStage {testUpstreamStage : {
199
+ LongestCompletedSoak : & metav1.Duration {Duration : 2 * time .Hour },
200
+ }},
200
201
},
201
202
},
202
203
& kargoapi.Freight { // This should not be returned
@@ -238,7 +239,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
238
239
// yet elapsed
239
240
VerifiedIn : map [string ]kargoapi.VerifiedStage {
240
241
testUpstreamStage : {
241
- VerifiedAt : ptr . To ( metav1 .Now ()) ,
242
+ LongestCompletedSoak : & metav1.Duration { Duration : 30 * time . Minute } ,
242
243
},
243
244
},
244
245
},
@@ -257,7 +258,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
257
258
// elapsed
258
259
VerifiedIn : map [string ]kargoapi.VerifiedStage {
259
260
testUpstreamStage : {
260
- VerifiedAt : ptr . To ( metav1 .NewTime ( time . Now (). Add ( - 2 * time .Hour ))) ,
261
+ LongestCompletedSoak : & metav1.Duration { Duration : 2 * time .Hour } ,
261
262
},
262
263
},
263
264
},
@@ -278,7 +279,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
278
279
AvailabilityStrategy : kargoapi .FreightAvailabilityStrategyAll ,
279
280
ApprovedFor : testStage ,
280
281
VerifiedIn : []string {testUpstreamStage , testUpstreamStage2 },
281
- VerifiedBefore : & metav1. Time { Time : time . Now (). Add ( - 1 * time .Hour )} ,
282
+ RequiredSoakTime : ptr . To ( time .Hour ),
282
283
},
283
284
objects : []client.Object {
284
285
& kargoapi.Freight { // This should be returned as its approved for the Stage
@@ -294,11 +295,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
294
295
// This is approved for the Stage
295
296
ApprovedFor : map [string ]kargoapi.ApprovedStage {testStage : {}},
296
297
// This is only verified in a single upstream Stage
297
- VerifiedIn : map [string ]kargoapi.VerifiedStage {
298
- testUpstreamStage : {
299
- VerifiedAt : ptr .To (metav1 .Now ()),
300
- },
301
- },
298
+ VerifiedIn : map [string ]kargoapi.VerifiedStage {},
302
299
},
303
300
},
304
301
& kargoapi.Freight {
@@ -317,10 +314,10 @@ func TestListFreightFromWarehouse(t *testing.T) {
317
314
// This is verified in all of the upstream Stages and the soak time has lapsed
318
315
VerifiedIn : map [string ]kargoapi.VerifiedStage {
319
316
testUpstreamStage : {
320
- VerifiedAt : ptr . To ( metav1 .NewTime ( time . Now (). Add ( - 2 * time .Hour ))) ,
317
+ LongestCompletedSoak : & metav1.Duration { Duration : 2 * time .Hour } ,
321
318
},
322
319
testUpstreamStage2 : {
323
- VerifiedAt : ptr . To ( metav1 .NewTime ( time . Now (). Add ( - 2 * time .Hour ))) ,
320
+ LongestCompletedSoak : & metav1.Duration { Duration : 2 * time .Hour } ,
324
321
},
325
322
},
326
323
},
@@ -339,9 +336,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
339
336
ApprovedFor : map [string ]kargoapi.ApprovedStage {},
340
337
// This is not verified in all of the upstream Stages
341
338
VerifiedIn : map [string ]kargoapi.VerifiedStage {
342
- testUpstreamStage : {
343
- VerifiedAt : ptr .To (metav1 .Now ()),
344
- },
339
+ testUpstreamStage : {},
345
340
},
346
341
},
347
342
},
@@ -360,10 +355,10 @@ func TestListFreightFromWarehouse(t *testing.T) {
360
355
// This is verified in all of the upstream Stages but only passed the soak time of one
361
356
VerifiedIn : map [string ]kargoapi.VerifiedStage {
362
357
testUpstreamStage : {
363
- VerifiedAt : ptr . To ( metav1 .NewTime ( time . Now (). Add ( - 2 * time .Hour ))) ,
358
+ LongestCompletedSoak : & metav1.Duration { Duration : 2 * time .Hour } ,
364
359
},
365
360
testUpstreamStage2 : {
366
- VerifiedAt : ptr . To ( metav1 .Now ()) ,
361
+ LongestCompletedSoak : & metav1.Duration { Duration : 30 * time . Minute } ,
367
362
},
368
363
},
369
364
},
@@ -384,7 +379,7 @@ func TestListFreightFromWarehouse(t *testing.T) {
384
379
AvailabilityStrategy : "Invalid" ,
385
380
ApprovedFor : testStage ,
386
381
VerifiedIn : []string {testUpstreamStage , testUpstreamStage2 },
387
- VerifiedBefore : & metav1. Time { Time : time . Now (). Add ( - 1 * time .Hour )} ,
382
+ RequiredSoakTime : ptr . To ( time .Hour ),
388
383
},
389
384
assertions : func (t * testing.T , _ []kargoapi.Freight , err error ) {
390
385
require .ErrorContains (t , err , "unsupported AvailabilityStrategy" )
0 commit comments