mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
fix(config): make all extension config consistent (#888)
Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
parent
38b00e3507
commit
763287873e
17 changed files with 105 additions and 100 deletions
|
@ -12,7 +12,7 @@
|
||||||
},
|
},
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"lint": {
|
"lint": {
|
||||||
"enabled": true,
|
"enable": true,
|
||||||
"mandatoryAnnotations": ["annot1", "annot2", "annot3"]
|
"mandatoryAnnotations": ["annot1", "annot2", "annot3"]
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6118,7 +6118,7 @@ func TestSearchRoutes(t *testing.T) {
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
|
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
Enable: &defaultVal,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
@ -6220,7 +6220,7 @@ func TestDistSpecExtensions(t *testing.T) {
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
|
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
Enable: &defaultVal,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
|
|
@ -72,7 +72,7 @@ func TestTLSWithAuth(t *testing.T) {
|
||||||
|
|
||||||
enable := true
|
enable := true
|
||||||
conf.Extensions = &extConf.ExtensionConfig{
|
conf.Extensions = &extConf.ExtensionConfig{
|
||||||
Search: &extConf.SearchConfig{Enable: &enable},
|
Search: &extConf.SearchConfig{BaseConfig: extConf.BaseConfig{Enable: &enable}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -169,7 +169,7 @@ func TestTLSWithoutAuth(t *testing.T) {
|
||||||
|
|
||||||
enable := true
|
enable := true
|
||||||
conf.Extensions = &extConf.ExtensionConfig{
|
conf.Extensions = &extConf.ExtensionConfig{
|
||||||
Search: &extConf.SearchConfig{Enable: &enable},
|
Search: &extConf.SearchConfig{BaseConfig: extConf.BaseConfig{Enable: &enable}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
|
|
@ -362,8 +362,8 @@ func TestServerCVEResponseGQL(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
Enable: &defaultVal,
|
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: searchConfig,
|
Search: searchConfig,
|
||||||
|
@ -634,8 +634,8 @@ func TestNegativeServerResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := false
|
defaultVal := false
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
Enable: &defaultVal,
|
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: searchConfig,
|
Search: searchConfig,
|
||||||
|
@ -707,8 +707,8 @@ func TestNegativeServerResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
Enable: &defaultVal,
|
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: searchConfig,
|
Search: searchConfig,
|
||||||
|
@ -771,8 +771,8 @@ func TestServerCVEResponse(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
Enable: &defaultVal,
|
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: searchConfig,
|
Search: searchConfig,
|
||||||
|
|
|
@ -564,7 +564,7 @@ func TestServeLintExtension(t *testing.T) {
|
||||||
},
|
},
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"lint": {
|
"lint": {
|
||||||
"enabled": "true",
|
"enable": "true",
|
||||||
"mandatoryAnnotations": ["annot1"]
|
"mandatoryAnnotations": ["annot1"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ func TestServeLintExtension(t *testing.T) {
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
defer os.Remove(logPath) // clean up
|
defer os.Remove(logPath) // clean up
|
||||||
So(string(data), ShouldContainSubstring,
|
So(string(data), ShouldContainSubstring,
|
||||||
"\"Extensions\":{\"Search\":null,\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":{\"Enabled\":true,\"MandatoryAnnotations\":") //nolint:lll // gofumpt conflicts with lll
|
"\"Extensions\":{\"Search\":null,\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":{\"Enable\":true,\"MandatoryAnnotations\":") //nolint:lll // gofumpt conflicts with lll
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("lint enabled", t, func(c C) {
|
Convey("lint enabled", t, func(c C) {
|
||||||
|
@ -594,7 +594,7 @@ func TestServeLintExtension(t *testing.T) {
|
||||||
},
|
},
|
||||||
"extensions": {
|
"extensions": {
|
||||||
"lint": {
|
"lint": {
|
||||||
"enabled": "false"
|
"enable": "false"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}`
|
}`
|
||||||
|
@ -605,7 +605,7 @@ func TestServeLintExtension(t *testing.T) {
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
defer os.Remove(logPath) // clean up
|
defer os.Remove(logPath) // clean up
|
||||||
So(string(data), ShouldContainSubstring,
|
So(string(data), ShouldContainSubstring,
|
||||||
"\"Extensions\":{\"Search\":null,\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":{\"Enabled\":false,\"MandatoryAnnotations\":null}") //nolint:lll // gofumpt conflicts with lll
|
"\"Extensions\":{\"Search\":null,\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":{\"Enable\":false,\"MandatoryAnnotations\":null}") //nolint:lll // gofumpt conflicts with lll
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ func TestServeSearchEnabled(t *testing.T) {
|
||||||
WaitTillTrivyDBDownloadStarted(tempDir)
|
WaitTillTrivyDBDownloadStarted(tempDir)
|
||||||
defer os.Remove(logPath) // clean up
|
defer os.Remove(logPath) // clean up
|
||||||
|
|
||||||
substring := "\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":86400000000000},\"Enable\":true},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
substring := "\"Extensions\":{\"Search\":{\"Enable\":true,\"CVE\":{\"UpdateInterval\":86400000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
||||||
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
||||||
So(found, ShouldBeTrue)
|
So(found, ShouldBeTrue)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
@ -685,7 +685,7 @@ func TestServeSearchEnabledCVE(t *testing.T) {
|
||||||
// to avoid data race when multiple go routines write to trivy DB instance.
|
// to avoid data race when multiple go routines write to trivy DB instance.
|
||||||
WaitTillTrivyDBDownloadStarted(tempDir)
|
WaitTillTrivyDBDownloadStarted(tempDir)
|
||||||
|
|
||||||
substring := "\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":3600000000000},\"Enable\":true},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
substring := "\"Extensions\":{\"Search\":{\"Enable\":true,\"CVE\":{\"UpdateInterval\":3600000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
||||||
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
||||||
So(found, ShouldBeTrue)
|
So(found, ShouldBeTrue)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
@ -733,7 +733,7 @@ func TestServeSearchEnabledNoCVE(t *testing.T) {
|
||||||
// to avoid data race when multiple go routines write to trivy DB instance.
|
// to avoid data race when multiple go routines write to trivy DB instance.
|
||||||
WaitTillTrivyDBDownloadStarted(tempDir)
|
WaitTillTrivyDBDownloadStarted(tempDir)
|
||||||
|
|
||||||
substring := "\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":86400000000000},\"Enable\":true},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
substring := "\"Extensions\":{\"Search\":{\"Enable\":true,\"CVE\":{\"UpdateInterval\":86400000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
||||||
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
found, err := readLogFileAndSearchString(logPath, substring, readLogFileTimeout)
|
||||||
So(found, ShouldBeTrue)
|
So(found, ShouldBeTrue)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
@ -779,7 +779,7 @@ func TestServeSearchDisabled(t *testing.T) {
|
||||||
defer os.Remove(logPath) // clean up
|
defer os.Remove(logPath) // clean up
|
||||||
dataStr := string(data)
|
dataStr := string(data)
|
||||||
So(dataStr, ShouldContainSubstring,
|
So(dataStr, ShouldContainSubstring,
|
||||||
"\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":10800000000000},\"Enable\":false},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}") //nolint:lll // gofumpt conflicts with lll
|
"\"Extensions\":{\"Search\":{\"Enable\":false,\"CVE\":{\"UpdateInterval\":10800000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}") //nolint:lll // gofumpt conflicts with lll
|
||||||
So(dataStr, ShouldContainSubstring, "CVE config not provided, skipping CVE update")
|
So(dataStr, ShouldContainSubstring, "CVE config not provided, skipping CVE update")
|
||||||
So(dataStr, ShouldNotContainSubstring,
|
So(dataStr, ShouldNotContainSubstring,
|
||||||
"CVE update interval set to too-short interval < 2h, changing update duration to 2 hours and continuing.")
|
"CVE update interval set to too-short interval < 2h, changing update duration to 2 hours and continuing.")
|
||||||
|
|
|
@ -269,7 +269,7 @@ func TestSignature(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
ctlr.Config.Storage.RootDirectory = currentDir
|
ctlr.Config.Storage.RootDirectory = currentDir
|
||||||
|
@ -391,7 +391,7 @@ func TestDerivedImageList(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
||||||
|
@ -485,7 +485,7 @@ func TestBaseImageList(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
||||||
|
@ -819,7 +819,7 @@ func TestServerResponseGQL(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
||||||
|
@ -1092,7 +1092,7 @@ func TestServerResponse(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
ctlr.Config.Storage.RootDirectory = t.TempDir()
|
||||||
|
@ -1262,8 +1262,8 @@ func TestServerResponseGQLWithoutPermissions(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
Enable: &defaultVal,
|
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: searchConfig,
|
Search: searchConfig,
|
||||||
|
|
|
@ -6,6 +6,11 @@ import (
|
||||||
"zotregistry.io/zot/pkg/extensions/sync"
|
"zotregistry.io/zot/pkg/extensions/sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BaseConfig has params applicable to all extensions.
|
||||||
|
type BaseConfig struct {
|
||||||
|
Enable *bool `mapstructure:",omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
type ExtensionConfig struct {
|
type ExtensionConfig struct {
|
||||||
Search *SearchConfig
|
Search *SearchConfig
|
||||||
Sync *sync.Config
|
Sync *sync.Config
|
||||||
|
@ -15,14 +20,14 @@ type ExtensionConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type LintConfig struct {
|
type LintConfig struct {
|
||||||
Enabled *bool
|
BaseConfig `mapstructure:",squash"`
|
||||||
MandatoryAnnotations []string
|
MandatoryAnnotations []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type SearchConfig struct {
|
type SearchConfig struct {
|
||||||
|
BaseConfig `mapstructure:",squash"`
|
||||||
// CVE search
|
// CVE search
|
||||||
CVE *CVEConfig
|
CVE *CVEConfig
|
||||||
Enable *bool
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type CVEConfig struct {
|
type CVEConfig struct {
|
||||||
|
@ -30,7 +35,7 @@ type CVEConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type MetricsConfig struct {
|
type MetricsConfig struct {
|
||||||
Enable *bool
|
BaseConfig `mapstructure:",squash"`
|
||||||
Prometheus *PrometheusConfig
|
Prometheus *PrometheusConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,6 +44,6 @@ type PrometheusConfig struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type ScrubConfig struct {
|
type ScrubConfig struct {
|
||||||
Enable *bool
|
BaseConfig `mapstructure:",squash"`
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,7 @@ func TestMetricsExtension(t *testing.T) {
|
||||||
|
|
||||||
conf.Extensions = &extconf.ExtensionConfig{}
|
conf.Extensions = &extconf.ExtensionConfig{}
|
||||||
conf.Extensions.Metrics = &extconf.MetricsConfig{
|
conf.Extensions.Metrics = &extconf.MetricsConfig{
|
||||||
Enable: &defaultValue,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultValue},
|
||||||
Prometheus: &extconf.PrometheusConfig{},
|
Prometheus: &extconf.PrometheusConfig{},
|
||||||
}
|
}
|
||||||
conf.Log.Level = "info"
|
conf.Log.Level = "info"
|
||||||
|
|
|
@ -33,7 +33,7 @@ func (linter *Linter) CheckMandatoryAnnotations(repo string, manifestDigest godi
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if (linter.config != nil && !*linter.config.Enabled) || len(linter.config.MandatoryAnnotations) == 0 {
|
if (linter.config != nil && !*linter.config.Enable) || len(linter.config.MandatoryAnnotations) == 0 {
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,10 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := false
|
enable := false
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
|
@ -95,11 +95,11 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
|
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
|
@ -142,11 +142,11 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
|
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -196,11 +196,11 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
|
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -285,11 +285,11 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
|
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -373,11 +373,11 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
|
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -426,10 +426,10 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
conf := config.New()
|
conf := config.New()
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
enabled := true
|
enable := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
conf.Extensions = &extconf.ExtensionConfig{Lint: &extconf.LintConfig{}}
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{}
|
||||||
conf.Extensions.Lint.Enabled = &enabled
|
conf.Extensions.Lint.Enable = &enable
|
||||||
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
conf.Extensions.Lint.MandatoryAnnotations = []string{"annotation1", "annotation2", "annotation3"}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -477,10 +477,10 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
Convey("Mandatory annotations disabled", t, func() {
|
Convey("Mandatory annotations disabled", t, func() {
|
||||||
enabled := false
|
enable := false
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{},
|
MandatoryAnnotations: []string{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -510,10 +510,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Mandatory annotations enabled, but no list in config", t, func() {
|
Convey("Mandatory annotations enabled, but no list in config", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{},
|
MandatoryAnnotations: []string{},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,10 +543,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Mandatory annotations verification passing", t, func() {
|
Convey("Mandatory annotations verification passing", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,10 +607,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Mandatory annotations incomplete in manifest", t, func() {
|
Convey("Mandatory annotations incomplete in manifest", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,10 +670,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Mandatory annotations verification passing - more annotations than the mandatory list", t, func() {
|
Convey("Mandatory annotations verification passing - more annotations than the mandatory list", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,10 +735,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Cannot unmarshal manifest", t, func() {
|
Convey("Cannot unmarshal manifest", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,10 +809,10 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||||
})
|
})
|
||||||
|
|
||||||
Convey("Cannot get config file", t, func() {
|
Convey("Cannot get config file", t, func() {
|
||||||
enabled := true
|
enable := true
|
||||||
|
|
||||||
lintConfig := &extconf.LintConfig{
|
lintConfig := &extconf.LintConfig{
|
||||||
Enabled: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enable},
|
||||||
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
MandatoryAnnotations: []string{"annotation1", "annotation2", "annotation3"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ func TestExtensionMetrics(t *testing.T) {
|
||||||
conf.Extensions = &extconf.ExtensionConfig{}
|
conf.Extensions = &extconf.ExtensionConfig{}
|
||||||
enabled := true
|
enabled := true
|
||||||
conf.Extensions.Metrics = &extconf.MetricsConfig{
|
conf.Extensions.Metrics = &extconf.MetricsConfig{
|
||||||
Enable: &enabled,
|
BaseConfig: extconf.BaseConfig{Enable: &enabled},
|
||||||
Prometheus: &extconf.PrometheusConfig{Path: "/metrics"},
|
Prometheus: &extconf.PrometheusConfig{Path: "/metrics"},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ func TestExtensionMetrics(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = t.TempDir()
|
conf.Storage.RootDirectory = t.TempDir()
|
||||||
conf.Extensions = &extconf.ExtensionConfig{}
|
conf.Extensions = &extconf.ExtensionConfig{}
|
||||||
var disabled bool
|
var disabled bool
|
||||||
conf.Extensions.Metrics = &extconf.MetricsConfig{Enable: &disabled}
|
conf.Extensions.Metrics = &extconf.MetricsConfig{BaseConfig: extconf.BaseConfig{Enable: &disabled}}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
So(ctlr, ShouldNotBeNil)
|
So(ctlr, ShouldNotBeNil)
|
||||||
|
|
|
@ -51,7 +51,7 @@ func TestScrubExtension(t *testing.T) {
|
||||||
conf.Log.Output = logFile.Name()
|
conf.Log.Output = logFile.Name()
|
||||||
trueValue := true
|
trueValue := true
|
||||||
scrubConfig := &extconf.ScrubConfig{
|
scrubConfig := &extconf.ScrubConfig{
|
||||||
Enable: &trueValue,
|
BaseConfig: extconf.BaseConfig{Enable: &trueValue},
|
||||||
Interval: 2,
|
Interval: 2,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
@ -111,7 +111,7 @@ func TestScrubExtension(t *testing.T) {
|
||||||
conf.Log.Output = logFile.Name()
|
conf.Log.Output = logFile.Name()
|
||||||
trueValue := true
|
trueValue := true
|
||||||
scrubConfig := &extconf.ScrubConfig{
|
scrubConfig := &extconf.ScrubConfig{
|
||||||
Enable: &trueValue,
|
BaseConfig: extconf.BaseConfig{Enable: &trueValue},
|
||||||
Interval: 2,
|
Interval: 2,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
@ -178,7 +178,7 @@ func TestScrubExtension(t *testing.T) {
|
||||||
conf.Log.Output = logFile.Name()
|
conf.Log.Output = logFile.Name()
|
||||||
trueValue := true
|
trueValue := true
|
||||||
scrubConfig := &extconf.ScrubConfig{
|
scrubConfig := &extconf.ScrubConfig{
|
||||||
Enable: &trueValue,
|
BaseConfig: extconf.BaseConfig{Enable: &trueValue},
|
||||||
Interval: 2,
|
Interval: 2,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
|
|
@ -284,7 +284,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = rootDir
|
conf.Storage.RootDirectory = rootDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -397,7 +397,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
|
||||||
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -563,7 +563,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
|
||||||
UpdateInterval: updateDuration,
|
UpdateInterval: updateDuration,
|
||||||
}
|
}
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
Enable: &defaultVal,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
@ -604,7 +604,7 @@ func TestRepoListWithNewestImage(t *testing.T) {
|
||||||
_ = ctlr.Server.Shutdown(ctx)
|
_ = ctlr.Server.Shutdown(ctx)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
substring := "\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":3600000000000},\"Enable\":true},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
substring := "\"Extensions\":{\"Search\":{\"Enable\":true,\"CVE\":{\"UpdateInterval\":3600000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
||||||
found, err := readFileAndSearchString(logPath, substring, 2*time.Minute)
|
found, err := readFileAndSearchString(logPath, substring, 2*time.Minute)
|
||||||
So(found, ShouldBeTrue)
|
So(found, ShouldBeTrue)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
@ -671,7 +671,7 @@ func TestExpandedRepoInfo(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = tempDir
|
conf.Storage.RootDirectory = tempDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -771,7 +771,7 @@ func TestExpandedRepoInfo(t *testing.T) {
|
||||||
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -1067,7 +1067,7 @@ func TestDerivedImageList(t *testing.T) {
|
||||||
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -1385,7 +1385,7 @@ func TestDerivedImageListNoRepos(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = t.TempDir()
|
conf.Storage.RootDirectory = t.TempDir()
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -1482,7 +1482,7 @@ func TestBaseImageList(t *testing.T) {
|
||||||
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -1900,7 +1900,7 @@ func TestBaseImageListNoRepos(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = t.TempDir()
|
conf.Storage.RootDirectory = t.TempDir()
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -1998,7 +1998,7 @@ func TestGlobalSearch(t *testing.T) {
|
||||||
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
conf.Storage.SubPaths[subpath] = config.StorageConfig{RootDirectory: subRootDir}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -2195,7 +2195,7 @@ func TestGlobalSearch(t *testing.T) {
|
||||||
UpdateInterval: updateDuration,
|
UpdateInterval: updateDuration,
|
||||||
}
|
}
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
Enable: &defaultVal,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
@ -2239,7 +2239,7 @@ func TestGlobalSearch(t *testing.T) {
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Wait for trivy db to download
|
// Wait for trivy db to download
|
||||||
substring := "\"Extensions\":{\"Search\":{\"CVE\":{\"UpdateInterval\":3600000000000},\"Enable\":true},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
substring := "\"Extensions\":{\"Search\":{\"Enable\":true,\"CVE\":{\"UpdateInterval\":3600000000000}},\"Sync\":null,\"Metrics\":null,\"Scrub\":null,\"Lint\":null}" //nolint:lll // gofumpt conflicts with lll
|
||||||
found, err := readFileAndSearchString(logPath, substring, 2*time.Minute)
|
found, err := readFileAndSearchString(logPath, substring, 2*time.Minute)
|
||||||
So(found, ShouldBeTrue)
|
So(found, ShouldBeTrue)
|
||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
|
@ -2418,7 +2418,7 @@ func TestImageList(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = rootDir
|
conf.Storage.RootDirectory = rootDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -2490,7 +2490,7 @@ func TestImageList(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = tempDir
|
conf.Storage.RootDirectory = tempDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -2602,7 +2602,7 @@ func TestBuildImageInfo(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = rootDir
|
conf.Storage.RootDirectory = rootDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
@ -2789,7 +2789,7 @@ func TestSearchSize(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
tr := true
|
tr := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &tr},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &tr}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -2903,7 +2903,7 @@ func TestImageSummary(t *testing.T) {
|
||||||
|
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
conf.Extensions.Search.CVE = nil
|
conf.Extensions.Search.CVE = nil
|
||||||
|
|
|
@ -412,7 +412,7 @@ func TestCVESearch(t *testing.T) {
|
||||||
}
|
}
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
searchConfig := &extconf.SearchConfig{
|
searchConfig := &extconf.SearchConfig{
|
||||||
Enable: &defaultVal,
|
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||||
CVE: cveConfig,
|
CVE: cveConfig,
|
||||||
}
|
}
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
|
|
|
@ -161,7 +161,7 @@ func TestDigestSearchHTTP(t *testing.T) {
|
||||||
conf.Storage.RootDirectory = rootDir
|
conf.Storage.RootDirectory = rootDir
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -312,7 +312,7 @@ func TestDigestSearchHTTPSubPaths(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
defaultVal := true
|
defaultVal := true
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &defaultVal},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &defaultVal}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
@ -388,7 +388,7 @@ func TestDigestSearchDisabled(t *testing.T) {
|
||||||
conf.HTTP.Port = port
|
conf.HTTP.Port = port
|
||||||
conf.Storage.RootDirectory = t.TempDir()
|
conf.Storage.RootDirectory = t.TempDir()
|
||||||
conf.Extensions = &extconf.ExtensionConfig{
|
conf.Extensions = &extconf.ExtensionConfig{
|
||||||
Search: &extconf.SearchConfig{Enable: &disabled},
|
Search: &extconf.SearchConfig{BaseConfig: extconf.BaseConfig{Enable: &disabled}},
|
||||||
}
|
}
|
||||||
|
|
||||||
ctlr := api.NewController(conf)
|
ctlr := api.NewController(conf)
|
||||||
|
|
|
@ -919,9 +919,9 @@ func TestMandatoryAnnotations(t *testing.T) {
|
||||||
|
|
||||||
destConfig.Log.Output = logFile.Name()
|
destConfig.Log.Output = logFile.Name()
|
||||||
|
|
||||||
lintEnabled := true
|
lintEnable := true
|
||||||
destConfig.Extensions.Lint = &extconf.LintConfig{}
|
destConfig.Extensions.Lint = &extconf.LintConfig{}
|
||||||
destConfig.Extensions.Lint.Enabled = &lintEnabled
|
destConfig.Extensions.Lint.Enable = &lintEnable
|
||||||
destConfig.Extensions.Lint.MandatoryAnnotations = []string{"annot1", "annot2", "annot3"}
|
destConfig.Extensions.Lint.MandatoryAnnotations = []string{"annot1", "annot2", "annot3"}
|
||||||
|
|
||||||
dctlr := api.NewController(destConfig)
|
dctlr := api.NewController(destConfig)
|
||||||
|
|
|
@ -31,7 +31,7 @@ function setup_file() {
|
||||||
"enable": "true"
|
"enable": "true"
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"enabled": "true",
|
"enable": "true",
|
||||||
"mandatoryAnnotations": ["org.opencontainers.image.licenses", "org.opencontainers.image.vendor"]
|
"mandatoryAnnotations": ["org.opencontainers.image.licenses", "org.opencontainers.image.vendor"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue