Skip to content

Commit a18d094

Browse files
committed
Issue #22: Solved slow SQL Server tests
* Turned OFF connection pooling on SQL Server connection string for tests - Found several discussions on this, e.g. dotnet/SqlClient#601 - Tried turning off pooling, and it solved the problem... * Upgraded SQL server docker image used in test from 2017-latest to latest (2019 at the time) - didn't make any difference, just to stay current.
1 parent d4f68b2 commit a18d094

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

grate.unittests/TestInfrastructure/SqlServerGrateTestContext.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ class SqlServerGrateTestContext : TestContextBase, IGrateTestContext, IDockerTes
1414
public int? Port { get; set; }
1515

1616
public string DockerCommand(string serverName, string adminPassword) =>
17-
$"run -d --name {serverName} -e ACCEPT_EULA=Y -e SA_PASSWORD={adminPassword} -e MSSQL_PID=Developer -e MSSQL_COLLATION=Danish_Norwegian_CI_AS -P mcr.microsoft.com/mssql/server:2017-latest";
17+
$"run -d --name {serverName} -e ACCEPT_EULA=Y -e SA_PASSWORD={adminPassword} -e MSSQL_PID=Developer -e MSSQL_COLLATION=Danish_Norwegian_CI_AS -P mcr.microsoft.com/mssql/server:latest";
1818

19-
public string AdminConnectionString => $"Data Source=localhost,{Port};Initial Catalog=master;User Id=sa;Password={AdminPassword};Encrypt=false";
20-
public string ConnectionString(string database) => $"Data Source=localhost,{Port};Initial Catalog={database};User Id=sa;Password={AdminPassword};Encrypt=false";
19+
public string AdminConnectionString => $"Data Source=localhost,{Port};Initial Catalog=master;User Id=sa;Password={AdminPassword};Encrypt=false;Pooling=false";
20+
public string ConnectionString(string database) => $"Data Source=localhost,{Port};Initial Catalog={database};User Id=sa;Password={AdminPassword};Encrypt=false;Pooling=false";
2121

2222
public DbConnection GetDbConnection(string connectionString) => new SqlConnection(connectionString);
2323

@@ -36,6 +36,6 @@ public string DockerCommand(string serverName, string adminPassword) =>
3636
SelectVersion = "SELECT @@VERSION",
3737
};
3838

39-
public string ExpectedVersionPrefix => "Microsoft SQL Server 2017";
39+
public string ExpectedVersionPrefix => "Microsoft SQL Server 2019";
4040
public bool SupportsCreateDatabase => true;
41-
}
41+
}

0 commit comments

Comments
 (0)