0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2025-01-06 22:40:28 -05:00
zot/pkg/storage/storage_test.go
2019-08-29 13:47:59 -07:00

42 lines
830 B
Go

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)
})
})
}