Skip to content
This repository was archived by the owner on Nov 23, 2023. It is now read-only.

Commit

Permalink
feat: Return 1 when validation fails
Browse files Browse the repository at this point in the history
  • Loading branch information
l0b0 committed Jan 25, 2021
1 parent acde9bf commit 62a9ac4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion datalake/backend/processing/check_stac_metadata/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ def main() -> int:

try:
STACSchemaValidator(url_reader).validate(arguments.metadata_url)
print(dumps({"success": True, "message": ""}))
except (AssertionError, ValidationError) as error:
print(dumps({"success": False, "message": str(error)}))
return 1

print(dumps({"success": True, "message": ""}))
return 0


Expand Down
2 changes: 1 addition & 1 deletion datalake/backend/tests/test_check_stac_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def test_should_print_json_output_on_validation_failure(validate_url_mock) -> No
sys.argv = [any_program_name(), f"--metadata-url={any_s3_url()}"]

with patch("sys.stdout") as stdout_mock:
main()
assert main() == 1

assert stdout_mock.mock_calls == expected_calls

Expand Down

0 comments on commit 62a9ac4

Please sign in to comment.