File tree Expand file tree Collapse file tree
modules/mssql/testcontainers/mssql Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33
44from testcontainers .core .generic import DbContainer
55from testcontainers .core .utils import raise_for_deprecated_parameter
6- from testcontainers .core .waiting_utils import wait_container_is_ready
6+ from testcontainers .core .wait_strategies import ExecWaitStrategy
77
88
99class SqlServerContainer (DbContainer ):
@@ -50,12 +50,15 @@ def _configure(self) -> None:
5050 self .with_env ("SQLSERVER_DBNAME" , self .dbname )
5151 self .with_env ("ACCEPT_EULA" , "Y" )
5252
53- @wait_container_is_ready (AssertionError )
5453 def _connect (self ) -> None :
55- status , _ = self .exec (
56- ["bash" , "-c" , '/opt/mssql-tools*/bin/sqlcmd -U "$SQLSERVER_USER" -P "$SA_PASSWORD" -Q \' SELECT 1\' -C' ]
54+ strategy = ExecWaitStrategy (
55+ [
56+ "bash" ,
57+ "-c" ,
58+ '/opt/mssql-tools*/bin/sqlcmd -U "$SQLSERVER_USER" -P "$SA_PASSWORD" -Q \' SELECT 1\' -C' ,
59+ ]
5760 )
58- assert status == 0 , "Cannot run 'SELECT 1': container is not ready"
61+ strategy . wait_until_ready ( self )
5962
6063 def get_connection_url (self ) -> str :
6164 return super ()._create_connection_url (
You can’t perform that action at this time.
0 commit comments