mirror of
https://github.com/project-zot/zot.git
synced 2026-06-16 12:28:01 +08:00
test(refactor): cleanup/simplify testcases (#1124)
Signed-off-by: Nicol Draghici <idraghic@cisco.com>
This commit is contained in:
@@ -85,9 +85,7 @@ func TestTLSWithAuth(t *testing.T) {
|
||||
|
||||
home := os.Getenv("HOME")
|
||||
destCertsDir := filepath.Join(home, certsDir1)
|
||||
if err = test.CopyFiles(sourceCertsDir, destCertsDir); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles(sourceCertsDir, destCertsDir)
|
||||
defer os.RemoveAll(destCertsDir)
|
||||
|
||||
args := []string{"imagetest", "--name", "dummyImageName", "--url", HOST1}
|
||||
@@ -167,9 +165,7 @@ func TestTLSWithoutAuth(t *testing.T) {
|
||||
|
||||
home := os.Getenv("HOME")
|
||||
destCertsDir := filepath.Join(home, certsDir1)
|
||||
if err = test.CopyFiles(sourceCertsDir, destCertsDir); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles(sourceCertsDir, destCertsDir)
|
||||
defer os.RemoveAll(destCertsDir)
|
||||
|
||||
args := []string{"imagetest"}
|
||||
|
||||
+5
-17
@@ -352,10 +352,7 @@ func TestServerCVEResponseGQL(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
|
||||
conf.Storage.RootDirectory = dir
|
||||
trivyConfig := &extconf.TrivyConfig{
|
||||
@@ -645,10 +642,7 @@ func TestNegativeServerResponse(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
|
||||
conf.Storage.RootDirectory = dir
|
||||
trivyConfig := &extconf.TrivyConfig{
|
||||
@@ -731,12 +725,9 @@ func TestNegativeServerResponse(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
|
||||
err = os.RemoveAll(path.Join(dir, "zot-cve-test/blobs"))
|
||||
err := os.RemoveAll(path.Join(dir, "zot-cve-test/blobs"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -818,10 +809,7 @@ func TestServerCVEResponse(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles("../../test/data/zot-cve-test", path.Join(dir, "zot-cve-test"))
|
||||
|
||||
conf.Storage.RootDirectory = dir
|
||||
trivyConfig := &extconf.TrivyConfig{
|
||||
|
||||
@@ -1284,12 +1284,9 @@ func TestServerResponseGQLWithoutPermissions(t *testing.T) {
|
||||
|
||||
dir := t.TempDir()
|
||||
|
||||
err := test.CopyFiles("../../test/data/zot-test", path.Join(dir, "zot-test"))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
test.CopyTestFiles("../../test/data/zot-test", path.Join(dir, "zot-test"))
|
||||
|
||||
err = os.Chmod(path.Join(dir, "zot-test", "blobs"), 0o000)
|
||||
err := os.Chmod(path.Join(dir, "zot-test", "blobs"), 0o000)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user