Mercurial > hg > orthanc-tests
changeset 913:efa7ebc0e07d
c-get tests when testing against a recent Orthanc to detect memory leaks asap
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Wed, 06 May 2026 15:13:14 +0200 |
| parents | df69f0dbe321 |
| children | fb36c27eb607 |
| files | Tests/Run.py Tests/Tests.py |
| diffstat | 2 files changed, 29 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Tests/Run.py Wed May 06 14:23:46 2026 +0200 +++ b/Tests/Run.py Wed May 06 15:13:14 2026 +0200 @@ -104,13 +104,20 @@ config = re.sub(r'("HttpPort"\s*:)\s*.*?,', r'\1 5000,', config) config = re.sub(r'("RemoteAccessAllowed"\s*:)\s*false', r'\1 true', config) config = re.sub(r'("AuthenticationEnabled"\s*:)\s*false,', r'', config) # Set with "RegisteredUsers" -config = re.sub(r'("RegisteredUsers"\s*:)\s*{', r'"AuthenticationEnabled" : true, \1 { "alice" : "orthanctest"', config) config = re.sub(r'("ExecuteLuaEnabled"\s*:)\s*false', r'\1 true', config) config = re.sub(r'("HttpCompressionEnabled"\s*:)\s*true', r'\1 false', config) config = re.sub(r'("DicomAssociationCloseDelay"\s*:)\s*[0-9]*', r'\1 0', config) config = re.sub(r'("DicomModalities"\s*:)\s*{', r'\1 { "orthanc" : [ "%s", "%s", %s ], "orthanc2" : [ "OT-FROM-CONFIG", "%s", %s]' % (args.aet, args.server, args.dicom, args.server, args.dicom), config) +registeredUsersPatternPost1_12_9 = r'/\*\*\s*"RegisteredUsers"\s*:\s*\{\s*//\s*"alice"\s*:\s*"alicePassword"\s*\},\s*\*\*/' +if re.search(registeredUsersPatternPost1_12_9, config, flags=re.DOTALL): + print("LOCAL orthanc is >= 1.12.9") + config = re.sub(registeredUsersPatternPost1_12_9, '"AuthenticationEnabled": true, "RegisteredUsers": {"alice" : "orthanctest"},', config, flags=re.DOTALL) +else: + print("LOCAL orthanc is < 1.12.9") + config = re.sub(r'("RegisteredUsers"\s*:)\s*{', r'"AuthenticationEnabled" : true, \1 { "alice" : "orthanctest"', config) + # New to test transcoding over DICOM (1.7.0) config = re.sub(r'("RleTransferSyntaxAccepted"\s*:)\s*true', r'\1 false', config)
--- a/Tests/Tests.py Wed May 06 14:23:46 2026 +0200 +++ b/Tests/Tests.py Wed May 06 15:13:14 2026 +0200 @@ -12717,3 +12717,24 @@ # note: unable to test with storescu since it does not support deeply nested sequences and crashes + + # small functional test, mainly to detect memory leaks (https://github.com/orthanc-server/orthanc-builder/issues/36) + def test_cget_scu(self): + if IsOrthancVersionAbove(_LOCAL, 1, 7, 0): # C-GET SCP has been introduced in 1.7.0 + instance = UploadInstance(_LOCAL, 'Brainix/Flair/IM-0001-0001.dcm') + study = DoGet(_LOCAL, '/studies/%s' % instance['ParentStudy']) + + r = DoPost(_REMOTE, '/modalities/orthanctest/get', { 'Resources':[ { 'StudyInstanceUID' : study['MainDicomTags']['StudyInstanceUID'] }], + 'Level': 'Study' }) + self.assertEqual(1, len(r['Details'][0]['ReceivedInstancesIds'])) + + # small functional test, mainly to detect memory leaks (https://github.com/orthanc-server/orthanc-builder/issues/36) + def test_cget_scp(self): + if IsOrthancVersionAbove(_LOCAL, 1, 12, 6): # C-GET SCU has been introduced in 1.12.6 + instance = UploadInstance(_REMOTE, 'Brainix/Flair/IM-0001-0001.dcm') + study = DoGet(_REMOTE, '/studies/%s' % instance['ParentStudy']) + + r = DoPost(_LOCAL, '/modalities/orthanc/get', { 'Resources':[ { 'StudyInstanceUID' : study['MainDicomTags']['StudyInstanceUID'] }], + 'Level': 'Study' }) + pprint.pprint(r) + # self.assertEqual(1, len(r['Details'][0]['ReceivedInstancesIds']))
