annotate NewTests/PostgresUpgrades/test_pg_upgrades.py @ 630:e1bc43b5a7d2

fix leading /
author Alain Mazy <am@osimis.io>
date Wed, 28 Feb 2024 12:50:49 +0100
parents ddf83317c7e0
children
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")
628
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
54 subprocesss_env = os.environ.copy()
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
55 subprocesss_env["ORTHANC_IMAGE_UNDER_TESTS"] = Helpers.orthanc_under_tests_docker_image
607
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
56 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"],
628
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
57 env=subprocesss_env, check=True)
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
58
607
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()
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
66 self.assertEqual(0, int(o.get_json('statistics')['TotalDiskSize']))
607
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")
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
68 size_before_downgrade = int(o.get_json('statistics')['TotalDiskSize'])
607
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")
628
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
99 subprocesss_env = os.environ.copy()
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
100 subprocesss_env["ORTHANC_IMAGE_UNDER_TESTS"] = Helpers.orthanc_under_tests_docker_image
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
101 subprocess.run(["docker", "compose", "up", "orthanc-pg-15-under-tests", "-d"],
628
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
102 env=subprocesss_env, check=True)
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
103
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
104 o = OrthancApiClient("http://localhost:8050")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
105 o.wait_started()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
106
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
107 # make sure we can 'play' with Orthanc
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
108 o.instances.get_tags(orthanc_id=instances[0])
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
109 o.instances.delete_all()
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
110 self.assertEqual(0, int(o.get_json('statistics')['TotalDiskSize']))
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
111 instances = o.upload_folder(here / "../../Database/Knee")
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
112 size_before_downgrade = int(o.get_json('statistics')['TotalDiskSize'])
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
113
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
114 print("Stopping newest Orthanc ")
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
115 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
116 time.sleep(2)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
117
623
3bb4b2589030 fix PG test upgrades
Alain Mazy <am@osimis.io>
parents: 607
diff changeset
118 print("Downgrading Orthanc DB to Rev1")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
119 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
120 time.sleep(2)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
121
623
3bb4b2589030 fix PG test upgrades
Alain Mazy <am@osimis.io>
parents: 607
diff changeset
122 print("Launching previous Orthanc (DB Rev1)")
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
123 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
124
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
125 o = OrthancApiClient("http://localhost:8052")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
126 o.wait_started()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
127
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
128 # make sure we can 'play' with Orthanc
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
129 o.instances.get_tags(orthanc_id=instances[0])
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
130 self.assertEqual(size_before_downgrade, int(o.get_json('statistics')['TotalDiskSize']))
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
131 o.instances.delete_all()
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
132 self.assertEqual(0, int(o.get_json('statistics')['TotalDiskSize']))
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
133 instances = o.upload_folder(here / "../../Database/Knee")
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
134 o.instances.delete_all()
630
e1bc43b5a7d2 fix leading /
Alain Mazy <am@osimis.io>
parents: 628
diff changeset
135 self.assertEqual(0, int(o.get_json('statistics')['TotalDiskSize']))
599
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
136
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
137 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
138 # 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
139 # 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
140
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
141 # 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
142
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
143 # 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
144 # o.wait_started()
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
145
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
146 # time.sleep(10000)
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
147 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
148
f3475c3e42e5 run integ tests after a PG downgrade
Alain Mazy <am@osimis.io>
parents: 596
diff changeset
149
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
150
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
151 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
152
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
153 # 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
154 TestPgUpgrades.cleanup()
d743c210cbc8 test pg upgrade from 6.1 to 6.2
Alain Mazy <am@osimis.io>
parents: 601
diff changeset
155
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
156 print("Launching PG-9 server")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
157 subprocess.run(["docker", "compose", "up", "pg-9", "-d"], check=True)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
158 wait_container_healthy("pg-9")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
159
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
160 print("Launching newest Orthanc")
628
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
161 subprocesss_env = os.environ.copy()
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
162 subprocesss_env["ORTHANC_IMAGE_UNDER_TESTS"] = Helpers.orthanc_under_tests_docker_image
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
163 subprocess.run(["docker", "compose", "up", "orthanc-pg-9-under-tests", "-d"],
ddf83317c7e0 patch compose env vars
Alain Mazy <am@osimis.io>
parents: 623
diff changeset
164 env=subprocesss_env, check=True)
596
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
165
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
166 o = OrthancApiClient("http://localhost:8051")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
167 o.wait_started()
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
168 instances = o.upload_folder(here / "../../Database/Knee")
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
169 o.instances.delete(orthanc_ids=instances)
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
170
b1e1c7149a37 new PG upgrades tests
Alain Mazy <am@osimis.io>
parents:
diff changeset
171 subprocess.run(["docker", "compose", "down", "-v", "--remove-orphans"], check=True)