@@ -350,6 +350,7 @@ func TestListActions(t *testing.T) {
350350func TestListGroupActions (t * testing.T ) {
351351 t .Parallel ()
352352 ctx := context .Background ()
353+ clock := clock .NewTestClock (testTime1 )
353354
354355 group1 := intToSessionID (0 )
355356
@@ -358,9 +359,7 @@ func TestListGroupActions(t *testing.T) {
358359 index .AddPair (sessionID1 , group1 )
359360 index .AddPair (sessionID2 , group1 )
360361
361- db , err := NewBoltDB (
362- t .TempDir (), "test.db" , index , clock .NewDefaultClock (),
363- )
362+ db , err := NewBoltDB (t .TempDir (), "test.db" , index , clock )
364363 require .NoError (t , err )
365364 t .Cleanup (func () {
366365 _ = db .Close ()
@@ -372,14 +371,18 @@ func TestListGroupActions(t *testing.T) {
372371 require .Empty (t , al )
373372
374373 // Add an action under session 1.
375- _ , err = db .AddAction (ctx , action1Req )
374+ locator1 , err := db .AddAction (ctx , action1Req )
375+ require .NoError (t , err )
376+ err = db .SetActionState (ctx , locator1 , ActionStateDone , "" )
376377 require .NoError (t , err )
377378
378379 // There should now be one action in the group.
379380 al , _ , _ , err = db .ListActions (ctx , nil , WithActionGroupID (group1 ))
380381 require .NoError (t , err )
381382 require .Len (t , al , 1 )
382- require .Equal (t , sessionID1 , al [0 ].SessionID )
383+ assertEqualActions (t , action1 , al [0 ])
384+
385+ clock .SetTime (testTime2 )
383386
384387 // Add an action under session 2.
385388 _ , err = db .AddAction (ctx , action2Req )
@@ -389,8 +392,8 @@ func TestListGroupActions(t *testing.T) {
389392 al , _ , _ , err = db .ListActions (ctx , nil , WithActionGroupID (group1 ))
390393 require .NoError (t , err )
391394 require .Len (t , al , 2 )
392- require . Equal (t , sessionID1 , al [0 ]. SessionID )
393- require . Equal (t , sessionID2 , al [1 ]. SessionID )
395+ assertEqualActions (t , action1 , al [0 ])
396+ assertEqualActions (t , action2 , al [1 ])
394397}
395398
396399func assertEqualActions (t * testing.T , expected , got * Action ) {
0 commit comments