Skip to content

Commit

Permalink
Use production inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdesmet committed Aug 22, 2023
1 parent 14cd79f commit 3e8a975
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/vptstools/bin/vph5_to_vpts.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# (load_dotenv doesn't override existing environment variables)
load_dotenv()

INVENTORY_BUCKET = os.environ.get("INVENTORY_BUCKET", "aloft-inventory")
S3_BUCKET = os.environ.get("DESTINATION_BUCKET", "aloftdata")
INVENTORY_BUCKET = os.environ.get("INVENTORY_BUCKET", "inbo-aloft-prod-eu-west-1-inventory")
AWS_SNS_TOPIC = os.environ.get("SNS_TOPIC")
AWS_PROFILE = os.environ.get("AWS_PROFILE", None)
AWS_REGION = os.environ.get("AWS_REGION", "eu-west-1")
Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,20 +269,20 @@ def s3_inventory(aws_credentials, path_inventory):
s3 = boto3.client("s3")
# Add S3 inventory setup
s3.create_bucket(
Bucket="aloft-inventory",
Bucket="inbo-aloft-prod-eu-west-1-inventory",
CreateBucketConfiguration={"LocationConstraint": "eu-west-1"},
)
with open(manifest, "rb") as manifest_file:
s3.upload_fileobj(
manifest_file,
"aloft-inventory",
"aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
"inbo-aloft-prod-eu-west-1-inventory",
"aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
)
with open(inventory, "rb") as inventory_file:
s3.upload_fileobj(
inventory_file,
"aloft-inventory",
"aloft/aloft-hdf5-files-inventory/data/dummy_inventory.csv.gz",
"inbo-aloft-prod-eu-west-1-inventory",
"aloftdata/aloftdata-hdf5-files-inventory/data/dummy_inventory.csv.gz",
)

# Add example data to aloft mocked S3 bucket
Expand Down
14 changes: 7 additions & 7 deletions tests/test_s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,12 +428,12 @@ def test_list_manifest_file_keys(self, s3_inventory):
"""Individual inventory items are correctly parsed from manifest file"""
inventory_files = list(
list_manifest_file_keys(
"aloft-inventory/aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json"
"inbo-aloft-prod-eu-west-1-inventory/aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json"
)
)
assert len(inventory_files) == 1
assert (
inventory_files[0]["key"] == "aloft/aloft-hdf5-files-inventory/data/"
inventory_files[0]["key"] == "aloftdata/aloftdata-hdf5-files-inventory/data/"
"dummy_inventory.csv.gz"
)

Expand All @@ -452,13 +452,13 @@ def test_list_manifest_file_keys_with_profile(self, s3_inventory, tmp_path):
# run inventory with alternative profile
inventory_files = list(
list_manifest_file_keys(
"aloft-inventory/aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
"inbo-aloft-prod-eu-west-1-inventory/aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
storage_options={"profile": "my-aws-profile"},
)
)
assert len(inventory_files) == 1
assert (
inventory_files[0]["key"] == "aloft/aloft-hdf5-files-inventory/data/"
inventory_files[0]["key"] == "aloftdata/aloftdata-hdf5-files-inventory/data/"
"dummy_inventory.csv.gz"
)
# clean up env variable
Expand All @@ -472,7 +472,7 @@ def test_handle_manifest_all(self, s3_inventory):
return_value=pd.Timestamp("2023-02-01 00:00:00", tz="UTC"),
):
df_cov, days_to_create_vpts = handle_manifest(
"s3://aloft-inventory/aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
"s3://inbo-aloft-prod-eu-west-1-inventory/aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
modified_days_ago="60days",
) # large enough number to get all inventory 'modified' items
# When date-modified implies full scan, df_cov and days_to_create_vpts are the same
Expand All @@ -495,7 +495,7 @@ def test_handle_manifest_subset(self, s3_inventory):
return_value=pd.Timestamp("2023-02-01 00:00:00", tz="UTC"),
):
df_cov, days_to_create_vpts = handle_manifest(
"s3://aloft-inventory/aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
"s3://inbo-aloft-prod-eu-west-1-inventory/aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
modified_days_ago="5days",
) # only subset of files is within the time window of days
# Coverage returns the full inventory overview
Expand All @@ -517,7 +517,7 @@ def test_handle_manifest_none(self, s3_inventory):
return_value=pd.Timestamp("2023-03-01 00:00:00", tz="UTC"),
):
df_cov, days_to_create_vpts = handle_manifest(
"s3://aloft-inventory/aloft/aloft-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
"s3://inbo-aloft-prod-eu-west-1-inventory/aloftdata/aloftdata-hdf5-files-inventory/2023-02-01T01-00Z/manifest.json",
modified_days_ago="1days",
) # only subset of files is within the time window of days
# Coverage returns the full inventory overview
Expand Down

0 comments on commit 3e8a975

Please sign in to comment.