@@ -44,14 +44,10 @@ public abstract class BaseDockerHelper{
4444
4545 public ILogger Logger ;
4646
47- public ( String usename , String password ) ? SqlCredentials ;
48-
49- public IContainer SqlServerContainer ;
50-
47+ public ( String usename , String password ) SqlCredentials = ( "sa" , "thisisalongpassword123!" ) ;
48+
5149 public String SqlServerContainerName ;
5250
53- public INetwork SqlServerNetwork ;
54-
5551 public Guid TestId ;
5652
5753 public String ScenarioName ;
@@ -75,7 +71,7 @@ public abstract class BaseDockerHelper{
7571
7672 protected readonly IHealthCheckClient HealthCheckClient ;
7773
78- protected Dictionary < ContainerType , Int32 > HostPorts = new Dictionary < ContainerType , Int32 > ( ) ;
74+ protected Dictionary < ContainerType , Int32 > HostPorts = new ( ) ;
7975
8076 protected String HostTraceFolder ;
8177
@@ -167,15 +163,7 @@ protected BaseDockerHelper(Boolean skipHealthChecks=false) {
167163 #endregion
168164
169165 #region Methods
170- public async Task < Boolean > DoesNetworkExist ( string networkName )
171- {
172- DockerClient ? client = new DockerClientConfiguration ( ) . CreateClient ( ) ;
173166
174- var networks = await client . Networks . ListNetworksAsync ( ) ;
175-
176- return networks . Any ( n =>
177- string . Equals ( n . Name , networkName , StringComparison . OrdinalIgnoreCase ) ) ;
178- }
179167 public virtual Dictionary < String , String > GetAdditionalVariables ( ContainerType containerType ) {
180168 Dictionary < String , String > result = new ( ) ;
181169
@@ -300,6 +288,7 @@ public virtual ContainerBuilder SetupCallbackHandlerContainer(){
300288
301289 public virtual void SetupContainerNames ( ) {
302290 // Setup the container names
291+ this . SqlServerContainerName = $ "sqlserver{ this . TestId : N} ";
303292 this . EventStoreContainerName = $ "eventstore{ this . TestId : N} ";
304293 this . SecurityServiceContainerName = $ "securityservice{ this . TestId : N} ";
305294 this . TestHostContainerName = $ "testhosts{ this . TestId : N} ";
@@ -357,9 +346,6 @@ public virtual ContainerBuilder SetupEventStoreContainer(){
357346 eventStoreContainer = eventStoreContainer . WithName ( this . EventStoreContainerName ) // similar to WithName()
358347 . WithImage ( imageDetails . imageName )
359348 . WithEnvironment ( environmentVariables )
360- . WithOutputConsumer (
361- Consume . RedirectStdoutAndStderrToConsole ( )
362- )
363349 . WithPortBinding ( DockerPorts . EventStoreHttpDockerPort , true ) ;
364350
365351 return eventStoreContainer ;
@@ -515,25 +501,24 @@ public virtual ContainerBuilder ConfigureSqlContainer()
515501 . WithName ( this . SqlServerContainerName ) // similar to WithName()
516502 . WithImage ( this . GetImageDetails ( ContainerType . SqlServer ) . Data . imageName )
517503 . WithEnvironment ( "ACCEPT_EULA" , "Y" )
518- . WithEnvironment ( "SA_PASSWORD" , this . SqlCredentials . Value . password )
519- . WithPortBinding ( 1433 , true )
520- . WithReuse ( true ) ;
504+ . WithEnvironment ( "SA_PASSWORD" , this . SqlCredentials . password )
505+ . WithPortBinding ( 1433 , true ) ;
521506
522507 return containerService ;
523508 }
524509
525- public virtual async Task < IContainer > SetupSqlServerContainer ( INetwork networkService ) {
526- if ( this . SqlCredentials == default )
527- throw new ArgumentNullException ( "Sql Credentials have not been set" ) ;
510+ // public virtual async Task<IContainer> SetupSqlServerContainer(INetwork networkService){
511+ // if (this.SqlCredentials == default)
512+ // throw new ArgumentNullException("Sql Credentials have not been set");
528513
529- IContainer databaseServerContainer = await this . StartContainer2 ( this . ConfigureSqlContainer ,
530- new List < INetwork > {
531- networkService
532- } ,
533- DockerServices . SqlServer ) ;
514+ // IContainer databaseServerContainer = await this.StartContainer2(this.ConfigureSqlContainer,
515+ // new List<INetwork>{
516+ // networkService
517+ // },
518+ // DockerServices.SqlServer);
534519
535- return databaseServerContainer ;
536- }
520+ // return databaseServerContainer;
521+ // }
537522
538523 public virtual ContainerBuilder SetupTestHostContainer ( ) {
539524 this . Trace ( "About to Start Test Hosts Container" ) ;
@@ -648,8 +633,8 @@ protected void CheckSqlConnection(IContainer databaseServerContainer){
648633
649634 String server = "127.0.0.1" ;
650635 String database = "master" ;
651- String user = this . SqlCredentials . Value . usename ;
652- String password = this . SqlCredentials . Value . password ;
636+ String user = this . SqlCredentials . usename ;
637+ String password = this . SqlCredentials . password ;
653638 String port = sqlServerEndpoint . ToString ( ) ;
654639
655640 this . sqlTestConnString = $ "server={ server } ,{ port } ;user id={ user } ; password={ password } ; database={ database } ;Encrypt=False";
@@ -897,7 +882,7 @@ protected virtual String SetConnectionString(String databaseName,
897882 }
898883
899884 String connectionString =
900- $ "server={ this . SqlServerContainerName } ,1433;user id={ this . SqlCredentials . Value . usename } ;password={ this . SqlCredentials . Value . password } ;database={ databaseName } { encryptValue } ";
885+ $ "server={ this . SqlServerContainerName } ,1433;user id={ this . SqlCredentials . usename } ;password={ this . SqlCredentials . password } ;database={ databaseName } { encryptValue } ";
901886
902887 return connectionString ;
903888 }
@@ -922,7 +907,6 @@ protected async Task<IContainer> StartContainer2(Func<ContainerBuilder> buildCon
922907 this . Containers . Add ( ( dockerService , builtContainer ) ) ;
923908
924909 // Do a health check here
925- //this.MessagingServicePort =
926910 ContainerType type = dockerService switch {
927911 DockerServices . CallbackHandler => ContainerType . CallbackHandler ,
928912 DockerServices . MessagingService => ContainerType . MessagingService ,
@@ -1011,22 +995,7 @@ UInt16 GetPort(Int32 dockerPort) =>
1011995 break ;
1012996 }
1013997 }
1014-
1015- protected async Task < IContainer > StartContainer ( Func < List < INetwork > , Task < IContainer > > startContainerFunc , List < INetwork > networkServices , DockerServices dockerService ) {
1016- if ( ( this . RequiredDockerServices & dockerService ) != dockerService ) {
1017- return default ;
1018- }
1019-
1020- try
1021- {
1022- return await startContainerFunc ( networkServices ) ;
1023- }
1024- catch ( Exception ex ) {
1025- this . Error ( $ "Error starting container [{ startContainerFunc . Method . Name } ]", ex ) ;
1026- throw ;
1027- }
1028- }
1029-
998+
1030999 public void Trace ( String traceMessage ) {
10311000 if ( this . Logger . IsInitialised ) {
10321001 this . Logger . LogInformation ( $ "{ this . TestId } |{ this . ScenarioName } |{ traceMessage } ") ;
0 commit comments