-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(inspector): fix timeout secrets inspector (#5419)
* fix timeout Signed-off-by: joaorufi <[email protected]> * Feat(e2e): adding e2e tests for timeout flag * Fix(e2e): updating config validation in e2e tests * Fix(e2e): moving testing configs to configs folder Co-authored-by: Lucas Mendes <[email protected]>
- Loading branch information
Showing
8 changed files
with
41 additions
and
5 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
path: fixtures/samples/positive.dockerfile | ||
queries-path: ../assets/queries | ||
timeout: 12 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
path: /path/e2e/fixtures/samples/positive.dockerfile | ||
queries-path: /path/assets/queries | ||
timeout: 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package testcases | ||
|
||
import ( | ||
"regexp" | ||
) | ||
|
||
// E2E-CLI-056 - Kics scan command with timeout flag | ||
// should stop a query execution when reaching the provided timeout (seconds) | ||
func init() { //nolint | ||
testSample := TestCase{ | ||
Name: "should timeout queries when reaching the timeout limit [E2E-CLI-056]", | ||
Args: args{ | ||
Args: []cmdArgs{ | ||
[]string{"scan", "--config", "/path/e2e/fixtures/samples/configs/config.yaml", "-v"}, | ||
[]string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--timeout", "1", "-v"}, | ||
[]string{"scan", "-p", "/path/e2e/fixtures/samples/positive.dockerfile", "--timeout", "0", "-v"}, | ||
}, | ||
}, | ||
WantStatus: []int{50, 50, 126}, | ||
Validation: func(outputText string) bool { | ||
matchTimeoutLog, _ := regexp.MatchString("Query execution timeout=(0|1|12)s", outputText) | ||
return matchTimeoutLog | ||
}, | ||
} | ||
|
||
Tests = append(Tests, testSample) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters