-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1518 from nextstrain/curate-io-validation
augur curate I/O: validate records have same fields
- Loading branch information
Showing
3 changed files
with
88 additions
and
7 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
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] |