mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 04:17:55 +08:00
test(refactor): refactor tests that use zot-test to use smaller images (#1690)
Signed-off-by: Laurentiu Niculae <niculae.laurentiu1@gmail.com>
This commit is contained in:
@@ -40,7 +40,7 @@ func TestGetExensionsDisabled(t *testing.T) {
|
||||
conf.Log.Output = logFile.Name()
|
||||
defer os.Remove(logFile.Name()) // clean up
|
||||
|
||||
ctlr := makeController(conf, t.TempDir(), "")
|
||||
ctlr := makeController(conf, t.TempDir())
|
||||
|
||||
cm := test.NewControllerManager(ctlr)
|
||||
cm.StartAndWait(port)
|
||||
@@ -58,12 +58,8 @@ func TestGetExensionsDisabled(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
func makeController(conf *config.Config, dir string, copyTestDataDest string) *api.Controller {
|
||||
func makeController(conf *config.Config, dir string) *api.Controller {
|
||||
ctlr := api.NewController(conf)
|
||||
|
||||
if copyTestDataDest != "" {
|
||||
test.CopyTestFiles(copyTestDataDest, dir)
|
||||
}
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
return ctlr
|
||||
|
||||
@@ -54,8 +54,10 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -99,8 +101,10 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -145,7 +149,9 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -196,7 +202,9 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -282,7 +290,9 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -367,7 +377,9 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
ctlr.Config.Storage.RootDirectory = dir
|
||||
|
||||
@@ -416,7 +428,9 @@ func TestVerifyMandatoryAnnotations(t *testing.T) {
|
||||
ctlr := api.NewController(conf)
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
files, err := os.ReadDir(dir)
|
||||
So(err, ShouldBeNil)
|
||||
@@ -469,7 +483,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
|
||||
@@ -499,7 +515,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
|
||||
@@ -529,7 +547,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
buf, err := os.ReadFile(path.Join(dir, "zot-test", "index.json"))
|
||||
@@ -590,7 +610,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
buf, err := os.ReadFile(path.Join(dir, "zot-test", "index.json"))
|
||||
@@ -650,7 +672,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
buf, err := os.ReadFile(path.Join(dir, "zot-test", "index.json"))
|
||||
@@ -712,7 +736,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
buf, err := os.ReadFile(path.Join(dir, "zot-test", "index.json"))
|
||||
@@ -783,7 +809,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", dir)
|
||||
testStoreCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateRandomImage(), "zot-test", "0.0.1", testStoreCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
var index ispec.Index
|
||||
buf, err := os.ReadFile(path.Join(dir, "zot-test", "index.json"))
|
||||
@@ -867,5 +895,9 @@ func TestVerifyMandatoryAnnotationsFunction(t *testing.T) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
pass, err = linter.CheckMandatoryAnnotations("zot-test", digest, imgStore)
|
||||
So(err, ShouldBeNil)
|
||||
So(pass, ShouldBeTrue)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ package monitoring_test
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"path"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -55,7 +54,10 @@ func TestExtensionMetrics(t *testing.T) {
|
||||
monitoring.IncDownloadCounter(ctlr.Metrics, "alpine")
|
||||
monitoring.IncUploadCounter(ctlr.Metrics, "alpine")
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(rootDir, "alpine"))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(rootDir, ctlr.Log)
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "alpine", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
monitoring.SetStorageUsage(ctlr.Metrics, rootDir, "alpine")
|
||||
|
||||
monitoring.ObserveStorageLockLatency(ctlr.Metrics, time.Millisecond, rootDir, "RWLock")
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
godigest "github.com/opencontainers/go-digest"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
|
||||
"zotregistry.io/zot/pkg/api"
|
||||
@@ -62,7 +61,9 @@ func TestScrubExtension(t *testing.T) {
|
||||
|
||||
ctlr := api.NewController(conf)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
cm := test.NewControllerManager(ctlr)
|
||||
cm.StartAndWait(port)
|
||||
@@ -104,9 +105,12 @@ func TestScrubExtension(t *testing.T) {
|
||||
|
||||
ctlr := api.NewController(conf)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
var manifestDigest godigest.Digest
|
||||
manifestDigest, _, _ = test.GetOciLayoutDigests("../../../test/data/zot-test")
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
image := test.CreateDefaultVulnerableImage()
|
||||
err = test.WriteImageToFileSystem(image, repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
manifestDigest := image.ManifestDescriptor.Digest
|
||||
|
||||
err = os.Remove(path.Join(dir, repoName, "blobs/sha256", manifestDigest.Encoded()))
|
||||
if err != nil {
|
||||
@@ -153,7 +157,11 @@ func TestScrubExtension(t *testing.T) {
|
||||
|
||||
ctlr := api.NewController(conf)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
image := test.CreateDefaultVulnerableImage()
|
||||
|
||||
err = test.WriteImageToFileSystem(image, repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(os.Chmod(path.Join(dir, repoName), 0o000), ShouldBeNil)
|
||||
|
||||
@@ -193,7 +201,11 @@ func TestRunScrubRepo(t *testing.T) {
|
||||
imgStore := local.NewImageStore(dir, true, 1*time.Second, true,
|
||||
true, log, metrics, nil, cacheDriver)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log)
|
||||
image := test.CreateDefaultVulnerableImage()
|
||||
|
||||
err = test.WriteImageToFileSystem(image, repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = scrub.RunScrubRepo(imgStore, repoName, log)
|
||||
So(err, ShouldBeNil)
|
||||
@@ -225,9 +237,13 @@ func TestRunScrubRepo(t *testing.T) {
|
||||
imgStore := local.NewImageStore(dir, true, 1*time.Second, true,
|
||||
true, log, metrics, nil, cacheDriver)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
var manifestDigest godigest.Digest
|
||||
manifestDigest, _, _ = test.GetOciLayoutDigests("../../../test/data/zot-test")
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log)
|
||||
image := test.CreateDefaultVulnerableImage()
|
||||
|
||||
err = test.WriteImageToFileSystem(image, repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
manifestDigest := image.ManifestDescriptor.Digest
|
||||
|
||||
err = os.Remove(path.Join(dir, repoName, "blobs/sha256", manifestDigest.Encoded()))
|
||||
if err != nil {
|
||||
@@ -264,7 +280,11 @@ func TestRunScrubRepo(t *testing.T) {
|
||||
true, true, log, metrics, nil, cacheDriver,
|
||||
)
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, repoName))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log)
|
||||
image := test.CreateDefaultVulnerableImage()
|
||||
|
||||
err = test.WriteImageToFileSystem(image, repoName, "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
So(os.Chmod(path.Join(dir, repoName), 0o000), ShouldBeNil)
|
||||
|
||||
|
||||
@@ -88,7 +88,14 @@ func testSetup(t *testing.T) (string, error) {
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = CopyFiles("../../../../test/data", dir)
|
||||
testStorageCtrl := GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
|
||||
err = WriteImageToFileSystem(CreateRandomVulnerableImage(), "zot-test", "0.0.1", testStorageCtrl)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
err = WriteImageToFileSystem(CreateRandomVulnerableImage(), "zot-cve-test", "0.0.1", testStorageCtrl)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -180,7 +180,8 @@ func TestTrivyLibraryErrors(t *testing.T) {
|
||||
// Create temporary directory
|
||||
rootDir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../../../../test/data/zot-test", path.Join(rootDir, "zot-test"))
|
||||
storageCtlr := test.GetDefaultStoreController(rootDir, log.NewLogger("debug", ""))
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-test", "0.0.1", storageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
log := log.NewLogger("debug", "")
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package trivy_test
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -24,6 +25,45 @@ import (
|
||||
"zotregistry.io/zot/pkg/test/mocks"
|
||||
)
|
||||
|
||||
func TestScanBigTestFile(t *testing.T) {
|
||||
Convey("Scan zot-test", t, func() {
|
||||
projRootDir, err := test.GetProjectRootDir()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
testImage := filepath.Join(projRootDir, "test/data/zot-test")
|
||||
|
||||
tempDir := t.TempDir()
|
||||
port := test.GetFreePort()
|
||||
conf := config.New()
|
||||
conf.HTTP.Port = port
|
||||
defaultVal := true
|
||||
conf.Storage.RootDirectory = tempDir
|
||||
conf.Extensions = &extconf.ExtensionConfig{
|
||||
Search: &extconf.SearchConfig{
|
||||
BaseConfig: extconf.BaseConfig{Enable: &defaultVal},
|
||||
},
|
||||
}
|
||||
ctlr := api.NewController(conf)
|
||||
So(ctlr, ShouldNotBeNil)
|
||||
|
||||
err = test.CopyFiles(testImage, filepath.Join(tempDir, "zot-test"))
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
cm := test.NewControllerManager(ctlr)
|
||||
cm.StartAndWait(port)
|
||||
defer cm.StopServer()
|
||||
// scan
|
||||
scanner := trivy.NewScanner(ctlr.StoreController, ctlr.MetaDB, "ghcr.io/project-zot/trivy-db", "", ctlr.Log)
|
||||
|
||||
err = scanner.UpdateDB()
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
cveMap, err := scanner.ScanImage("zot-test:0.0.1")
|
||||
So(err, ShouldBeNil)
|
||||
So(cveMap, ShouldNotBeNil)
|
||||
})
|
||||
}
|
||||
|
||||
func TestScanningByDigest(t *testing.T) {
|
||||
Convey("Scan the individual manifests inside an index", t, func() {
|
||||
// start server
|
||||
@@ -46,7 +86,7 @@ func TestScanningByDigest(t *testing.T) {
|
||||
cm.StartAndWait(port)
|
||||
defer cm.StopServer()
|
||||
// push index with 2 manifests: one with vulns and one without
|
||||
vulnImage := test.CreateVulnerableImage()
|
||||
vulnImage := test.CreateDefaultVulnerableImage()
|
||||
|
||||
simpleImage := test.CreateRandomImage()
|
||||
|
||||
|
||||
@@ -448,7 +448,10 @@ func TestConvertDockerToOCI(t *testing.T) {
|
||||
Convey("test converting docker to oci functions", t, func() {
|
||||
dir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data/zot-test", path.Join(dir, "zot-test"))
|
||||
srcStorageCtlr := test.GetDefaultStoreController(dir, log.NewLogger("debug", ""))
|
||||
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
imageRef, err := layout.NewReference(path.Join(dir, "zot-test"), "0.0.1")
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
@@ -42,6 +42,7 @@ import (
|
||||
extconf "zotregistry.io/zot/pkg/extensions/config"
|
||||
syncconf "zotregistry.io/zot/pkg/extensions/config/sync"
|
||||
"zotregistry.io/zot/pkg/extensions/sync"
|
||||
"zotregistry.io/zot/pkg/log"
|
||||
"zotregistry.io/zot/pkg/meta/signatures"
|
||||
mTypes "zotregistry.io/zot/pkg/meta/types"
|
||||
storageConstants "zotregistry.io/zot/pkg/storage/constants"
|
||||
@@ -134,8 +135,17 @@ func makeUpstreamServer(
|
||||
srcConfig.Storage.GC = false
|
||||
|
||||
srcDir := t.TempDir()
|
||||
srcStorageCtrl := test.GetDefaultStoreController(srcDir, log.NewLogger("debug", ""))
|
||||
|
||||
test.CopyTestFiles("../../../test/data", srcDir)
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtrl)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", srcStorageCtrl)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
srcConfig.Storage.RootDirectory = srcDir
|
||||
|
||||
@@ -3045,8 +3055,13 @@ func TestSubPaths(t *testing.T) {
|
||||
srcDir := t.TempDir()
|
||||
|
||||
subpath := "/subpath"
|
||||
srcStorageCtlr := test.GetDefaultStoreController(path.Join(srcDir, subpath), log.NewLogger("debug", ""))
|
||||
|
||||
test.CopyTestFiles("../../../test/data", path.Join(srcDir, subpath))
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
srcConfig.Storage.RootDirectory = srcDir
|
||||
|
||||
@@ -4514,7 +4529,13 @@ func TestOnDemandRetryGoroutine(t *testing.T) {
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", srcDir)
|
||||
srcStorageCtlr := test.GetDefaultStoreController(srcDir, log.NewLogger("debug", ""))
|
||||
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
srcConfig.Storage.RootDirectory = srcDir
|
||||
|
||||
@@ -4721,7 +4742,13 @@ func TestOnDemandMultipleImage(t *testing.T) {
|
||||
|
||||
srcDir := t.TempDir()
|
||||
|
||||
test.CopyTestFiles("../../../test/data", srcDir)
|
||||
srcStorageCtlr := test.GetDefaultStoreController(srcDir, log.NewLogger("debug", ""))
|
||||
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
srcConfig.Storage.RootDirectory = srcDir
|
||||
|
||||
@@ -5363,7 +5390,13 @@ func TestSyncOnlyDiff(t *testing.T) {
|
||||
destDir := t.TempDir()
|
||||
|
||||
// copy images so we have them before syncing, sync should not pull them again
|
||||
test.CopyTestFiles("../../../test/data", destDir)
|
||||
destStorageCtrl := test.GetDefaultStoreController(destDir, log.NewLogger("debug", ""))
|
||||
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", destStorageCtrl)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", destStorageCtrl)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
destConfig.Storage.RootDirectory = destDir
|
||||
destConfig.Storage.Dedupe = false
|
||||
@@ -5443,7 +5476,13 @@ func TestSyncWithDiffDigest(t *testing.T) {
|
||||
destDir := t.TempDir()
|
||||
|
||||
// copy images so we have them before syncing, sync should not pull them again
|
||||
test.CopyTestFiles("../../../test/data", destDir)
|
||||
srcStorageCtlr := test.GetDefaultStoreController(destDir, log.NewLogger("debug", ""))
|
||||
|
||||
err := test.WriteImageToFileSystem(test.CreateDefaultImage(), "zot-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = test.WriteImageToFileSystem(test.CreateDefaultVulnerableImage(), "zot-cve-test", "0.0.1", srcStorageCtlr)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
destConfig.Storage.RootDirectory = destDir
|
||||
destConfig.Storage.Dedupe = false
|
||||
|
||||
Reference in New Issue
Block a user