@@ -560,10 +560,9 @@ func TestPurgeDanglingManifestsWithAgoAndKeep(t *testing.T) {
560560 assert := assert .New (t )
561561 mockClient := & mocks.AcrCLIClientInterface {}
562562
563- // Create manifests with different timestamps
564- // old manifest: more than 300 days ago from now (2026), recent: less than 300 days
565- oldManifest := createManifestWithTime ("sha256:old123" , "2025-01-01T00:00:00Z" )
566- recentManifest := createManifestWithTime ("sha256:recent123" , "2026-01-15T00:00:00Z" )
563+ now := time .Now ().UTC ()
564+ oldManifest := createManifestWithTime ("sha256:old123" , now .Add (- 400 * 24 * time .Hour ).Format (time .RFC3339Nano ))
565+ recentManifest := createManifestWithTime ("sha256:recent123" , now .Add (- 100 * 24 * time .Hour ).Format (time .RFC3339Nano ))
567566
568567 manifestsResult := & acr.Manifests {
569568 Response : autorest.Response {
@@ -586,7 +585,7 @@ func TestPurgeDanglingManifestsWithAgoAndKeep(t *testing.T) {
586585 mockClient .On ("GetAcrManifests" , mock .Anything , testRepo , "" , "sha256:recent123" ).Return (emptyResult , nil ).Once ()
587586 mockClient .On ("DeleteManifest" , mock .Anything , testRepo , "sha256:old123" ).Return (nil , nil ).Once ()
588587
589- // Call with 300 days ago (should only delete the old manifest from 2023 )
588+ // Call with 300 days ago (should only delete the old manifest)
590589 agoDuration := mustParseDuration ("300d" )
591590 opts := retentionOptions {agoDuration : & agoDuration , keep : 0 , minTags : - 1 , maxTags : - 1 , minManifests : - 1 , maxManifests : - 1 , dryRun : false , includeLocked : false }
592591 deletedCount , err := purgeDanglingManifests (testCtx , mockClient , defaultPoolSize , testLoginURL , testRepo , opts , nil , false )
@@ -694,9 +693,9 @@ func TestPurgeDanglingManifestsWithAgoAndKeep(t *testing.T) {
694693 assert := assert .New (t )
695694 mockClient := & mocks.AcrCLIClientInterface {}
696695
697- // old manifest: more than 300 days ago, recent: less than 300 days
698- oldManifest := createManifestWithTime ("sha256:old123" , "2025-01-01T00:00:00Z" )
699- recentManifest := createManifestWithTime ("sha256:recent123" , "2026-01-15T00:00:00Z" )
696+ now := time . Now (). UTC ()
697+ oldManifest := createManifestWithTime ("sha256:old123" , now . Add ( - 400 * 24 * time . Hour ). Format ( time . RFC3339Nano ) )
698+ recentManifest := createManifestWithTime ("sha256:recent123" , now . Add ( - 100 * 24 * time . Hour ). Format ( time . RFC3339Nano ) )
700699
701700 manifestsResult := & acr.Manifests {
702701 Response : autorest.Response {
0 commit comments