-
Notifications
You must be signed in to change notification settings - Fork 44
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
Enable metadata schema validation #504
Conversation
@@ -18,7 +18,7 @@ clean_devices=$(fgrep 'Z"' ${TEST_SITE}/registration_summary.json | wc -l) | |||
exit_status=0 | |||
|
|||
echo Found ${clean_devices} clean devices. | |||
[ "${clean_devices}" == 4 ] || exit_status=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make this automatic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean by automatic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Automatic = Can we derive the 4 from a calculation based on the test inputs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm semi ok with this if we make it less of a hunt to figure out why it's 3, instead of it just being a bare int by itself in a file that calculates the rest. For example
Clean devices are: SNS-4 GAT-123 AHU-22
[ "${clean_devices}" == 3 ].....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm really not sure it's worth it in this case. The logic to calculate that
for just this one case would be relatively complicated (find all the files
that don't match a very specific pattern that just matches one file), and
then likely would end up bring more fragile than just having the raw
expected value -- and then you'd also have to worry about an inadvertent
change in the input data changing the expected and actual value for the
test...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok -- added named constant with detail about why it is what it is!
@@ -301,23 +301,28 @@ private Metadata readMetadataWithValidation(boolean validate) { | |||
return null; | |||
} | |||
|
|||
JsonNode mergedMetadata = getMergedMetadata(instance); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests for this function please. It might need to be broken up into pieces?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added class LocalDeviceTest with coverage for the two major caes
Ok, added some tests for LocalDevice (for the new function), as well as comments at the high-level about clean devices. |
Simple flag flip, and then an extra schema test file just for fun. Requested to aid in project validation work -- feature was added previously but not enabled by default.