Skip to content

Commit

Permalink
Add negative test for ovf wrong depth
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy committed Nov 15, 2023
1 parent b389d7f commit 980b0fc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cmd/ova-provider-server/nfs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
)

func TestFindOVAFiles(t *testing.T) {
//nolint:all
g := NewGomegaWithT(t)

tests := []struct {
Expand Down Expand Up @@ -52,7 +53,7 @@ func TestFindOVAFiles(t *testing.T) {
expectError: false,
},
{
name: "incorrect depth",
name: "incorrect depth ova",
setup: func(directory string) {
os.MkdirAll(filepath.Join(directory, "subdir1", "subdir2"), 0755)
ioutil.WriteFile(filepath.Join(directory, "subdir1", "subdir2", "test3.ova"), []byte{}, 0644)
Expand All @@ -61,6 +62,16 @@ func TestFindOVAFiles(t *testing.T) {
expectedOVFs: nil,
expectError: false,
},
{
name: "incorrect depth ovf",
setup: func(directory string) {
os.MkdirAll(filepath.Join(directory, "subdir1", "subdir2", "subdir3"), 0755)

Check failure on line 68 in cmd/ova-provider-server/nfs_test.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `os.MkdirAll` is not checked (errcheck)
ioutil.WriteFile(filepath.Join(directory, "subdir1", "subdir2", "subdir3", "test3.ovf"), []byte{}, 0644)

Check failure on line 69 in cmd/ova-provider-server/nfs_test.go

View workflow job for this annotation

GitHub Actions / lint

Error return value of `ioutil.WriteFile` is not checked (errcheck)
},
expectedOVAs: nil,
expectedOVFs: nil,
expectError: false,
},
{
name: "folder with extension",
setup: func(directory string) {
Expand Down

0 comments on commit 980b0fc

Please sign in to comment.