-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ingestion/s3): ignore depth mismatched path
- Loading branch information
Showing
3 changed files
with
97 additions
and
17 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,31 @@ | ||
import pytest | ||
|
||
from datahub.ingestion.source.data_lake_common.path_spec import PathSpec | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"include, s3_uri, expected", | ||
[ | ||
( | ||
"s3://bucket/{table}/{partition0}/*.csv", | ||
"s3://bucket/table/p1/test.csv", | ||
True, | ||
), | ||
( | ||
"s3://bucket/{table}/{partition0}/*.csv", | ||
"s3://bucket/table/p1/p2/test.csv", | ||
False, | ||
), | ||
], | ||
) | ||
def test_allowed_ignores_depth_mismatch( | ||
include: str, s3_uri: str, expected: bool | ||
) -> None: | ||
# arrange | ||
path_spec = PathSpec( | ||
include=include, | ||
table_name="{table}", | ||
) | ||
|
||
# act, assert | ||
assert path_spec.allowed(s3_uri) == expected |
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