From 0ca083ee3565868dd59faa74a9c34656ba355d13 Mon Sep 17 00:00:00 2001 From: Rafaela Soares Date: Mon, 2 May 2022 09:02:04 +0100 Subject: [PATCH 1/4] Update README.md --- e2e/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/e2e/README.md b/e2e/README.md index 7d62a86ecdc..1c5dc0fc170 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -9,7 +9,7 @@ _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 ``` @@ -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): @@ -261,4 +262,4 @@ func Test_E2E_CLI(t *testing.T) { checkLine & checkJSONLog: These functions are used to check the Kics output generated in the CLI and compare it with the expectedOutput file. -fileCheck & setFields: TThese functions read and compare the expected files with the files provided during the test. This function compares files from expectedPayload and expectedResult. \ No newline at end of file +fileCheck & setFields: TThese functions read and compare the expected files with the files provided during the test. This function compares files from expectedPayload and expectedResult. From 6b8a55973490c02dd78c921e6107ddf1c618f6fc Mon Sep 17 00:00:00 2001 From: Rafaela Soares Date: Mon, 2 May 2022 09:06:23 +0100 Subject: [PATCH 2/4] Update README.md --- e2e/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/e2e/README.md b/e2e/README.md index 1c5dc0fc170..2738c3ba734 100644 --- a/e2e/README.md +++ b/e2e/README.md @@ -4,7 +4,7 @@ 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: @@ -207,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: "E2E_CLI_038_LOG" 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 @@ -256,10 +256,10 @@ func Test_E2E_CLI(t *testing.T) { runCommand: This function is intended to run kics with the input arguments sent by the test -readFixture & readFile: These functions reads a file (from its folder and name). The folders used are always: fixtures or output. +readFixture & readFile: These functions read a file (from its folder and name). The folders used are always: fixtures or output. prepareExpected: This function prepares the file to be compared, avoiding errors in reading and formatting. checkLine & checkJSONLog: These functions are used to check the Kics output generated in the CLI and compare it with the expectedOutput file. -fileCheck & setFields: TThese functions read and compare the expected files with the files provided during the test. This function compares files from expectedPayload and expectedResult. +fileCheck & setFields: These functions read and compare the expected files with the files provided during the test. This function compares files from expectedPayload and expectedResult. From 0f6d23259d016c8d8a781b523473ef3fa7121586 Mon Sep 17 00:00:00 2001 From: rafaela-soares Date: Mon, 2 May 2022 10:40:01 +0100 Subject: [PATCH 3/4] fixed GetExcludePaths --- pkg/engine/provider/filesystem.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/engine/provider/filesystem.go b/pkg/engine/provider/filesystem.go index ae8dcee939d..ff071fb9cd5 100644 --- a/pkg/engine/provider/filesystem.go +++ b/pkg/engine/provider/filesystem.go @@ -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 glob expression %s: %s", pathExpressions, err) + return []string{pathExpressions}, nil } return info, nil } From 587d40ed608364ef923fac56c8f540a6e74b4ac3 Mon Sep 17 00:00:00 2001 From: rafaela-soares Date: Mon, 2 May 2022 10:44:31 +0100 Subject: [PATCH 4/4] correcting log msg --- pkg/engine/provider/filesystem.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/engine/provider/filesystem.go b/pkg/engine/provider/filesystem.go index ff071fb9cd5..0b1a7116f23 100644 --- a/pkg/engine/provider/filesystem.go +++ b/pkg/engine/provider/filesystem.go @@ -71,7 +71,7 @@ func GetExcludePaths(pathExpressions string) ([]string, error) { if strings.ContainsAny(pathExpressions, "*?[") { info, err := filepath.Glob(pathExpressions) if err != nil { - log.Error().Msgf("failed to glob expression %s: %s", pathExpressions, err) + log.Error().Msgf("failed to get exclude path %s: %s", pathExpressions, err) return []string{pathExpressions}, nil } return info, nil