Skip to content

Commit 4a2f06f

Browse files
author
ASubaran
committed
Merge branch 'master' into AMB-2347
2 parents 9087c6f + 647f386 commit 4a2f06f

19 files changed

+787
-322
lines changed

azure/templates/post-deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ steps:
113113
fi
114114
displayName: Waiting for TF resources to be UP
115115
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)"
116+
116117
- bash: |
117118
pyenv install -s 3.10.8
118119
pyenv global 3.10.8
119120
python --version
120121
displayName: Set Python 3.10
122+
121123
- bash: |
122124
set -e
123125
export RELEASE_RELEASEID=$(Build.BuildId)
@@ -167,14 +169,12 @@ steps:
167169
echo "Proxy test completed successfully as part of terraform resource up status check"
168170
169171
else
170-
echo "Cleared DB before running testcases"
171-
clear_dynamodb_script="clear_dynamodb.py"
172-
poetry run python $clear_dynamodb_script
173172
echo "running: $test_cmd -v -c"
174173
$test_cmd -v -c
175174
fi
176175
workingDirectory: "$(Pipeline.Workspace)/s/$(SERVICE_NAME)/$(SERVICE_ARTIFACT_NAME)/e2e"
177-
displayName: Run full test suite
176+
displayName: Run Full Test Suite
177+
178178
179179
180180
- bash: |
@@ -201,7 +201,7 @@ steps:
201201

202202
echo "E2E batch folder test cases executed successfully"
203203
else
204-
echo "Skipping E2E batch folder test cases as the environment is ref-prod-int"
204+
echo "Skipping E2E batch folder test cases as the environment is ref-prod-int-sandbox"
205205
fi
206206

207207
displayName: Run full batch test suite

backend/src/filter.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def replace_address_postal_codes(imms: dict) -> dict:
4747
# Remove all other keys in the address dictionary
4848
keys_to_remove = [key for key in address.keys() if key != "postalCode"]
4949
for key in keys_to_remove:
50-
del address[key]
50+
del address[key]
5151

5252
return imms
5353

@@ -59,23 +59,23 @@ def replace_organization_values(imms: dict) -> dict:
5959
"""
6060
for performer in imms.get("performer", [{}]):
6161
if performer.get("actor", {}).get("type") == "Organization":
62-
62+
6363
# Obfuscate or set the identifier value and system.
6464
identifier = performer["actor"].get("identifier", {})
6565
if identifier.get("value") is not None:
6666
identifier["value"] = "N2N9I"
6767
identifier["system"] = Urls.ods_organization_code
6868
if identifier.get("system") is not None:
6969
identifier["system"] = Urls.ods_organization_code
70-
70+
7171
# Ensure only 'system' and 'value' remain in identifier
7272
keys = {"system", "value"}
7373
keys_to_remove = [key for key in identifier.keys() if key not in keys]
7474
for key in keys_to_remove:
7575
del identifier[key]
76-
76+
7777
# Remove all other fields except 'identifier' in actor
78-
keys_to_remove = [key for key in performer["actor"].keys() if key not in ("identifier","type")]
78+
keys_to_remove = [key for key in performer["actor"].keys() if key not in ("identifier", "type")]
7979
for key in keys_to_remove:
8080
del performer["actor"][key]
8181

@@ -108,9 +108,6 @@ def search(imms: dict, patient_full_url: str, bundle_patient: dict = None) -> di
108108
imms.pop("contained")
109109
imms["patient"] = create_reference_to_patient_resource(patient_full_url, bundle_patient)
110110
imms = add_use_to_identifier(imms)
111-
# Location identifier system and value are to be overwritten
112-
# (for backwards compatibility with Immunisation History API, as agreed with VDS team)
113-
imms["location"] = {"identifier": {"system": "urn:iso:std:iso:3166", "value": "GB"}}
114111
return imms
115112

116113
@staticmethod

backend/tests/sample_data/completed_covid19_immunization_event_filtered_for_search_using_bundle_patient_resource.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@
4646
"display": "AstraZeneca Ltd"
4747
},
4848
"location": {
49+
"type": "Location",
4950
"identifier": {
50-
"value": "GB",
51-
"system": "urn:iso:std:iso:3166"
51+
"value": "X99999",
52+
"system": "https://fhir.nhs.uk/Id/ods-organization-code"
5253
}
5354
},
5455
"lotNumber": "4120Z001",

e2e/clear_dynamodb.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

e2e/extract_failed_tests.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import re
2+
import sys
3+
4+
5+
def extract_failed_tests(log_file):
6+
"""Extract failed test names from the log file.."""
7+
failed_tests = []
8+
print(f"log_file:{log_file}")
9+
with open(log_file, "r") as f:
10+
for line in f:
11+
match = re.search(r"FAIL: (\S+)", line)
12+
if match:
13+
failed_tests.append(match.group(1))
14+
return failed_tests
15+
16+
17+
if __name__ == "__main__":
18+
log_file = sys.argv[1] # Get the log file path from arguments
19+
failed_tests = extract_failed_tests(log_file)
20+
21+
# Print space-separated test names for Bash script
22+
print(" ".join(failed_tests))

e2e/test_proxy.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def test_mtls(self):
4141

4242
with self.assertRaises(requests.exceptions.RequestException) as e:
4343
requests.get(backend_health, headers={"X-Request-ID": str(uuid.uuid4())})
44-
45-
self.assertTrue("ConnectionResetError" in str(e.exception))
44+
self.assertTrue("RemoteDisconnected" in str(e.exception))
4645

4746
@staticmethod
4847
def get_backend_url() -> str:

filenameprocessor/src/audit_table.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ def upsert_audit_table(
5757
Key={AuditTableKeys.MESSAGE_ID: {"S": message_id}},
5858
UpdateExpression="SET #status = :status",
5959
ExpressionAttributeNames={"#status": "status"},
60-
# TODO: Should this be set to file_status? The status may be 'processed' due to an exception occuring
61-
ExpressionAttributeValues={":status": {"S": FileStatus.PROCESSING}},
60+
ExpressionAttributeValues={":status": {"S": file_status}},
6261
ConditionExpression="attribute_exists(message_id)",
6362
)
6463
logger.info("%s file set for processing, and the status successfully updated in audit table", file_key)

filenameprocessor/src/file_name_processor.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ def handle_record(record) -> dict:
4444
logger.error("Error obtaining file_key: %s", error)
4545
return {"statusCode": 500, "message": "Failed to download file key", "error": str(error)}
4646

47-
# The lambda is unintentionally invoked when a file is moved into a different folder in the source bucket.
48-
# Excluding file keys containing a "/" is a workaround to prevent the lambda from processing files that
49-
# are not in the root of the source bucket.
50-
if "data-sources" in bucket_name and "/" not in file_key:
47+
if "data-sources" in bucket_name:
48+
49+
# The lambda is unintentionally invoked when a file is moved into a different folder in the source bucket.
50+
# Excluding file keys containing a "/" is a workaround to prevent the lambda from processing files that
51+
# are not in the root of the source bucket.
52+
if "/" in file_key:
53+
message = "File skipped due to duplicate lambda invoaction"
54+
return {"statusCode": 200, "message": message, "file_key": file_key}
5155

5256
# Set default values for file-specific variables
5357
message_id = "Message id was not created"

0 commit comments

Comments
 (0)