Mercurial > hg > orthanc-tests
diff PerfsDb/DbServer.py @ 158:df1f9946571c
perfs db continued: tests working with tiny DBs on all setup but the sqliteplugin
author | am@osimis.io |
---|---|
date | Fri, 17 Aug 2018 11:58:26 +0200 |
parents | f1a75985caa8 |
children | dbc42a03ee75 |
line wrap: on
line diff
--- a/PerfsDb/DbServer.py Thu Aug 16 17:14:05 2018 +0200 +++ b/PerfsDb/DbServer.py Fri Aug 17 11:58:26 2018 +0200 @@ -26,16 +26,19 @@ def setLabel(self, label: str): self._label = label - def launch(self): - dockerDefinition = self.getDockerDefinition() - - # check if the container is already running + def isRunning(self) -> bool: ret = subprocess.call([ "docker", "top", self._label ]) - if ret == 0: + return ret == 0 + + def launch(self): + dockerDefinition = self.getDockerDefinition() + + # check if the container is already running + if self.isRunning(): print("DbServer is already running") return @@ -85,12 +88,14 @@ raise TimeoutError def stop(self): - subprocess.check_call([ - "docker", - "stop", - self._label - ]) - subprocess.check_call([ + if self.isRunning(): + subprocess.check_call([ + "docker", + "stop", + self._label + ]) + + subprocess.call([ "docker", "rm", self._label @@ -99,7 +104,7 @@ def clear(self): # remove the volume self.stop() - subprocess.check_call([ + subprocess.call([ "docker", "volume", "rm", @@ -131,11 +136,13 @@ }, storagePath="/var/opt/mssql/data" ) - elif self.dbType == DbType.PG9 or self.dbType == DbType.PG10: + elif self.dbType == DbType.PG9 or self.dbType == DbType.PG10 or self.dbType == DbType.PG11: if self.dbType == DbType.PG9: image = "postgres:9" elif self.dbType == DbType.PG10: image = "postgres:10" + elif self.dbType == DbType.PG11: + image = "postgres:11" return DbServer.DockerDefinition( image=image, internalPort=5432,