annotate NewTests/PostgresUpgrades/test_pg_upgrades.py @ 623:3bb4b2589030

fix PG test upgrades
author Alain Mazy <am@osimis.io>
date Wed, 07 Feb 2024 11:43:32 +0100
parents d743c210cbc8
children ddf83317c7e0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
1 import subprocess
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
2 import time
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
3 import unittest
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
4 from orthanc_api_client import OrthancApiClient
601
3e15e950c462 new transfer tests in the concurrency section
Alain Mazy <am@osimis.io>
parents: 600
diff changeset
5 from helpers import Helpers, wait_container_healthy
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
6
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
7 import pathlib
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
8 import os
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
9 here = pathlib.Path(__file__).parent.resolve()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
10
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
11
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
12 class TestPgUpgrades(unittest.TestCase):
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
13
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
14 @classmethod
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
15 def cleanup(cls):
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
16 os.chdir(here)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
17 print("Cleaning old compose")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
18 subprocess.run(["docker", "compose", "down", "-v", "--remove-orphans"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
19
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
20
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
21 @classmethod
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
22 def setUpClass(cls):
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
23 cls.cleanup()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
24
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
25 @classmethod
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
26 def tearDownClass(cls):
601
3e15e950c462 new transfer tests in the concurrency section
Alain Mazy <am@osimis.io>
parents: 600
diff changeset
27 cls.cleanup()
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
28
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
29
607
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
30 def test_upgrade_61_to_62(self):
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
31 # remove everything including the DB from previous tests
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
32 TestPgUpgrades.cleanup()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
33
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
34 print("Pullling container")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
35 subprocess.run(["docker", "compose", "pull"], check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
36
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
37 print("Launching PG-15 server")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
38 subprocess.run(["docker", "compose", "up", "pg-15", "-d"], check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
39 wait_container_healthy("pg-15")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
40
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
41 print("Launching Orthanc with 6.1 DB")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
42 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-61", "-d"], check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
43
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
44 o = OrthancApiClient("http://localhost:8052")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
45 o.wait_started()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
46
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
47 instances = o.upload_folder(here / "../../Database/Knee")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
48
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
49 print("Stopping Orthanc with 6.1 DB")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
50 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-61"], check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
51 time.sleep(2)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
52
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
53 print("Launching newest Orthanc")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
54 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"],
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
55 env= {
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
56 "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
57 },
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
58 check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
59
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
60 o = OrthancApiClient("http://localhost:8050")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
61 o.wait_started()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
62
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
63 # make sure we can 'play' with this Orthanc
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
64 o.instances.get_tags(orthanc_id=instances[0])
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
65 o.instances.delete_all()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
66 self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize']))
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
67 instances = o.upload_folder(here / "../../Database/Knee")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
68 size_before_downgrade = int(o.get_json('/statistics')['TotalDiskSize'])
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
69
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
70 print("Stopping newest Orthanc ")
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
71 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-under-tests"], check=True)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
72 time.sleep(2)
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
73
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
74 def test_upgrades_downgrades_with_pg_15(self):
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
75
607
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
76 # remove everything including the DB from previous tests
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
77 TestPgUpgrades.cleanup()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
78
600
58384ae69f41 added docker pull to avoid timeout
Alain Mazy <am@osimis.io>
parents: 599
diff changeset
79 print("Pullling container")
58384ae69f41 added docker pull to avoid timeout
Alain Mazy <am@osimis.io>
parents: 599
diff changeset
80 subprocess.run(["docker", "compose", "pull"], check=True)
58384ae69f41 added docker pull to avoid timeout
Alain Mazy <am@osimis.io>
parents: 599
diff changeset
81
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
82 print("Launching PG-15 server")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
83 subprocess.run(["docker", "compose", "up", "pg-15", "-d"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
84 wait_container_healthy("pg-15")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
85
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
86 print("Launching old Orthanc (PG v2.0)")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
87 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-2", "-d"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
88
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
89 o = OrthancApiClient("http://localhost:8049")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
90 o.wait_started()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
91
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
92 instances = o.upload_folder(here / "../../Database/Knee")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
93
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
94 print("Stopping old Orthanc ")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
95 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-2"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
96 time.sleep(2)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
97
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
98 print("Launching newest Orthanc")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
99 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"],
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
100 env= {
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
101 "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
102 },
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
103 check=True)
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
104
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
105 o = OrthancApiClient("http://localhost:8050")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
106 o.wait_started()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
107
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
108 # make sure we can 'play' with Orthanc
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
109 o.instances.get_tags(orthanc_id=instances[0])
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
110 o.instances.delete_all()
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
111 self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize']))
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
112 instances = o.upload_folder(here / "../../Database/Knee")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
113 size_before_downgrade = int(o.get_json('/statistics')['TotalDiskSize'])
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
114
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
115 print("Stopping newest Orthanc ")
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
116 subprocess.run(["docker", "compose", "stop", "orthanc-pg-15-under-tests"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
117 time.sleep(2)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
118
623
3bb4b2589030 fix PG test upgrades
Alain Mazy <am@osimis.io>
parents: 607
diff changeset
119 print("Downgrading Orthanc DB to Rev1")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
120 subprocess.run(["docker", "exec", "pg-15", "./scripts/downgrade.sh"], check=True)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
121 time.sleep(2)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
122
623
3bb4b2589030 fix PG test upgrades
Alain Mazy <am@osimis.io>
parents: 607
diff changeset
123 print("Launching previous Orthanc (DB Rev1)")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
124 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-61", "-d"], check=True)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
125
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
126 o = OrthancApiClient("http://localhost:8052")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
127 o.wait_started()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
128
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
129 # make sure we can 'play' with Orthanc
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
130 o.instances.get_tags(orthanc_id=instances[0])
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
131 self.assertEqual(size_before_downgrade, int(o.get_json('/statistics')['TotalDiskSize']))
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
132 o.instances.delete_all()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
133 self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize']))
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
134 instances = o.upload_folder(here / "../../Database/Knee")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
135 o.instances.delete_all()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
136 self.assertEqual(0, int(o.get_json('/statistics')['TotalDiskSize']))
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
137
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
138 print("run the integration tests after a downgrade")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
139 # first create the containers (orthanc-tests + orthanc-pg-15-61-for-integ-tests) so they know each other
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
140 # subprocess.run(["docker", "compose", "create", "orthanc-tests"], check=True)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
141
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
142 # subprocess.run(["docker", "compose", "up", "orthanc-pg-15-61-for-integ-tests", "-d"], check=True)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
143
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
144 # o = OrthancApiClient("http://localhost:8053", user="alice", pwd="orthanctest")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
145 # o.wait_started()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
146
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
147 # time.sleep(10000)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
148 subprocess.run(["docker", "compose", "up", "orthanc-tests"], check=True)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
149
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
150
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
151
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
152 def test_latest_orthanc_with_pg_9(self):
607
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
153
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
154 # remove everything including the DB from previous tests
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
155 TestPgUpgrades.cleanup()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
156
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
157 print("Launching PG-9 server")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
158 subprocess.run(["docker", "compose", "up", "pg-9", "-d"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
159 wait_container_healthy("pg-9")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
160
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
161 print("Launching newest Orthanc")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
162 subprocess.run(
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
163 ["docker", "compose", "up", "orthanc-pg-9-under-tests", "-d"],
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
164 env= {
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
165 "ORTHANC_IMAGE_UNDER_TESTS": Helpers.orthanc_under_tests_docker_image
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
166 },
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
167 check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
168
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
169 o = OrthancApiClient("http://localhost:8051")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
170 o.wait_started()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
171 instances = o.upload_folder(here / "../../Database/Knee")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
172 o.instances.delete(orthanc_ids=instances)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
173
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
174 subprocess.run(["docker", "compose", "down", "-v", "--remove-orphans"], check=True)