Skip to content

More JSON factset tests#363

Draft
yakatz wants to merge 1 commit into
voxpupuli:masterfrom
yakatz:json_tests
Draft

More JSON factset tests#363
yakatz wants to merge 1 commit into
voxpupuli:masterfrom
yakatz:json_tests

Conversation

@yakatz
Copy link
Copy Markdown
Member

@yakatz yakatz commented May 30, 2024

This is a draft right now to experiment with various methods of factset normalization and validation

  • Test for known IP address
  • Test out json-schema testing

- Test for known IP address
- Test out json-schema testing
@yakatz
Copy link
Copy Markdown
Member Author

yakatz commented May 31, 2024

Copied from Slack:

I am trying to create a specification of what a factset in facterdb is expected to look like, as well as note some find-replace values to do things like clean up UUIDs and IP addresses (so other modules can depend on the values).

For validation, JSON-Schema is probably way more complex than necessary. We could create huge rspec tests directly on the values, but that it messy.
Neither of those options addresses the find-replace goal.

Any thoughts?

Comment thread spec/facts_schema_spec.rb
require 'pathname'
require 'json_schemer'

schema = {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Did you ask the facter devs if they provide any schema?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I am not really concerned about the validity of the schema overall, since most of them were generated by Facter (hopefully not modified by hand). I am looking for a way to enforce other changes that wouldn't be part of a facter json schema, for example, IP address always being the same, blanked out UUID values, etc. that would help make creating tests with factsets easier.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ah yes, makes sense. I also asked for a schema, so we can properly validate factsets: puppetlabs/facter#2730

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants