changeset 607:d743c210cbc8

test pg upgrade from 6.1 to 6.2
author Alain Mazy <am@osimis.io>
date Wed, 24 Jan 2024 10:34:07 +0100
parents 0700fe8e2b78
children ba06331ac8dd
files NewTests/PostgresUpgrades/test_pg_upgrades.py
diffstat 1 files changed, 51 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/NewTests/PostgresUpgrades/test_pg_upgrades.py	Tue Jan 23 12:22:07 2024 +0100
+++ b/NewTests/PostgresUpgrades/test_pg_upgrades.py	Wed Jan 24 10:34:07 2024 +0100
@@ -27,8 +27,55 @@
         cls.cleanup()
 
 
+    def test_upgrade_61_to_62(self):
+        # remove everything including the DB from previous tests
+        TestPgUpgrades.cleanup()
+
+        print("Pullling container")
+        subprocess.run(["docker", "compose", "pull"], check=True)
+
+        print("Launching PG-15 server")
+        subprocess.run(["docker", "compose", "up", "pg-15", "-d"], check=True)
+        wait_container_healthy("pg-15")
+
+        print("Launching Orthanc with 6.1 DB")
+        subprocess.run(["docker", "compose", "up", "orthanc-pg-15-61", "-d"], check=True)
+
+        o = OrthancApiClient("http://localhost:8052")
+        o.wait_started()
+
+        instances = o.upload_folder(here / "../../Database/Knee")
+
+        print("Stopping Orthanc with 6.1 DB")
+        subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-61"], check=True)
+        time.sleep(2)
+
+        print("Launching newest Orthanc")
+        subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"], 
+            env= {
+                "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image
+            },
+            check=True)
+
+        o = OrthancApiClient("http://localhost:8050")
+        o.wait_started()
+
+        # make sure we can 'play' with this Orthanc
+        o.instances.get_tags(orthanc_id=instances[0])
+        o.instances.delete_all()
+        self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize']))
+        instances = o.upload_folder(here / "../../Database/Knee")
+        size_before_downgrade = int(o.get_json('/statistics')['TotalDiskSize'])
+
+        print("Stopping newest Orthanc ")
+        subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-under-tests"], check=True)
+        time.sleep(2)
+
     def test_upgrades_downgrades_with_pg_15(self):
 
+        # remove everything including the DB from previous tests
+        TestPgUpgrades.cleanup()
+
         print("Pullling container")
         subprocess.run(["docker", "compose", "pull"], check=True)
 
@@ -104,6 +151,10 @@
 
 
     def test_latest_orthanc_with_pg_9(self):
+
+        # remove everything including the DB from previous tests
+        TestPgUpgrades.cleanup()
+
         print("Launching PG-9 server")
         subprocess.run(["docker", "compose", "up", "pg-9", "-d"], check=True)
         wait_container_healthy("pg-9")