This repository has been archived by the owner on Jun 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The problem with using the name of the rule to classify the result is that it becomes hard to write generally useful checks. For example, if we need a HTTP response to have a 404 status, we can test for the status in a policy module, but we still need to wrap that in an error rule to propagate the result, which makes tests more verbose than they ought to be. This change introduces the `check` rule type, where the result of a rule can be a map with an explicit `result` field. This allows test authors to write policy modules that are completely self-contained and can return results independently of the rule type. For example, it would be possible to have a single policy function that skips a test if `cert-manager` is not installed. Signed-off-by: James Peach <[email protected]>
- Loading branch information
Showing
7 changed files
with
351 additions
and
86 deletions.
There are no files selected for viewing
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,46 @@ | ||
package builtin.result | ||
|
||
PassResult := "Pass" | ||
SkipResult := "Skip" | ||
ErrorResult := "Error" | ||
FatalResult := "Fatal" | ||
|
||
Pass(msg) = { | ||
"result": PassResult, | ||
"msg": msg, | ||
} | ||
|
||
Passf(fmt, args) = { | ||
"result": PassResult, | ||
"msg": sprintf(fmt, args), | ||
} | ||
|
||
Skip(msg) = { | ||
"result": SkipResult, | ||
"msg": msg, | ||
} | ||
|
||
Skipf(fmt, args) = { | ||
"result": SkipResult, | ||
"msg": sprintf(fmt, args), | ||
} | ||
|
||
Error(msg) = { | ||
"result": ErrorResult, | ||
"msg": msg, | ||
} | ||
|
||
Errorf(fmt, args) = { | ||
"result": ErrorResult, | ||
"msg": sprintf(fmt, args), | ||
} | ||
|
||
Fatal(msg) = { | ||
"result": FatalResult, | ||
"msg": msg, | ||
} | ||
|
||
Fatalf(fmt, args) = { | ||
"result": FatalResult, | ||
"msg": sprintf(fmt, args), | ||
} |
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
Oops, something went wrong.