Skip to content

Commit

Permalink
Fixed: "Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Logi…
Browse files Browse the repository at this point in the history
…n failed for user 'sa'.." in MS SQL integration test (apache#12374)

* set specific tag for image, use env var for the new image

* moved to an older docker image

* Updated wait strategy as outlined in microsoft/mssql-docker#625
  • Loading branch information
dlg99 authored Oct 14, 2021
1 parent da27b9e commit 21b758c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@


import org.testcontainers.containers.wait.strategy.HostPortWaitStrategy;
import org.testcontainers.containers.wait.strategy.Wait;

import java.time.Duration;
import java.time.temporal.ChronoUnit;
Expand All @@ -37,7 +38,7 @@ public class DebeziumMsSqlContainer extends ChaosContainer<DebeziumMsSqlContaine
// "You may install and use copies of the software on any device,
// including third party shared devices, to design, develop, test and demonstrate your programs.
// You may not use the software on a device or server in a production environment."
private static final String IMAGE_NAME = "mcr.microsoft.com/mssql/server:2019-latest";
private static final String IMAGE_NAME = "mcr.microsoft.com/mssql/server:2019-CU12-ubuntu-20.04";

public DebeziumMsSqlContainer(String clusterName) {
super(clusterName, IMAGE_NAME);
Expand All @@ -56,13 +57,17 @@ protected void configure() {
.withExposedPorts(PORTS)
.withEnv("ACCEPT_EULA", "Y")
.withEnv("SA_PASSWORD", SA_PASSWORD)
.withEnv("MSSQL_SA_PASSWORD", SA_PASSWORD)
.withEnv("MSSQL_AGENT_ENABLED", "true")
.withStartupTimeout(Duration.of(300, ChronoUnit.SECONDS))
.withCreateContainerCmdModifier(createContainerCmd -> {
createContainerCmd.withHostName(NAME);
createContainerCmd.withName(getContainerName());
})
.waitingFor(new HostPortWaitStrategy());
// wait strategy to address problem with MS SQL responding to the connection
// before service starts up completely
// https://github.com/microsoft/mssql-docker/issues/625#issuecomment-882025521
.waitingFor(Wait.forLogMessage(".*The tempdb database has .*", 2));
}

}

0 comments on commit 21b758c

Please sign in to comment.