changeset 971:75fa071ae688 pg-next-1099

test update-custom-data for PG 11
author Alain Mazy <am@orthanc.team>
date Fri, 18 Sep 2026 14:47:04 +0200
parents a1f8353c0e61
children d4eacd47d487 7c3041d6c17c
files NewTests/NonRegressionPerfs/docker-compose.yml NewTests/NonRegressionPerfs/plugin.py NewTests/NonRegressionPerfs/test_non_regression_perfs.py NewTests/README Tests/Tests.py
diffstat 5 files changed, 32 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/NewTests/NonRegressionPerfs/docker-compose.yml	Mon Sep 14 19:46:29 2026 +0200
+++ b/NewTests/NonRegressionPerfs/docker-compose.yml	Fri Sep 18 14:47:04 2026 +0200
@@ -5,7 +5,9 @@
     depends_on: [orthanc-ref-db]
     restart: unless-stopped
     ports: ["8142:8042"]
-    volumes: ["storage-orthanc-ref:/var/lib/orthanc/db"]
+    volumes: 
+      - storage-orthanc-ref:/var/lib/orthanc/db
+      - ./plugin.py:/scripts/plugin.py
     environment:
       VERBOSE_ENABLED: "true"
       ORTHANC__POSTGRESQL__HOST: "orthanc-ref-db"
@@ -13,7 +15,8 @@
         {
           "Name": "Orthanc-ref",
           "AuthenticationEnabled": false,
-          "OverwriteInstances": true
+          "OverwriteInstances": true,
+          "PythonScript": "/scripts/plugin.py"
         }
 
   orthanc-new:
@@ -21,7 +24,9 @@
     depends_on: [orthanc-new-db]
     restart: unless-stopped
     ports: ["8143:8042"]
-    volumes: ["storage-orthanc-new:/var/lib/orthanc/db"]
+    volumes: 
+      - storage-orthanc-new:/var/lib/orthanc/db
+      - ./plugin.py:/scripts/plugin.py
     environment:
       VERBOSE_ENABLED: "true"
       ORTHANC__POSTGRESQL__HOST: "orthanc-new-db"
@@ -29,7 +34,8 @@
         {
           "Name": "Orthanc-under-tests",
           "AuthenticationEnabled": false,
-          "OverwriteInstances": true
+          "OverwriteInstances": true,
+          "PythonScript": "/scripts/plugin.py"
         }
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/NewTests/NonRegressionPerfs/plugin.py	Fri Sep 18 14:47:04 2026 +0200
@@ -0,0 +1,13 @@
+import orthanc
+import json
+
+def update_custom_data(output, uri, **request):
+    if request['method'] == 'POST':
+        instance_id = request['groups'][0]
+
+        attachment_uuid = json.loads(orthanc.RestApiGet(f'/instances/{instance_id}/attachments/dicom/info'))['Uuid']
+        orthanc.SetAttachmentCustomData(attachment_uuid, b'dummy')
+
+    output.AnswerBuffer('ok', 'text/plain')
+
+orthanc.RegisterRestCallback('/instances/(.*)/update-custom-data', update_custom_data)
\ No newline at end of file
--- a/NewTests/NonRegressionPerfs/test_non_regression_perfs.py	Mon Sep 14 19:46:29 2026 +0200
+++ b/NewTests/NonRegressionPerfs/test_non_regression_perfs.py	Fri Sep 18 14:47:04 2026 +0200
@@ -142,7 +142,13 @@
         print(f"{'-'*129}")
 
         self.measure(test_name="populate 3000 instances with 5 workers",
-                     perform_test=lambda o: OrthancTestDbPopulator(o, studies_count=5, series_count=3, instances_count=120, random_seed=65, worker_threads_count=5).execute(),
+                     perform_test=lambda o: OrthancTestDbPopulator(o, studies_count=50, series_count=3, instances_count=120, random_seed=65, worker_threads_count=5).execute(),
+                     reapeat_count=1,
+                     test_configs=test_configs,
+                     test_results=test_results)
+
+        self.measure(test_name="update attachments custom data (1000)",
+                     perform_test=lambda o: [o.post(f"/instances/{i}/update-custom-data", json={}) for i in random.sample(o.instances.get_all_ids(), 2000)],
                      reapeat_count=1,
                      test_configs=test_configs,
                      test_results=test_results)
--- a/NewTests/README	Mon Sep 14 19:46:29 2026 +0200
+++ b/NewTests/README	Fri Sep 18 14:47:04 2026 +0200
@@ -290,6 +290,6 @@
 with Docker:
 
 python3 NewTests/main.py --pattern=NonRegressionPerfs.test_non_regression_perfs.TestNonRegressionPerfs.* \
-                         --orthanc_under_tests_docker_image=orthancteam/orthanc-pre-release:pg-next-1099-full-unstable-before-tests-amd64 \
+                         --orthanc_under_tests_docker_image=orthancteam/orthanc-pre-release:master-unstable \
                          --orthanc_under_tests_http_port=8043
 
--- a/Tests/Tests.py	Mon Sep 14 19:46:29 2026 +0200
+++ b/Tests/Tests.py	Fri Sep 18 14:47:04 2026 +0200
@@ -10982,7 +10982,7 @@
             studyLastUpdate1 = DoGet(_REMOTE, '/studies/%s/metadata/LastUpdate' % i['ParentStudy'])
             patientLastUpdate1 = DoGet(_REMOTE, '/patients/%s/metadata/LastUpdate' % i['ParentPatient'])
             
-            time.sleep(1.01)
+            time.sleep(1.1)
             DoDelete(_REMOTE, '/instances/%s' % j['ID'])
 
             #instanceLastUpdate2 = DoGet(_REMOTE, '/instances/%s/metadata/LastUpdate' % i['ID'])