Skip to content

(#307) Fix plan parsing in JSON spec tests #311

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from

Conversation

danielparks
Copy link
Contributor

@danielparks danielparks commented Sep 26, 2022

This is 3 closely related commits. I’m not totally satisfied with this solution — I would be inclined to set Puppet[:tasks] = true regardless of the file name, but I’m not really sure what all the implications would be.

Catch parse failures in PuppetStrings::Json tests

Previously, the tests for PuppetStrings::Json (in json_spec.rb) parsed a variety of code samples and then queried YARD to test the results. If a sample failed to parse, an error might be outputted (see issue #307), but no failure was registered by the testing harness.

This adds simple checks to verify that the parses actually succeed.

Unfortunately, one of the samples currently fails to parse, so this commit introduces a testing error. The subbsequent commit will fix it.

(#307) Fix plan parsing in JSON spec tests

Previously, parsing of Puppet plan code failed in json_spec.rb because it didn’t provide a file name to the parser, which prevented the parser from enabling task support in Puppet, which prevented the parser from recognizing a plan.

This turns on task support in Puppet before trying to parse a plan in json_spec.rb.

Add a plan test to parser_spec.rb

Previously, none of the examples in parser_spec.rb included a Puppet plan. This adds a plan and verifies that it parses correctly.

@danielparks
Copy link
Contributor Author

I’m inclined to close this in favor of #312, but I figured I’d let somebody else make the call. Sorry for the noise!

@CLAassistant
Copy link

CLAassistant commented Sep 26, 2022

CLA assistant check
All committers have signed the CLA.

@danielparks danielparks marked this pull request as draft September 29, 2022 09:18
Previously, the tests for `PuppetStrings::Json` (in json_spec.rb) parsed
a variety of code samples and then queried YARD to test the results. If
a sample failed to parse, an error might be outputted (see [issue
puppetlabs#307][puppetlabs#307]), but no failure was registered by the testing harness.

This adds simple checks to verify that the parses actually succeed.

Unfortunately, one of the samples currently fails to parse, so this
commit introduces a testing error. The subbsequent commit will fix it.

[puppetlabs#307]: puppetlabs#307
Previously, parsing of Puppet plan code failed in json_spec.rb because
it didn’t provide a file name to the parser, which prevented the parser
from enabling task support in Puppet, which prevented the parser from
recognizing a plan.

This turns on task support in Puppet before trying to parse a plan in
json_spec.rb.
Previously, none of the examples in parser_spec.rb included a Puppet
plan. This adds a plan and verifies that it parses correctly.
@danielparks
Copy link
Contributor Author

Closing in favor of #312.

@danielparks danielparks deleted the fix_plan_tests branch September 29, 2022 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants