mirror of
https://github.com/project-zot/zot.git
synced 2026-06-15 20:07:55 +08:00
pkg/storage: fix partially initialized repo storage
Thanks shimish2 for the unit test. Signed-off-by: Ramkumar Chinchani <rchincha@cisco.com>
This commit is contained in:
committed by
Ramkumar Chinchani
parent
53b5fa6493
commit
63b88d0e57
@@ -523,6 +523,21 @@ func TestNegativeCases(t *testing.T) {
|
||||
err = il.InitRepo("test")
|
||||
So(err, ShouldNotBeNil)
|
||||
}
|
||||
|
||||
err = os.Chmod(dir, 0755)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
// Init repo should fail if repo is a file.
|
||||
err = ioutil.WriteFile(path.Join(dir, "file-test"), []byte("this is test file"), 0755) // nolint:gosec
|
||||
So(err, ShouldBeNil)
|
||||
err = il.InitRepo("file-test")
|
||||
So(err, ShouldNotBeNil)
|
||||
|
||||
err = os.Mkdir(path.Join(dir, "test-dir"), 0755)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
err = il.InitRepo("test-dir")
|
||||
So(err, ShouldBeNil)
|
||||
})
|
||||
|
||||
Convey("Invalid validate repo", t, func(c C) {
|
||||
|
||||
Reference in New Issue
Block a user