fix(metadb): set LastUpdated field also for indexes (#2088)

Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
Andreea Lupu
2023-11-29 15:15:39 +02:00
committed by GitHub
parent 3c8da6e6fc
commit e59d8da454
3 changed files with 86 additions and 2 deletions
+29
View File
@@ -2,6 +2,7 @@ package convert_test
import (
"testing"
"time"
ispec "github.com/opencontainers/image-spec/specs-go/v1"
. "github.com/smartystreets/goconvey/convey"
@@ -70,3 +71,31 @@ func TestConvertErrors(t *testing.T) {
})
})
}
func TestGetProtoEarlierUpdatedImage(t *testing.T) {
Convey("GetProtoEarlierUpdatedImage with nil params", t, func() {
// repoLastImage is nil
lastImage := gen.RepoLastUpdatedImage{}
repoLastUpdatedImage := convert.GetProtoEarlierUpdatedImage(nil, &lastImage)
So(repoLastUpdatedImage, ShouldNotBeNil)
So(repoLastUpdatedImage.LastUpdated, ShouldBeNil)
// lastImage is nil
repoLastImage := gen.RepoLastUpdatedImage{}
repoLastUpdatedImage = convert.GetProtoEarlierUpdatedImage(&repoLastImage, nil)
So(repoLastUpdatedImage, ShouldNotBeNil)
So(repoLastUpdatedImage.LastUpdated, ShouldBeNil)
// lastImage.LastUpdated is not nil, but repoLastImage.LastUpdated is nil
lastUpdated := time.Time{}
lastImage = gen.RepoLastUpdatedImage{
LastUpdated: convert.GetProtoTime(&lastUpdated),
}
repoLastUpdatedImage = convert.GetProtoEarlierUpdatedImage(&repoLastImage, &lastImage)
So(repoLastUpdatedImage, ShouldNotBeNil)
So(repoLastUpdatedImage.LastUpdated, ShouldNotBeNil)
})
}