Mercurial > hg > orthanc-tests
comparison NewTests/PostgresUpgrades/test_pg_upgrades.py @ 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 | 3e15e950c462 |
children | 3bb4b2589030 |
comparison
equal
deleted
inserted
replaced
606:0700fe8e2b78 | 607:d743c210cbc8 |
---|---|
25 @classmethod | 25 @classmethod |
26 def tearDownClass(cls): | 26 def tearDownClass(cls): |
27 cls.cleanup() | 27 cls.cleanup() |
28 | 28 |
29 | 29 |
30 def test_upgrade_61_to_62(self): | |
31 # remove everything including the DB from previous tests | |
32 TestPgUpgrades.cleanup() | |
33 | |
34 print("Pullling container") | |
35 subprocess.run(["docker", "compose", "pull"], check=True) | |
36 | |
37 print("Launching PG-15 server") | |
38 subprocess.run(["docker", "compose", "up", "pg-15", "-d"], check=True) | |
39 wait_container_healthy("pg-15") | |
40 | |
41 print("Launching Orthanc with 6.1 DB") | |
42 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-61", "-d"], check=True) | |
43 | |
44 o = OrthancApiClient("http://localhost:8052") | |
45 o.wait_started() | |
46 | |
47 instances = o.upload_folder(here / "../../Database/Knee") | |
48 | |
49 print("Stopping Orthanc with 6.1 DB") | |
50 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-61"], check=True) | |
51 time.sleep(2) | |
52 | |
53 print("Launching newest Orthanc") | |
54 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"], | |
55 env= { | |
56 "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image | |
57 }, | |
58 check=True) | |
59 | |
60 o = OrthancApiClient("http://localhost:8050") | |
61 o.wait_started() | |
62 | |
63 # make sure we can 'play' with this Orthanc | |
64 o.instances.get_tags(orthanc_id=instances[0]) | |
65 o.instances.delete_all() | |
66 self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize'])) | |
67 instances = o.upload_folder(here / "../../Database/Knee") | |
68 size_before_downgrade = int(o.get_json('/statistics')['TotalDiskSize']) | |
69 | |
70 print("Stopping newest Orthanc ") | |
71 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-under-tests"], check=True) | |
72 time.sleep(2) | |
73 | |
30 def test_upgrades_downgrades_with_pg_15(self): | 74 def test_upgrades_downgrades_with_pg_15(self): |
75 | |
76 # remove everything including the DB from previous tests | |
77 TestPgUpgrades.cleanup() | |
31 | 78 |
32 print("Pullling container") | 79 print("Pullling container") |
33 subprocess.run(["docker", "compose", "pull"], check=True) | 80 subprocess.run(["docker", "compose", "pull"], check=True) |
34 | 81 |
35 print("Launching PG-15 server") | 82 print("Launching PG-15 server") |
102 subprocess.run(["docker", "compose", "up", "orthanc-tests"], check=True) | 149 subprocess.run(["docker", "compose", "up", "orthanc-tests"], check=True) |
103 | 150 |
104 | 151 |
105 | 152 |
106 def test_latest_orthanc_with_pg_9(self): | 153 def test_latest_orthanc_with_pg_9(self): |
154 | |
155 # remove everything including the DB from previous tests | |
156 TestPgUpgrades.cleanup() | |
157 | |
107 print("Launching PG-9 server") | 158 print("Launching PG-9 server") |
108 subprocess.run(["docker", "compose", "up", "pg-9", "-d"], check=True) | 159 subprocess.run(["docker", "compose", "up", "pg-9", "-d"], check=True) |
109 wait_container_healthy("pg-9") | 160 wait_container_healthy("pg-9") |
110 | 161 |
111 print("Launching newest Orthanc") | 162 print("Launching newest Orthanc") |