Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(filesystem): GetExcludedPaths #5288

Merged
merged 4 commits into from
May 2, 2022
Merged
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
13 changes: 7 additions & 6 deletions e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ The purpose of this docs is to describe KICS' E2E test suite

## Getting Started

Before Running the tests, you must start the script server (NodeJS) and keep it running.
Before running the tests, you must start the script server (NodeJS) and keep it running.
_Note: If you don't run this script, only the tests "031" and "052" must fail._

- Before running tests:
```bash
cd kics_repository_folder/github/scripts/server-mock
cd kics_repository_folder/.github/scripts/server-mock
npm install
npm start
```
Expand Down Expand Up @@ -39,7 +39,8 @@ Prepare
```bash
cd kics_repository_folder
go mod vendor
docker build -t kics:e2e-tests -f .\Dockerfile .
LINUX/MAC: docker build -t kics:e2e-tests -f ./Dockerfile .
WINDOWS: docker build -t kics:e2e-tests -f .\Dockerfile .
```

Run (linux/mac/bash):
Expand Down Expand Up @@ -206,7 +207,7 @@ In this case, the validation function will receive the log file data as its inpu

The example below generates an output file called: <i>"E2E_CLI_038_LOG"</i> and creates a validation function expecting 3 matches in the generated log file content.

In addition, it is necessary to remove files generated during the test, adding them to `removeFiles` (required only for test cases that generates files from results/payloads/logs).
In addition, it is necessary to remove files generated during the test, adding them to `removeFiles` (required only for test cases that generate files from results/payloads/logs).

```go
// E2E-CLI-038 - KICS scan command with --log-path
Expand Down Expand Up @@ -255,10 +256,10 @@ func Test_E2E_CLI(t *testing.T) {

<b>runCommand:</b> This function is intended to run kics with the input arguments sent by the test

<b>readFixture & readFile:</b> These functions reads a file (from its folder and name). The folders used are always: fixtures or output.
<b>readFixture & readFile:</b> These functions read a file (from its folder and name). The folders used are always: fixtures or output.

<b>prepareExpected:</b> This function prepares the file to be compared, avoiding errors in reading and formatting.

<b>checkLine & checkJSONLog:</b> These functions are used to check the Kics output generated in the CLI and compare it with the <b>expectedOutput</b> file.

<b>fileCheck & setFields:</b> TThese functions read and compare the expected files with the files provided during the test. This function compares files from <b>expectedPayload</b> and <b>expectedResult</b>.
<b>fileCheck & setFields:</b> These functions read and compare the expected files with the files provided during the test. This function compares files from <b>expectedPayload</b> and <b>expectedResult</b>.
3 changes: 2 additions & 1 deletion pkg/engine/provider/filesystem.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ func GetExcludePaths(pathExpressions string) ([]string, error) {
if strings.ContainsAny(pathExpressions, "*?[") {
info, err := filepath.Glob(pathExpressions)
if err != nil {
return nil, errors.Wrap(err, "failed to open excluded file")
log.Error().Msgf("failed to get exclude path %s: %s", pathExpressions, err)
return []string{pathExpressions}, nil
}
return info, nil
}
Expand Down