refactor: Cleanup/simplify testcases in /pkg/extensions (#1116)

Signed-off-by: Nicol Draghici <idraghic@cisco.com>

fix: Increase coverage when copying files

Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
Nicol
2023-01-19 18:54:05 +02:00
committed by GitHub
parent b997176363
commit 70a60b4660
12 changed files with 224 additions and 719 deletions
+7
View File
@@ -179,6 +179,13 @@ func CopyFiles(sourceDir, destDir string) error {
return nil
}
func CopyTestFiles(sourceDir, destDir string) {
err := CopyFiles(sourceDir, destDir)
if err != nil {
panic(err)
}
}
type Controller interface {
Run(ctx context.Context) error
Shutdown()
+3
View File
@@ -113,6 +113,9 @@ func TestCopyFiles(t *testing.T) {
_, err = os.Stat(path.Join(dstDir, "test-index", "index.json"))
So(err, ShouldBeNil)
})
Convey("panic when sourceDir does not exist", t, func() {
So(func() { test.CopyTestFiles("/path/to/some/unexisting/directory", os.TempDir()) }, ShouldPanic)
})
}
func TestGetOciLayoutDigests(t *testing.T) {