Skip to content
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

More JSON factset tests #363

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

Conversation

yakatz
Copy link
Contributor

@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
Contributor 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?

require 'pathname'
require 'json_schemer'

schema = {
Copy link
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
Contributor 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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants