-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
augur curate I/O: validate records have same fields
Validate records have the same fields before and after the subcommand modifies the records. Includes a functional test to check for the input error, but there's no good way to check for the output error. Hopefully we just never see it!
- Loading branch information
1 parent
c679fde
commit d84a0f4
Showing
2 changed files
with
84 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Setup | ||
|
||
$ source "$TESTDIR"/_setup.sh | ||
|
||
Testing records are validated appropriately by augur curate. | ||
Create NDJSON file for testing validation catches records with different fields. | ||
|
||
$ cat >records.ndjson <<~~ | ||
> {"string": "string_1"} | ||
> {"string": "string_2"} | ||
> {"string": "string_3"} | ||
> {"string": "string_4", "number": 123} | ||
> ~~ | ||
|
||
This will always pass thru the records that pass validation but should raise an | ||
error when it encounters the record with mismatched fields. | ||
|
||
$ cat records.ndjson | ${AUGUR} curate passthru | ||
ERROR: Records do not have the same fields! Please check your input data has the same fields. | ||
{"string": "string_1"} | ||
{"string": "string_2"} | ||
{"string": "string_3"} | ||
[2] | ||
|
||
Passing the records through multiple augur curate commands should raise the | ||
same error when it encounters the record with mismatched fields. | ||
|
||
$ set -o pipefail | ||
$ cat records.ndjson \ | ||
> | ${AUGUR} curate passthru \ | ||
> | ${AUGUR} curate passthru \ | ||
> | ${AUGUR} curate passthru | ||
ERROR: Records do not have the same fields! Please check your input data has the same fields. | ||
{"string": "string_1"} | ||
{"string": "string_2"} | ||
{"string": "string_3"} | ||
[2] |