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

More accurate orthanc-anon system test #272

Merged
merged 12 commits into from
Jan 31, 2024
Merged
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ services:
ORTHANC_RAW_AE_TITLE: ${ORTHANC_RAW_AE_TITLE}
ORTHANC_RAW_DICOM_PORT: "4242"
ORTHANC_RAW_HOSTNAME: "orthanc-raw"
PIXL_DB_HOST: ${PIXL_DB_HOST}
PIXL_DB_PORT: ${PIXL_DB_PORT}
PIXL_DB_NAME: ${PIXL_DB_NAME}
PIXL_DB_USER: ${PIXL_DB_USER}
PIXL_DB_PASSWORD: ${PIXL_DB_PASSWORD}
stefpiatek marked this conversation as resolved.
Show resolved Hide resolved
DICOM_WEB_PLUGIN_ENABLED: ${ENABLE_DICOM_WEB}
HASHER_API_AZ_NAME: "hasher-api"
HASHER_API_PORT: 8000
Expand Down
8 changes: 5 additions & 3 deletions pixl_dcmd/src/pixl_dcmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,12 @@ def hash_endpoint_path_for_tag(group: bytes, element: bytes) -> str:
return "/hash"


def _hash_values(grp: bytes, el: bytes, pat_value: str, hasher_host_url: str) -> bytes:
def _hash_values(grp: bytes, el: bytes, pat_value: str, hasher_host_url: str) -> str:
ep_path = hash_endpoint_path_for_tag(group=grp, element=el)
payload = ep_path + "?message=" + pat_value
request_url = hasher_host_url + payload
response = requests.get(request_url)
logging.info(b"RESPONSE = %a}" % response.content)
return response.content
# All three hashing endpoints return application/text so should be fine to
# use response.text here
logging.info(b"RESPONSE = %a}" % response.text)
jstutters marked this conversation as resolved.
Show resolved Hide resolved
return response.text
1 change: 1 addition & 0 deletions test/.env.test
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ ORTHANC_ANON_HTTP_TIMEOUT=60
ENABLE_DICOM_WEB=true
ORTHANC_AUTOROUTE_ANON_TO_AZURE=false
PIXL_DICOM_TRANSFER_TIMEOUT=240
STUDY_TIME_OFFSET=0

# UCVNAQR DICOM node information
VNAQR_AE_TITLE=VNAQR
Expand Down
2 changes: 1 addition & 1 deletion test/run-system-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pixl populate "${PACKAGE_DIR}/test/resources/omop"
pixl start
sleep 65 # need to wait until the DICOM image is "stable" = 60s
./scripts/check_entry_in_pixl_anon.sh
./scripts/check_entry_in_orthanc_anon.sh
./scripts/check_entry_in_orthanc_anon.py
./scripts/check_max_storage_in_orthanc_raw.sh

pixl extract-radiology-reports "${PACKAGE_DIR}/test/resources/omop"
Expand Down
15 changes: 15 additions & 0 deletions test/scripts/check_entry_in_orthanc_anon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env python3

# After pixl has run this script will query the orthanc-anon REST API to check
# that the correct number of instances have been received.
jstutters marked this conversation as resolved.
Show resolved Hide resolved

import json
import shlex
import subprocess


instances_cmd = shlex.split('docker exec -it system-test-orthanc-anon-1 curl -u "orthanc_anon_username:orthanc_anon_password" http://orthanc-anon:8042/instances')
instances_output = subprocess.run(instances_cmd, capture_output=True, check=True, text=True)
instances = json.loads(instances_output.stdout)
print("orthanc-anon instances:", instances)
assert len(instances) == 2
19 changes: 0 additions & 19 deletions test/scripts/check_entry_in_orthanc_anon.sh

This file was deleted.

Loading