Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions pkg/splunk/enterprise/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,6 +553,9 @@ func createAppDownloadDir(ctx context.Context, path string) error {
scopedLog.Error(errDir, "Unable to create directory at path")
return errDir
}
} else if err != nil {
scopedLog.Error(err, "Unable to access path")
return err
}
return nil
}
Expand Down
9 changes: 8 additions & 1 deletion pkg/splunk/enterprise/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

//"io"
"os"
"path/filepath"
"strconv"
"strings"
"testing"
Expand Down Expand Up @@ -1196,7 +1197,13 @@ func TestCreateAppDownloadDir(t *testing.T) {
t.Errorf("Didn't expect error")
}

err = createAppDownloadDir(ctx, "/xyzzz.txt")
blockerFile, err := os.CreateTemp(t.TempDir(), "app-download-dir-blocker")
if err != nil {
t.Fatalf("failed to create blocker file: %v", err)
}
defer blockerFile.Close()

err = createAppDownloadDir(ctx, filepath.Join(blockerFile.Name(), "child"))
if err == nil {
t.Errorf("Expected error")
}
Expand Down
Loading