From 8db83e63a30d04879e9a42bdfde2bb32050e87d2 Mon Sep 17 00:00:00 2001 From: Artur Ribeiro Date: Tue, 9 Jan 2024 14:39:36 +0000 Subject: [PATCH 1/2] fix(e2e): sort paths related to the e2e --- .../e2e-cli-069_ignore_experimental_query.go | 25 +++++++++++++------ ...e-cli-070_not_ignore_experimental_query.go | 12 ++++++++- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go b/e2e/testcases/e2e-cli-069_ignore_experimental_query.go index b930126d359..1b87253290b 100644 --- a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go +++ b/e2e/testcases/e2e-cli-069_ignore_experimental_query.go @@ -1,24 +1,35 @@ package testcases -// E2E-CLI-069 - KICS scan and ignore experimental queries -// should perform the scan successfully and return exit code 40 +import ( + "sort" +) + +// E2E-CLI-070 - KICS scan and not ignore experimental queries +// should perform the scan successfully and return exit code 40 and 50 func init() { //nolint + samplePath := "/path/test/fixtures/experimental_test/sample" + queriesPath := "/path/test/fixtures/experimental_test/queries" + + paths := []string{samplePath, queriesPath} + sort.Strings(paths) + testSample := TestCase{ - Name: "should perform a valid scan and ignore the experimental queries [E2E-CLI-069]", + Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-070]", Args: args{ Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_069_RESULT", - "-p", "\"/path/test/fixtures/experimental_test/sample\"", "-q", "\"/path/test/fixtures/experimental_test/queries\"", + []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT", + "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", + "--experimental-queries", }, }, ExpectedResult: []ResultsValidation{ { - ResultsFile: "E2E_CLI_069_RESULT", + ResultsFile: "E2E_CLI_070_RESULT", ResultsFormats: []string{"json"}, }, }, }, - WantStatus: []int{40}, + WantStatus: []int{50}, } Tests = append(Tests, testSample) diff --git a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go b/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go index 1dd2bc64d4a..1b87253290b 100644 --- a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go +++ b/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go @@ -1,14 +1,24 @@ package testcases +import ( + "sort" +) + // E2E-CLI-070 - KICS scan and not ignore experimental queries // should perform the scan successfully and return exit code 40 and 50 func init() { //nolint + samplePath := "/path/test/fixtures/experimental_test/sample" + queriesPath := "/path/test/fixtures/experimental_test/queries" + + paths := []string{samplePath, queriesPath} + sort.Strings(paths) + testSample := TestCase{ Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-070]", Args: args{ Args: []cmdArgs{ []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT", - "-p", "\"/path/test/fixtures/experimental_test/sample\"", "-q", "\"/path/test/fixtures/experimental_test/queries\"", + "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", "--experimental-queries", }, }, From 4abe51d5a0125bc68d53e4a22f5809e8f7a4293b Mon Sep 17 00:00:00 2001 From: Artur Ribeiro Date: Tue, 9 Jan 2024 15:27:37 +0000 Subject: [PATCH 2/2] fix sort paths related to the e2e --- .../e2e-cli-069_ignore_experimental_query.go | 15 +++++++-------- .../e2e-cli-070_not_ignore_experimental_query.go | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go b/e2e/testcases/e2e-cli-069_ignore_experimental_query.go index 1b87253290b..908fc6bec38 100644 --- a/e2e/testcases/e2e-cli-069_ignore_experimental_query.go +++ b/e2e/testcases/e2e-cli-069_ignore_experimental_query.go @@ -1,11 +1,11 @@ package testcases +// E2E-CLI-069 - KICS scan and ignore experimental queries +// should perform the scan successfully and return exit code 40 import ( "sort" ) -// E2E-CLI-070 - KICS scan and not ignore experimental queries -// should perform the scan successfully and return exit code 40 and 50 func init() { //nolint samplePath := "/path/test/fixtures/experimental_test/sample" queriesPath := "/path/test/fixtures/experimental_test/queries" @@ -14,22 +14,21 @@ func init() { //nolint sort.Strings(paths) testSample := TestCase{ - Name: "should perform a valid scan and not ignore the experimental queries [E2E-CLI-070]", + Name: "should perform a valid scan and ignore the experimental queries [E2E-CLI-069]", Args: args{ Args: []cmdArgs{ - []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT", - "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", - "--experimental-queries", + []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_069_RESULT", + "-p", "\"" + paths[1] + "\"", "-q", "\"" + paths[0] + "\"", }, }, ExpectedResult: []ResultsValidation{ { - ResultsFile: "E2E_CLI_070_RESULT", + ResultsFile: "E2E_CLI_069_RESULT", ResultsFormats: []string{"json"}, }, }, }, - WantStatus: []int{50}, + WantStatus: []int{40}, } Tests = append(Tests, testSample) diff --git a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go b/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go index 1b87253290b..e12dc88a121 100644 --- a/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go +++ b/e2e/testcases/e2e-cli-070_not_ignore_experimental_query.go @@ -18,7 +18,7 @@ func init() { //nolint Args: args{ Args: []cmdArgs{ []string{"scan", "-o", "/path/e2e/output", "--output-name", "E2E_CLI_070_RESULT", - "-p", "\"" + paths[0] + "\"", "-q", "\"" + paths[1] + "\"", + "-p", "\"" + paths[1] + "\"", "-q", "\"" + paths[0] + "\"", "--experimental-queries", }, },