voxpupuli / metadata-json-lint

Tool to check the validity of Puppet metadata.json files
Apache License 2.0
29 stars 27 forks source link

Add test for invalid task metadata #120

Open timidri opened 3 years ago

timidri commented 3 years ago

Add test for task metadata file with invalid escape character. This test is expected to fail on invalid json, but instead it fails on invalid schema - the task metadata files have a different schema. I'm not sure what exactly happens in pdk validate when no error is raised on this task metadata json.

codecov[bot] commented 3 years ago

Codecov Report

Merging #120 (7aa6617) into master (6919241) will not change coverage. The diff coverage is n/a.

:exclamation: Current head 7aa6617 differs from pull request most recent head f0ebdcd. Consider uploading reports for the commit f0ebdcd to get more accurate results Impacted file tree graph

@@           Coverage Diff           @@
##           master     #120   +/-   ##
=======================================
  Coverage   50.23%   50.23%           
=======================================
  Files           5        5           
  Lines         211      211           
=======================================
  Hits          106      106           
  Misses        105      105           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 6919241...f0ebdcd. Read the comment docs.

ekohl commented 3 years ago

This test is expected to fail on invalid json, but instead it fails on invalid schema - the task metadata files have a different schema. I'm not sure what exactly happens in pdk validate when no error is raised on this task metadata json.

I suspect that there is no check for this so it falls back to the regular metadata checks. I'd start with adding all missing fields.

timidri commented 3 years ago

This test is expected to fail on invalid json, but instead it fails on invalid schema - the task metadata files have a different schema. I'm not sure what exactly happens in pdk validate when no error is raised on this task metadata json.

I suspect that there is no check for this so it falls back to the regular metadata checks. I'd start with adding all missing fields.

Sure, I can do that, but do we want metadata-json-lint to also correctly validate task metadata files? Or should that be a separate new feature request?

ekohl commented 3 years ago

AFAIK this gem has never done anything with task metadata files. Given all technologies are in here to make it happen, I can see it being in scope for this gem but it would be a new feature request.

timidri commented 2 years ago

AFAIK this gem has never done anything with task metadata files. Given all technologies are in here to make it happen, I can see it being in scope for this gem but it would be a new feature request.

That makes sense. For now, I've changed the test to use a module metadata file which shows the same problem.

ekohl commented 2 years ago

This looks like a valid reproducer. Now all we need is someone to write a patch to make the tests pass.