Skip to content

Commit

Permalink
fix(mssql): bump Docker image version (#2786)
Browse files Browse the repository at this point in the history
* chore: disable mssql tests

Disable all mssql tests as the container is currently crashing, see #2785

* fix: use valid MSSQL image

---------

Co-authored-by: Manuel de la Peña <[email protected]>
  • Loading branch information
stevenh and mdelapenya authored Sep 19, 2024
1 parent 069f724 commit fa560fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 29 deletions.
2 changes: 1 addition & 1 deletion modules/mssql/examples_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func ExampleRun() {
password := "SuperStrong@Passw0rd"

mssqlContainer, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
mssql.WithAcceptEULA(),
mssql.WithPassword(password),
)
Expand Down
2 changes: 1 addition & 1 deletion modules/mssql/mssql.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func WithPassword(password string) testcontainers.CustomizeRequestOption {
// Deprecated: use Run instead
// RunContainer creates an instance of the MSSQLServer container type
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MSSQLServerContainer, error) {
return Run(ctx, "mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04", opts...)
return Run(ctx, "mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04", opts...)
}

// Run creates an instance of the MSSQLServer container type
Expand Down
32 changes: 5 additions & 27 deletions modules/mssql/mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func TestMSSQLServer(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
mssql.WithAcceptEULA(),
)
testcontainers.CleanupContainer(t, ctr)
Expand Down Expand Up @@ -46,7 +46,7 @@ func TestMSSQLServerWithMissingEulaOption(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
testcontainers.WithWaitStrategy(
wait.ForLog("The SQL Server End-User License Agreement (EULA) must be accepted")),
)
Expand All @@ -65,7 +65,7 @@ func TestMSSQLServerWithConnectionStringParameters(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
mssql.WithAcceptEULA(),
)
testcontainers.CleanupContainer(t, ctr)
Expand Down Expand Up @@ -95,7 +95,7 @@ func TestMSSQLServerWithCustomStrongPassword(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
mssql.WithAcceptEULA(),
mssql.WithPassword("Strong@Passw0rd"),
)
Expand All @@ -119,7 +119,7 @@ func TestMSSQLServerWithInvalidPassword(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
testcontainers.WithWaitStrategy(
wait.ForLog("Password validation failed")),
mssql.WithAcceptEULA(),
Expand All @@ -128,25 +128,3 @@ func TestMSSQLServerWithInvalidPassword(t *testing.T) {
testcontainers.CleanupContainer(t, ctr)
require.NoError(t, err)
}

func TestMSSQLServerWithAlternativeImage(t *testing.T) {
ctx := context.Background()

ctr, err := mssql.Run(ctx,
"mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04",
mssql.WithAcceptEULA(),
)
testcontainers.CleanupContainer(t, ctr)
require.NoError(t, err)

// perform assertions
connectionString, err := ctr.ConnectionString(ctx)
require.NoError(t, err)

db, err := sql.Open("sqlserver", connectionString)
require.NoError(t, err)
defer db.Close()

err = db.Ping()
require.NoError(t, err)
}

0 comments on commit fa560fb

Please sign in to comment.