diff NewTests/PostgresUpgrades/test_pg_upgrades.py @ 601:3e15e950c462

new transfer tests in the concurrency section
author Alain Mazy <am@osimis.io>
date Fri, 19 Jan 2024 15:03:47 +0100
parents 58384ae69f41
children d743c210cbc8
line wrap: on
line diff
--- a/NewTests/PostgresUpgrades/test_pg_upgrades.py	Fri Jan 19 09:15:57 2024 +0100
+++ b/NewTests/PostgresUpgrades/test_pg_upgrades.py	Fri Jan 19 15:03:47 2024 +0100
@@ -2,37 +2,13 @@
 import time
 import unittest
 from orthanc_api_client import OrthancApiClient
-from helpers import Helpers
+from helpers import Helpers, wait_container_healthy
 
 import pathlib
 import os
 here = pathlib.Path(__file__).parent.resolve()
 
 
-def get_container_health(container_name):
-    try:
-        # Run the docker inspect command
-        result = subprocess.run(
-            ["docker", "inspect", "--format", "{{.State.Health.Status}}", container_name],
-            capture_output=True,
-            text=True,
-            check=True,
-        )
-        
-        # Extract the health status from the command output
-        return result.stdout.strip()
-
-    except subprocess.CalledProcessError as e:
-        print(f"Error checking container health: {e}")
-        return None
-
-def wait_container_healthy(container_name):
-    retry = 0
-
-    while (get_container_health(container_name) != "healthy" and retry < 200):
-        print(f"Waiting for {container_name} to be healty")
-        time.sleep(1)
-
 class TestPgUpgrades(unittest.TestCase):
 
     @classmethod
@@ -48,8 +24,7 @@
 
     @classmethod
     def tearDownClass(cls):
-        pass
-        # cls.cleanup()
+        cls.cleanup()
 
 
     def test_upgrades_downgrades_with_pg_15(self):