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

Add config and challenge parsing tests via Figment::Jail #31

Merged
merged 10 commits into from
Dec 6, 2024

Conversation

detjensrobert
Copy link
Contributor

@detjensrobert detjensrobert commented Nov 16, 2024

The config parsing library introduced in #20 includes a sandboxed test mechanism for testing its parsing results. This PR adds a decently comprehensive suite of tests to make sure the rcds.yaml and challenge.yamls parse or do not parse as expected. This replaces the couple of existing parsing tests that were done directly with Serde.

This also includes a few tweaks to the ChallengeConfig structs to make the parsed result more ergonomic to use --inlining enum fields to remove unnecessary nested objects, coercing envvar lists to map form at parse time.

This field is used to check against the enabled/disabled challenges in the
deploy profile, and was not being set when parsed. This got removed in a
rebase somewhere(?) and broke the validate command. Now fixed!

Signed-off-by: Robert Detjens <[email protected]>
Since we only are looking for two levels of folders to find challenge
directories, rust_search's recursive search isn't needed and it cannot be
restricted to only search at a specific depth. The glob library can, and is
much more concise for this case.

Signed-off-by: Robert Detjens <[email protected]>
This simplifies the caching layer in configparsing/mod.rs and allows tests
to bypass the caching for building config files.

Signed-off-by: Robert Detjens <[email protected]>
The separate types do not need a sub-field as the enum already signifies
what the desired expose type is.

Signed-off-by: Robert Detjens <[email protected]>
Copy link

@cacama-valvata cacama-valvata left a comment

Choose a reason for hiding this comment

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

LGTM

@detjensrobert detjensrobert merged commit eafecc3 into main Dec 6, 2024
3 checks passed
@detjensrobert detjensrobert deleted the dr/parsing-tests branch December 6, 2024 19:06
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