-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #741 from vmware-tanzu/733-use-named-params-for-va…
…lidation-when Allow when= to access value, parent, and root nodes
- Loading branch information
Showing
41 changed files
with
439 additions
and
153 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
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
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
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
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
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
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
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
File renamed without changes.
11 changes: 11 additions & 0 deletions
11
pkg/validations/filetests/when-null-skips/value-is-null-with-not_null--runs-rules.tpltest
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,11 @@ | ||
#@assert/validate not_null=True | ||
foo: null | ||
|
||
+++ | ||
|
||
ERR: | ||
foo | ||
from: stdin:2 | ||
- must be: not null (by: stdin:1) | ||
found: value is null | ||
|
11 changes: 11 additions & 0 deletions
11
pkg/validations/filetests/when-null-skips/value-not-null--runs-rules.tpltest
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,11 @@ | ||
#@assert/validate ("", lambda v: fail("rules were run")) | ||
foo: "" | ||
|
||
+++ | ||
|
||
ERR: | ||
foo | ||
from: stdin:2 | ||
- must be: (by: stdin:1) | ||
found: rules were run | ||
|
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,22 @@ | ||
counters: | ||
enabled: true | ||
#@assert/validate ("fail", lambda v: fail("runs")), when=lambda v, ctx: ctx.parent["enabled"] | ||
foo: "" | ||
other: | ||
#@assert/validate ("fail", lambda v: fail("runs")), when=lambda v, ctx: ctx.root[0]["counters"]["enabled"] and len(ctx.parent) == 2 | ||
bar: "" | ||
ree: "" | ||
|
||
+++ | ||
|
||
ERR: | ||
counters.foo | ||
from: stdin:4 | ||
- must be: fail (by: stdin:3) | ||
found: runs | ||
|
||
other.bar | ||
from: stdin:7 | ||
- must be: fail (by: stdin:6) | ||
found: runs | ||
|
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
pkg/validations/filetests/when=/rejects-callable-arg-failing.tpltest
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#@ load("@ytt:assert", "assert") | ||
|
||
#@assert/validate min_len=5, when=lambda v: fail("error while checking when=") | ||
#@assert/validate min_len=5, when=lambda v: fail("error from within lambda") | ||
foo: bar | ||
|
||
+++ | ||
|
||
ERR: | ||
- fail: error while checking when= | ||
Validating foo: Failure evaluating when=: fail: error from within lambda |
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 |
---|---|---|
|
@@ -4,4 +4,4 @@ foo: bar | |
+++ | ||
|
||
ERR: | ||
- want when= to be bool, got string | ||
Validating foo: want when= to be bool, got string |
Oops, something went wrong.