Skip to content
This repository has been archived by the owner on Feb 16, 2024. It is now read-only.

[Enhancement] YAML validation of a TestStep file #27

Merged
merged 16 commits into from
Sep 14, 2023

Conversation

shubham-cmyk
Copy link
Member

@shubham-cmyk shubham-cmyk commented Aug 9, 2023

Fixes #24

  • If a nonexisting assert, apply, or error file is present in the test step it will fail
  • If TestStep contains any random field ( foo ) it will fail
  • It would check the yaml indentation on TestStep, assert files, error files, and apply files. ( Strict decoder )

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
@shubham-cmyk
Copy link
Member Author

@eddycharly Please Check

@shubham-cmyk shubham-cmyk changed the title Check Yaml intendation + Verify if the file exist [Enhancement] YAML validation of a TestStep file Aug 9, 2023
@eddycharly
Copy link
Member

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
@shubham-cmyk
Copy link
Member Author

  1. Throws error if the referenced file in apply, error or assert doesn't exist.

image

  1. Throws an error if unexpected field is present in TestStep

image

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
@chipzoller
Copy link

Can you please use code blocks rather than screenshots of terminal output?

Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
@shubham-cmyk
Copy link
Member Author

@chipzoller @eddycharly
Can you check ?

@shubham-cmyk
Copy link
Member Author

  • If a nonexisting assert, apply, or error file is present in the test step it will fail
  • If TestStep contains any random field ( foo ) it will fail
  • It would check the yaml indentation on TestStep, assert files, error files, and apply files. ( Strict decoder )

pkg/test/step.go Outdated Show resolved Hide resolved
Signed-off-by: Shubham Gupta <iamshubhamgupta2001@gmail.com>
Copy link
Member

@eddycharly eddycharly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks !

@eddycharly eddycharly merged commit e3af68e into kyverno:main Sep 14, 2023
5 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Enhancement] YAML validation of a TestStep file
3 participants