Merge pull request #1493 from mohaidoss/fix-download-artifacts

Fix for Kubescape Reading Policies from Local File
This commit is contained in:
Matthias Bertschy
2023-11-23 12:56:54 +01:00
committed by GitHub
3 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ var (
ErrNameRequired = errors.New("missing required input framework name")
ErrIDRequired = errors.New("missing required input control ID")
ErrFrameworkNotMatching = errors.New("framework from file not matching")
ErrControlNotMatching = errors.New("framework from file not matching")
ErrControlNotMatching = errors.New("control from file not matching")
)
var (
+1 -1
View File
@@ -240,7 +240,7 @@ func getDownloadReleasedPolicy(ctx context.Context, downloadReleasedPolicy *gett
func getDefaultFrameworksPaths() []string {
fwPaths := []string{}
for i := range getter.NativeFrameworks {
fwPaths = append(fwPaths, getter.GetDefaultPath(getter.NativeFrameworks[i]))
fwPaths = append(fwPaths, getter.GetDefaultPath(getter.NativeFrameworks[i]+".json")) // GetDefaultPath expects a filename, not just the framework name
}
return fwPaths
}
+11
View File
@@ -3,6 +3,7 @@ package core
import (
"context"
"reflect"
"strings"
"testing"
"github.com/kubescape/go-logger"
@@ -229,3 +230,13 @@ func TestIsScanTypeForSubmission(t *testing.T) {
})
}
}
func TestGetDefaultFrameworksPaths(t *testing.T) {
result := getDefaultFrameworksPaths()
assert.NotEmpty(t, result)
for _, path := range result {
assert.NotEmpty(t, path)
assert.True(t, strings.HasSuffix(path, ".json"))
}
}