diff --git a/pkg/validations/filetests/all-rules-are-run.tpltest b/pkg/validations/filetests/all-rules-are-run.tpltest index e7bbecfe..40e02576 100644 --- a/pkg/validations/filetests/all-rules-are-run.tpltest +++ b/pkg/validations/filetests/all-rules-are-run.tpltest @@ -9,5 +9,5 @@ ERR: - "config" (stdin:4) requires "custom rule"; fail: fails (by stdin:3) - "config" (stdin:4) requires "length greater or equal to 10"; fail: length of 2 is less than 10 (by stdin:3) - "config" (stdin:4) requires "length less than or equal to 1"; fail: length of 2 is more than 1 (by stdin:3) -- "config" (stdin:4) requires "a value greater or equal to [2, 2]"; fail: yamlfragment(*yamlmeta.Array) is less than [2, 2] (by stdin:3) -- "config" (stdin:4) requires "a value less than or equal to [0, 0]"; fail: yamlfragment(*yamlmeta.Array) is more than [0, 0] (by stdin:3) +- "config" (stdin:4) requires "a value greater or equal to [2, 2]"; fail: value is less than [2, 2] (by stdin:3) +- "config" (stdin:4) requires "a value less than or equal to [0, 0]"; fail: value is more than [0, 0] (by stdin:3) diff --git a/pkg/validations/filetests/max=/invalid-when-value-greater-than-max.tpltest b/pkg/validations/filetests/max=/invalid-when-value-greater-than-max.tpltest index 09e9b187..70f5d557 100644 --- a/pkg/validations/filetests/max=/invalid-when-value-greater-than-max.tpltest +++ b/pkg/validations/filetests/max=/invalid-when-value-greater-than-max.tpltest @@ -4,4 +4,4 @@ foo: 11 +++ ERR: -- "foo" (stdin:2) requires "a value less than or equal to 10"; fail: 11 is more than 10 (by stdin:1) +- "foo" (stdin:2) requires "a value less than or equal to 10"; fail: value is more than 10 (by stdin:1) diff --git a/pkg/validations/filetests/min=/invalid-when-value-less-than-min.tpltest b/pkg/validations/filetests/min=/invalid-when-value-less-than-min.tpltest index 83cb0aff..fa583b0d 100644 --- a/pkg/validations/filetests/min=/invalid-when-value-less-than-min.tpltest +++ b/pkg/validations/filetests/min=/invalid-when-value-less-than-min.tpltest @@ -4,4 +4,4 @@ value: 9 +++ ERR: -- "value" (stdin:2) requires "a value greater or equal to 10"; fail: 9 is less than 10 (by stdin:1) +- "value" (stdin:2) requires "a value greater or equal to 10"; fail: value is less than 10 (by stdin:1) diff --git a/pkg/validations/filetests/one_of=/invalid-when-value-not-in-enum.tpltest b/pkg/validations/filetests/one_of=/invalid-when-value-not-in-enum.tpltest index 2c049946..e00d7438 100644 --- a/pkg/validations/filetests/one_of=/invalid-when-value-not-in-enum.tpltest +++ b/pkg/validations/filetests/one_of=/invalid-when-value-not-in-enum.tpltest @@ -4,4 +4,4 @@ foo: critical +++ ERR: -- "foo" (stdin:2) requires "one of"; fail: critical not in ["debug", "info", "warning", "error", "fatal"] (by stdin:1) +- "foo" (stdin:2) requires "one of"; fail: value not in ["debug", "info", "warning", "error", "fatal"] (by stdin:1) diff --git a/pkg/yamltemplate/filetests/ytt-library/assert/max/value-fails-assertion.tpltest b/pkg/yamltemplate/filetests/ytt-library/assert/max/value-fails-assertion.tpltest index b5cdafb1..ce830376 100644 --- a/pkg/yamltemplate/filetests/ytt-library/assert/max/value-fails-assertion.tpltest +++ b/pkg/yamltemplate/filetests/ytt-library/assert/max/value-fails-assertion.tpltest @@ -5,7 +5,7 @@ max_of_int: #@ assert.max(2).check(3) +++ ERR: -- fail: 3 is more than 2 +- fail: value is more than 2 in lambda assert.max:? | __ytt_tplXXX_set_ctx_type("yaml") (generated) stdin:1 | #@ load("@ytt:assert", "assert") diff --git a/pkg/yamltemplate/filetests/ytt-library/assert/min/value-fails-assertion.tpltest b/pkg/yamltemplate/filetests/ytt-library/assert/min/value-fails-assertion.tpltest index 91b6d514..726dcb4d 100644 --- a/pkg/yamltemplate/filetests/ytt-library/assert/min/value-fails-assertion.tpltest +++ b/pkg/yamltemplate/filetests/ytt-library/assert/min/value-fails-assertion.tpltest @@ -5,7 +5,7 @@ min_of_int: #@ assert.min(3).check(2) +++ ERR: -- fail: 2 is less than 3 +- fail: value is less than 3 in lambda assert.min:? | __ytt_tplXXX_set_ctx_type("yaml") (generated) stdin:1 | #@ load("@ytt:assert", "assert") diff --git a/pkg/yamltemplate/filetests/ytt-library/assert/one_of/main.tpltest b/pkg/yamltemplate/filetests/ytt-library/assert/one_of/main.tpltest index 8c77e51c..94d79937 100644 --- a/pkg/yamltemplate/filetests/ytt-library/assert/one_of/main.tpltest +++ b/pkg/yamltemplate/filetests/ytt-library/assert/one_of/main.tpltest @@ -21,7 +21,7 @@ pass: fail: not_in_enum: - null - - 'fail: not-in-set not in ["aws", "azure", "vsphere"]' + - 'fail: value not in ["aws", "azure", "vsphere"]' enum_not_a_sequence: int: - null diff --git a/pkg/yttlibrary/assert.go b/pkg/yttlibrary/assert.go index fc96e686..934e641e 100644 --- a/pkg/yttlibrary/assert.go +++ b/pkg/yttlibrary/assert.go @@ -231,7 +231,7 @@ func (m AssertModule) MinLen(thread *starlark.Thread, f *starlark.Builtin, args func NewAssertMin(min starlark.Value) *Assertion { return NewAssertionFromSource( "assert.min", - `lambda val: True if yaml.decode(yaml.encode(val)) >= yaml.decode(yaml.encode(min)) else fail("{} is less than {}".format(val, min))`, + `lambda val: True if yaml.decode(yaml.encode(val)) >= yaml.decode(yaml.encode(min)) else fail("value is less than {}".format(yaml.decode(yaml.encode(min))))`, starlark.StringDict{"min": min, "yaml": YAMLAPI["yaml"]}, ) } @@ -252,7 +252,7 @@ func (m AssertModule) Min(thread *starlark.Thread, f *starlark.Builtin, args sta func NewAssertMax(max starlark.Value) *Assertion { return NewAssertionFromSource( "assert.max", - `lambda val: True if yaml.decode(yaml.encode(val)) <= yaml.decode(yaml.encode(max)) else fail("{} is more than {}".format(val, max))`, + `lambda val: True if yaml.decode(yaml.encode(val)) <= yaml.decode(yaml.encode(max)) else fail("value is more than {}".format(yaml.decode(yaml.encode(max))))`, starlark.StringDict{"max": max, "yaml": YAMLAPI["yaml"]}, ) } @@ -389,7 +389,7 @@ func (m AssertModule) oneNotNullCheck(keys starlark.Sequence) core.StarlarkFunc func NewAssertOneOf(enum starlark.Sequence) *Assertion { return NewAssertionFromSource( "assert.one_of", - `lambda val: True if yaml.decode(yaml.encode(val)) in yaml.decode(yaml.encode(enum)) else fail("{} not in {}".format(yaml.decode(yaml.encode(val)), yaml.decode(yaml.encode(enum))))`, + `lambda val: True if yaml.decode(yaml.encode(val)) in yaml.decode(yaml.encode(enum)) else fail("value not in {}".format(yaml.decode(yaml.encode(enum))))`, starlark.StringDict{"enum": enum, "yaml": YAMLAPI["yaml"]}, ) }