Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v2.0.2 #549

Merged
merged 63 commits into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
89c4147
Bump ASFHyP3/actions from 0.11.1 to 0.11.2
dependabot[bot] Jul 1, 2024
e4b7021
Bump boto3 from 1.34.131 to 1.34.136
dependabot[bot] Jul 1, 2024
460ead4
Merge pull request #516 from asfadmin/dependabot/github_actions/ASFHy…
jtherrmann Jul 1, 2024
8f1d8a9
Merge pull request #517 from asfadmin/dependabot/pip/boto3-1.34.136
jtherrmann Jul 1, 2024
ce4352e
Bump boto3 from 1.34.136 to 1.34.140
dependabot[bot] Jul 8, 2024
c8c37b1
Merge pull request #518 from asfadmin/dependabot/pip/boto3-1.34.140
jtherrmann Jul 8, 2024
a6d42c5
Bump boto3 from 1.34.140 to 1.34.145
dependabot[bot] Jul 22, 2024
57cdb2f
Merge pull request #521 from asfadmin/dependabot/pip/boto3-1.34.145
jtherrmann Jul 23, 2024
9adc2d3
Bump jsonschema from 4.22.0 to 4.23.0
dependabot[bot] Jul 23, 2024
d61d3d9
Merge pull request #520 from asfadmin/dependabot/pip/jsonschema-4.23.0
jtherrmann Jul 23, 2024
72a7390
Bump boto3 from 1.34.145 to 1.34.149
dependabot[bot] Jul 29, 2024
9daf070
Merge pull request #522 from asfadmin/dependabot/pip/boto3-1.34.149
jtherrmann Aug 1, 2024
7dab886
Bump boto3 from 1.34.149 to 1.34.153
dependabot[bot] Aug 5, 2024
1a035b1
Merge pull request #523 from asfadmin/dependabot/pip/boto3-1.34.153
jtherrmann Aug 6, 2024
381a931
Bump boto3 from 1.34.153 to 1.34.158
dependabot[bot] Aug 12, 2024
35d2fa4
Merge pull request #524 from asfadmin/dependabot/pip/boto3-1.34.158
asjohnston-asf Aug 12, 2024
d5c0a4e
Bump boto3 from 1.34.158 to 1.35.0
dependabot[bot] Aug 19, 2024
c5b22bc
Merge pull request #525 from asfadmin/dependabot/pip/boto3-1.35.0
asjohnston-asf Aug 19, 2024
f4dd6e1
Bump boto3 from 1.35.0 to 1.35.5
dependabot[bot] Aug 26, 2024
98c3342
Merge pull request #526 from asfadmin/dependabot/pip/boto3-1.35.5
jtherrmann Aug 26, 2024
1f3441d
Bump boto3 from 1.35.5 to 1.35.10
dependabot[bot] Sep 2, 2024
eebbb87
Merge pull request #527 from asfadmin/dependabot/pip/boto3-1.35.10
jtherrmann Sep 3, 2024
f75773b
Bump boto3 from 1.35.10 to 1.35.14
dependabot[bot] Sep 9, 2024
1e92b07
Merge pull request #528 from asfadmin/dependabot/pip/boto3-1.35.14
jtherrmann Sep 10, 2024
040dd16
Bump boto3 from 1.35.14 to 1.35.19
dependabot[bot] Sep 16, 2024
eeedf3a
Merge pull request #529 from asfadmin/dependabot/pip/boto3-1.35.19
jtherrmann Sep 16, 2024
0199b16
Bump boto3 from 1.35.19 to 1.35.24
dependabot[bot] Sep 23, 2024
a8f22a5
Merge pull request #530 from asfadmin/dependabot/pip/boto3-1.35.24
jtherrmann Sep 24, 2024
97434c0
Bump boto3 from 1.35.24 to 1.35.29
dependabot[bot] Sep 30, 2024
3704279
switch to setup-micromamba
jtherrmann Sep 30, 2024
c45ba0a
Merge pull request #531 from asfadmin/dependabot/pip/boto3-1.35.29
jtherrmann Sep 30, 2024
f7a6b38
Bump mamba-org/setup-micromamba from 1 to 2
dependabot[bot] Oct 7, 2024
e28b18a
Bump boto3 from 1.35.29 to 1.35.34
dependabot[bot] Oct 7, 2024
b0c0e49
Merge pull request #532 from asfadmin/dependabot/github_actions/mamba…
jtherrmann Oct 9, 2024
b5b0d7c
Merge pull request #533 from asfadmin/dependabot/pip/boto3-1.35.34
jtherrmann Oct 9, 2024
df898b8
Bump boto3 from 1.35.34 to 1.35.39
dependabot[bot] Oct 14, 2024
a9e4703
Merge pull request #534 from asfadmin/dependabot/pip/boto3-1.35.39
jtherrmann Oct 18, 2024
fadedeb
Bump ASFHyP3/actions from 0.11.2 to 0.12.0
dependabot[bot] Oct 21, 2024
7bb0d7b
Bump boto3 from 1.35.39 to 1.35.44
dependabot[bot] Oct 21, 2024
f146185
Merge pull request #535 from asfadmin/dependabot/github_actions/ASFHy…
jtherrmann Oct 23, 2024
d39d0ce
Merge pull request #536 from asfadmin/dependabot/pip/boto3-1.35.44
jtherrmann Oct 23, 2024
a7a0c7f
Bump boto3 from 1.35.44 to 1.35.49
dependabot[bot] Oct 28, 2024
e4bf078
Merge pull request #537 from asfadmin/dependabot/pip/boto3-1.35.49
jtherrmann Oct 28, 2024
a28184f
Bump boto3 from 1.35.49 to 1.35.54
dependabot[bot] Nov 4, 2024
fd9171e
Merge pull request #538 from asfadmin/dependabot/pip/boto3-1.35.54
jtherrmann Nov 4, 2024
9253c70
Bump boto3 from 1.35.54 to 1.35.57
dependabot[bot] Nov 11, 2024
89a164e
Merge pull request #539 from asfadmin/dependabot/pip/boto3-1.35.57
jtherrmann Nov 12, 2024
00444a6
Bump boto3 from 1.35.57 to 1.35.63
dependabot[bot] Nov 18, 2024
40ddcd9
Merge pull request #540 from asfadmin/dependabot/pip/boto3-1.35.63
jtherrmann Nov 19, 2024
9dc1b33
Bump boto3 from 1.35.63 to 1.35.68
dependabot[bot] Nov 25, 2024
06f762e
Merge pull request #541 from asfadmin/dependabot/pip/boto3-1.35.68
jtherrmann Nov 25, 2024
f4f8152
Bump boto3 from 1.35.68 to 1.35.72
dependabot[bot] Dec 2, 2024
bbca475
Merge pull request #542 from asfadmin/dependabot/pip/boto3-1.35.72
jtherrmann Dec 2, 2024
1a84688
Bump boto3 from 1.35.72 to 1.35.76
dependabot[bot] Dec 9, 2024
bf3a689
Merge pull request #543 from asfadmin/dependabot/pip/boto3-1.35.76
jtherrmann Dec 12, 2024
c204274
Bump boto3 from 1.35.76 to 1.35.81
dependabot[bot] Dec 16, 2024
43f1eed
Merge pull request #544 from asfadmin/dependabot/pip/boto3-1.35.81
jtherrmann Dec 18, 2024
bbf8017
Bump ASFHyP3/actions from 0.12.0 to 0.13.2
dependabot[bot] Dec 23, 2024
18ce04d
Bump boto3 from 1.35.81 to 1.35.90
dependabot[bot] Dec 30, 2024
f0b6969
replace flake8 with ruff
jtherrmann Jan 2, 2025
d1bfcef
Merge pull request #548 from asfadmin/add-ruff
jtherrmann Jan 2, 2025
b73766c
Merge pull request #546 from asfadmin/dependabot/github_actions/ASFHy…
jtherrmann Jan 2, 2025
cb8680e
Merge pull request #547 from asfadmin/dependabot/pip/boto3-1.35.90
jtherrmann Jan 2, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
jobs:
call-changelog-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.13.2

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
2 changes: 1 addition & 1 deletion .github/workflows/create-jira-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

jobs:
call-create-jira-issue-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.13.2
secrets:
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
JIRA_PROJECT: ${{ secrets.JIRA_PROJECT }}
JIRA_FIELDS: ${{ secrets.JIRA_FIELDS }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
jobs:
call-labeled-pr-check-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.13.2

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
2 changes: 1 addition & 1 deletion .github/workflows/release-checklist-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
jobs:
call-release-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.13.2
permissions:
pull-requests: write
secrets:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.13.2
with:
release_prefix: GRFN Ingest
release_branch: prod
develop_branch: test
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
16 changes: 2 additions & 14 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@

jobs:

flake8:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: 3.12

- run: |
python -m pip install --upgrade pip
python -m pip install flake8 flake8-import-order flake8-builtins # FIXME add flake8-blind-except
- run: flake8 --max-line-length=120 --import-order-style=pycharm --statistics --application-import-names metadata_construction verify
call-ruff-workflow:
uses: ASFHyP3/actions/.github/workflows/[email protected]

cfn-lint:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
jobs:
call-bump-version-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.11.1
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.13.2
with:
user: tools-bot
email: [email protected]
secrets:
USER_TOKEN: ${{ secrets.TOOLS_BOT_PAK }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions Job or Workflow does not set permissions
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
steps:
- uses: actions/checkout@v4

- uses: mamba-org/provision-with-micromamba@v16
- uses: mamba-org/setup-micromamba@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Test with pytest' step
Uses Step
uses 'mamba-org/setup-micromamba' with ref 'v2', not a pinned commit hash
with:
environment-file: environment.yml

- shell: bash -l {0}
run: |
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/)
and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.2]
### Changed
- Replaced `flake8` with `ruff`.

## [2.0.1]
### Changed
- Upgraded all Lambda functions to Python 3.12
Expand Down
1 change: 1 addition & 0 deletions cmr-token/src/cmr_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import boto3
import requests_pkcs12


log = getLogger()
log.setLevel('INFO')
s3 = boto3.client('s3')
Expand Down
2 changes: 1 addition & 1 deletion ingest/src/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def lambda_handler(event, context):
'Browse': {
'Bucket': config['browse_bucket'],
'Key': browse_output_key,
}
},
}
log.info('Done processing %s', event['ProductName'])
return output
5 changes: 3 additions & 2 deletions invoke/src/invoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ def invoke_ingest(config):
log.warning('Processed %s of %s messages. Exiting.', messages_processed, config['max_messages_to_process'])
break

messages = queue.receive_messages(MaxNumberOfMessages=config['max_messages_per_receive'],
WaitTimeSeconds=config['wait_time_in_seconds'])
messages = queue.receive_messages(
MaxNumberOfMessages=config['max_messages_per_receive'], WaitTimeSeconds=config['wait_time_in_seconds']
)
if not messages:
log.info('No messages found. Exiting.')
break
Expand Down
49 changes: 22 additions & 27 deletions metadata-construction/src/metadata_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import boto3


log = getLogger()
log.setLevel('INFO')
CONFIG = json.loads(os.getenv('CONFIG'))
Expand Down Expand Up @@ -51,7 +52,7 @@ def get_sds_metadata(obj):
def format_polygon(polygon):
coordinates = []
for long, lat in reversed(polygon):
coordinates.append({"Latitude": lat, "Longitude": long})
coordinates.append({'Latitude': lat, 'Longitude': long})
return coordinates


Expand Down Expand Up @@ -111,38 +112,32 @@ def render_granule_metadata(sds_metadata, config, product, browse) -> dict:
'Type': 'Update',
},
],
"DataGranule": {
"ArchiveAndDistributionInformation": [
{
"Name": os.path.basename(product['Key']),
"SizeInBytes": get_s3_file_size(product)
}
'DataGranule': {
'ArchiveAndDistributionInformation': [
{'Name': os.path.basename(product['Key']), 'SizeInBytes': get_s3_file_size(product)}
],
"DayNightFlag": "Unspecified",
"ProductionDateTime": sds_metadata['creation_timestamp']
'DayNightFlag': 'Unspecified',
'ProductionDateTime': sds_metadata['creation_timestamp'],
},
"Platforms": [
{"ShortName": platform} for platform in sorted(set(sds_metadata['metadata']['platform']))
],
"OrbitCalculatedSpatialDomains": [
{"OrbitNumber": orbit} for orbit in sds_metadata['metadata']['orbit_number']
'Platforms': [{'ShortName': platform} for platform in sorted(set(sds_metadata['metadata']['platform']))],
'OrbitCalculatedSpatialDomains': [{'OrbitNumber': orbit} for orbit in sds_metadata['metadata']['orbit_number']],
'InputGranules': sds_metadata['metadata']['reference_scenes'] + sds_metadata['metadata']['secondary_scenes'],
'AdditionalAttributes': [
{'Name': 'ASCENDING_DESCENDING', 'Values': [sds_metadata['metadata']['orbit_direction']]},
{'Name': 'BEAM_MODE', 'Values': [sds_metadata['metadata']['beam_mode']]},
{'Name': 'POLARIZATION', 'Values': [sds_metadata['metadata']['polarization']]},
{'Name': 'PERPENDICULAR_BASELINE', 'Values': [str(sds_metadata['metadata']['perpendicular_baseline'])]},
{'Name': 'VERSION', 'Values': [sds_metadata['metadata']['version']]},
{'Name': 'FRAME_NUMBER', 'Values': [str(sds_metadata['metadata']['frame_number'])]},
{'Name': 'PATH_NUMBER', 'Values': [str(sds_metadata['metadata']['track_number'])]},
{'Name': 'TEMPORAL_BASELINE_DAYS', 'Values': [str(sds_metadata['metadata']['temporal_baseline_days'])]},
],
"InputGranules": sds_metadata['metadata']['reference_scenes'] + sds_metadata['metadata']['secondary_scenes'],
"AdditionalAttributes": [
{"Name": "ASCENDING_DESCENDING", "Values": [sds_metadata['metadata']['orbit_direction']]},
{"Name": "BEAM_MODE", "Values": [sds_metadata['metadata']['beam_mode']]},
{"Name": "POLARIZATION", "Values": [sds_metadata['metadata']['polarization']]},
{"Name": "PERPENDICULAR_BASELINE", "Values": [str(sds_metadata['metadata']['perpendicular_baseline'])]},
{"Name": "VERSION", "Values": [sds_metadata['metadata']['version']]},
{"Name": "FRAME_NUMBER", "Values": [str(sds_metadata['metadata']['frame_number'])]},
{"Name": "PATH_NUMBER", "Values": [str(sds_metadata['metadata']['track_number'])]},
{"Name": "TEMPORAL_BASELINE_DAYS", "Values": [str(sds_metadata['metadata']['temporal_baseline_days'])]}
]
}

if 'weather_model' in sds_metadata['metadata']:
umm['AdditionalAttributes'].append({"Name": "WEATHER_MODEL",
"Values": sds_metadata['metadata']['weather_model']})
umm['AdditionalAttributes'].append(
{'Name': 'WEATHER_MODEL', 'Values': sds_metadata['metadata']['weather_model']}
)

return umm

Expand Down
1 change: 1 addition & 0 deletions metadata-to-cmr/src/cmr.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import boto3
import requests


log = getLogger()


Expand Down
8 changes: 6 additions & 2 deletions metadata-to-cmr/src/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import boto3
from botocore.client import Config
from botocore.exceptions import ClientError

from cmr import get_session, process_task


Expand Down Expand Up @@ -44,8 +45,11 @@ def daemon_loop(config, get_remaining_time_in_millis_fcn):
sfn_client = get_sfn_client(config['sfn_connect_timeout'])
while True:
if get_remaining_time_in_millis_fcn() < config['max_task_time_in_millis']:
log.info('Remaining time %s less than max task time %s. Exiting.', get_remaining_time_in_millis_fcn(),
config['max_task_time_in_millis'])
log.info(
'Remaining time %s less than max task time %s. Exiting.',
get_remaining_time_in_millis_fcn(),
config['max_task_time_in_millis'],
)
break

task = get_task(sfn_client, config['activity'])
Expand Down
30 changes: 30 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
[project]
requires-python = "==3.12"

[tool.ruff]
line-length = 120
# The directories to consider when resolving first- vs. third-party imports.
# See: https://docs.astral.sh/ruff/settings/#src
src = ["**/src", "tests"]

[tool.ruff.format]
indent-style = "space"
quote-style = "single"

[tool.ruff.lint]
extend-select = [
"I", # isort: https://docs.astral.sh/ruff/rules/#isort-i
"UP", # pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up

# TODO: uncomment the following extensions and address their warnings:
#"D", # pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d
#"ANN", # annotations: https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
#"PTH", # use-pathlib-pth: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
case-sensitive = true
lines-after-imports = 2
2 changes: 1 addition & 1 deletion requirements-cmr-token.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
boto3==1.34.131
boto3==1.35.90
requests-pkcs12==1.25
2 changes: 1 addition & 1 deletion requirements-ingest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.34.131
boto3==1.35.90
2 changes: 1 addition & 1 deletion requirements-invoke.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.34.131
boto3==1.35.90
2 changes: 1 addition & 1 deletion requirements-metadata-construction.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.34.131
boto3==1.35.90
2 changes: 1 addition & 1 deletion requirements-metadata-to-cmr.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
boto3==1.34.131
boto3==1.35.90
requests==2.32.3
2 changes: 1 addition & 1 deletion requirements-notify.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
boto3==1.34.131
boto3==1.35.90
4 changes: 2 additions & 2 deletions requirements-verify.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
boto3==1.34.131
jsonschema==4.22.0
boto3==1.35.90
jsonschema==4.23.0
13 changes: 5 additions & 8 deletions tests/test_metadata_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_get_file_content_from_s3(s3_stubber):
s3_stubber.add_response(
method='get_object',
expected_params={'Bucket': 'myBucket', 'Key': 'myKey'},
service_response={'Body': io.StringIO('myContent')}
service_response={'Body': io.StringIO('myContent')},
)
assert metadata_construction.get_file_content_from_s3('myBucket', 'myKey') == 'myContent'

Expand All @@ -32,18 +32,15 @@ def test_write_to_file(tmp_path):


def test_get_s3_file_size(s3_stubber):
obj = {
'Bucket': 'myBucket',
'Key': 'myKey'
}
obj = {'Bucket': 'myBucket', 'Key': 'myKey'}
s3_stubber.add_response(method='head_object', expected_params=obj, service_response={'ContentLength': 123})
assert metadata_construction.get_s3_file_size(obj) == 123


def test_get_sds_metadata(test_data_dir, s3_stubber):
obj = {
'Bucket': 'ingest-test-aux',
'Key': 'S1-GUNW-D-R-123-tops-20240212_20240107-032647-00038E_00036N-PP-2e78-v3_0_0'
'Key': 'S1-GUNW-D-R-123-tops-20240212_20240107-032647-00038E_00036N-PP-2e78-v3_0_0',
}

sds_metadata_file = test_data_dir / 'granule1' / 'sds_metadata.json'
Expand All @@ -55,7 +52,7 @@ def test_get_sds_metadata(test_data_dir, s3_stubber):


def test_create_granule_metadata_in_s3_g1(test_data_dir, mocker):
sds_metadata =json.loads((test_data_dir / 'granule1'/ 'sds_metadata.json').read_text())
sds_metadata = json.loads((test_data_dir / 'granule1' / 'sds_metadata.json').read_text())
inputs = json.loads((test_data_dir / 'granule1' / 'inputs.json').read_text())
config = json.loads((test_data_dir / 'granule1' / 'config.json').read_text())

Expand All @@ -80,7 +77,7 @@ def test_create_granule_metadata_in_s3_g1(test_data_dir, mocker):


def test_create_granule_metadata_in_s3_g2(test_data_dir, mocker):
sds_metadata =json.loads((test_data_dir / 'granule2'/ 'sds_metadata.json').read_text())
sds_metadata = json.loads((test_data_dir / 'granule2' / 'sds_metadata.json').read_text())
inputs = json.loads((test_data_dir / 'granule2' / 'inputs.json').read_text())
config = json.loads((test_data_dir / 'granule2' / 'config.json').read_text())

Expand Down
2 changes: 1 addition & 1 deletion tests/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def test_get_file_content_from_s3(s3_stubber):
s3_stubber.add_response(
method='get_object',
expected_params={'Bucket': 'myBucket', 'Key': 'myKey'},
service_response={'Body': io.StringIO('myContent')}
service_response={'Body': io.StringIO('myContent')},
)
assert verify.get_file_content_from_s3('myBucket', 'myKey') == 'myContent'

Expand Down
2 changes: 1 addition & 1 deletion verify/src/verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_file_content_from_s3(bucket, key):


def get_json_from_file(filename):
with open(filename, 'r') as f:
with open(filename) as f:
content = f.read()
return json.loads(content)

Expand Down
Loading