mirror of
https://github.com/kubescape/kubescape.git
synced 2026-04-15 06:58:11 +00:00
Merge pull request #1493 from mohaidoss/fix-download-artifacts
Fix for Kubescape Reading Policies from Local File
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user