mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
zot: initial commit
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
package storage_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/anuvu/zot/pkg/storage"
|
||||
"github.com/rs/zerolog"
|
||||
. "github.com/smartystreets/goconvey/convey"
|
||||
)
|
||||
|
||||
func TestRepoLayout(t *testing.T) {
|
||||
dir, err := ioutil.TempDir("", "oci-repo-test")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer os.RemoveAll(dir)
|
||||
|
||||
il := storage.NewImageStore(dir, zerolog.New(os.Stdout))
|
||||
|
||||
Convey("Repo layout", t, func(c C) {
|
||||
repoName := "test"
|
||||
|
||||
Convey("Validate repo without initialization", func() {
|
||||
v, err := il.ValidateRepo(repoName)
|
||||
So(v, ShouldEqual, false)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Initialize repo", func() {
|
||||
err := il.InitRepo(repoName)
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
|
||||
Convey("Validate repo", func() {
|
||||
v, err := il.ValidateRepo(repoName)
|
||||
So(v, ShouldEqual, true)
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
|
||||
Convey("Validate all repos", func() {
|
||||
v, err := il.Validate()
|
||||
So(v, ShouldEqual, true)
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user