You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a unit test modifies the flag Strict , that change persists to other unit tests, resulting in unexpected behavior.
The end result might be a non-issue currently due to what is being tested, but it's non-intuitive for devs adding additional functionality and writing similar tests (see #127).
These unit tests are the only ones that modify Strict:
When I run make test, a different test TestValidInputsWithErrors which does not set Strict, and thus probably expects it to be false, actually runs with Strict = true:
$ make test
...
=== RUN TestValidateInputsWithErrors
--- FAIL: TestValidateInputsWithErrors (0.31s)
kubeval_test.go:107: I didn't enable strict mode
...
I'd propose considering fixing this by passing in Strict and similar flags to the Validate, ValidateWithCache, and determineSchema, but that's just a suggestion.
The text was updated successfully, but these errors were encountered:
Agreed. I've been aware of this for a while and haven't had enough time to refactor it out. Passing in the flags is definitely the right approach I think.
If a unit test modifies the flag
Strict
, that change persists to other unit tests, resulting in unexpected behavior.The end result might be a non-issue currently due to what is being tested, but it's non-intuitive for devs adding additional functionality and writing similar tests (see #127).
These unit tests are the only ones that modify
Strict
:When I run
make test
, a different testTestValidInputsWithErrors
which does not setStrict
, and thus probably expects it to befalse
, actually runs withStrict = true
:I'd propose considering fixing this by passing in
Strict
and similar flags to theValidate
,ValidateWithCache
, anddetermineSchema
, but that's just a suggestion.The text was updated successfully, but these errors were encountered: