mirror of
https://github.com/project-zot/zot.git
synced 2026-06-18 05:28:07 +08:00
6f67fcdf8f
* feat(sync): add SyncLegacyCosignTags config to skip syncing legacy cosign/SBOM tags when disabled Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> * fix: sync on demand with referrers API should not use recursion to sync referrers of referrers Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> * fix: add tests SyncLegacyCosignTags and changes in /referrers on demand sync Credit for the tests goes to @jzhn see: https://github.com/project-zot/zot/pull/3840/changes Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> * fix: remove redundant syncRef logic which synced referrers both with the zot inner() implementation and with regctl native implementation Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com> --------- Signed-off-by: Andrei Aaron <andreifdaaron@gmail.com>
32 lines
898 B
Go
32 lines
898 B
Go
package sync_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
|
|
syncconf "zotregistry.dev/zot/v2/pkg/extensions/config/sync"
|
|
)
|
|
|
|
func TestRegistryConfig_ShouldSyncLegacyCosignTags(t *testing.T) {
|
|
Convey("ShouldSyncLegacyCosignTags", t, func() {
|
|
Convey("returns true when SyncLegacyCosignTags is nil (default)", func() {
|
|
cfg := syncconf.RegistryConfig{}
|
|
So(cfg.SyncLegacyCosignTags, ShouldBeNil)
|
|
So(cfg.ShouldSyncLegacyCosignTags(), ShouldBeTrue)
|
|
})
|
|
|
|
Convey("returns true when SyncLegacyCosignTags is true", func() {
|
|
v := true
|
|
cfg := syncconf.RegistryConfig{SyncLegacyCosignTags: &v}
|
|
So(cfg.ShouldSyncLegacyCosignTags(), ShouldBeTrue)
|
|
})
|
|
|
|
Convey("returns false when SyncLegacyCosignTags is false", func() {
|
|
v := false
|
|
cfg := syncconf.RegistryConfig{SyncLegacyCosignTags: &v}
|
|
So(cfg.ShouldSyncLegacyCosignTags(), ShouldBeFalse)
|
|
})
|
|
})
|
|
}
|