Closed shellcromancer closed 2 weeks ago
There are a few things needed to make this consistent across the CLI tool:
test error
and config error
no longer make sense, it's better if they're all consistent one way or the other. (If they are going to reference the path in the config file, then it should be "transforms" with an s.)\t\t
for reporting info or errors, like this.
- Any other references to
test error
andconfig error
no longer make sense, it's better if they're all consistent one way or the other. (If they are going to reference the path in the config file, then it should be "transforms" with an s.)
Updated the test output on errors for each place to make it more meaningful e.g. test condition error
, or test config error
- This isn't obvious but it uses 4 spaces instead of
\t\t
for reporting info or errors, like this.
Updated to use spaces.
- Port the same features and style to the playground command for consistency.
Updated the playgrounds error handling.
This is affecting the style of most of the CLI, so I pushed a commit to standardize it. You can try it with this config:
local sub = std.extVar('sub');
{
tests: [
{
name: 'ex',
transforms: [ // comment block for error.
sub.tf.test.message({ value: 'brex.com' }),
// sub.tf.net.domain.subdomain(), // uncomment for runtime error.
// sub.tf.net.domain.subdomain({ object: {source_key: 'test'}}), // uncomment for vet error.
],
condition: sub.cnd.str.eq({ value: '' }), // comment for error.
},
],
transforms: [ // comment block for vet error.
// sub.tf.net.domain.subdomain(), // uncomment for runtime error.
// sub.tf.net.domain.subdomain({ object: {source_key: 'test'}}), // uncomment for vet error.
sub.tf.send.stdout(), // no-op.
],
}
so I pushed a commit to standardize it.
Pushed changes look fine to me. Let's merge this one?
Description
This changes the CLIs "test" subcommand (
substation test
) to log runtime transform errors to standard error. ThisMotivation and Context
When performing test file driven configuration development it's not clear if a specific tests
[config error]
is from misconfigured Jsonnet declarations, invalid Substation options or runtime errors. You can remove the first two options by diagnosing withsubstation vet
but then you still don't know what the runtime transform error is if that's the case.How Has This Been Tested?
Verified that multiple tests across files can be run, and are more clear when there was an opaque
[config error]
.Types of changes
Checklist: