Skip to content

Commit 4dbd183

Browse files
committed
fix: use valid MSSQL image
1 parent 4a11fc6 commit 4dbd183

File tree

3 files changed

+7
-40
lines changed

3 files changed

+7
-40
lines changed

modules/mssql/examples_test.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,13 @@ import (
1010
)
1111

1212
func ExampleRun() {
13-
// TODO: restore once #2785 is fixed
14-
if true {
15-
fmt.Println("true")
16-
return
17-
}
1813
// runMSSQLServerContainer {
1914
ctx := context.Background()
2015

2116
password := "SuperStrong@Passw0rd"
2217

2318
mssqlContainer, err := mssql.Run(ctx,
24-
"mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04",
19+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
2520
mssql.WithAcceptEULA(),
2621
mssql.WithPassword(password),
2722
)

modules/mssql/mssql.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func WithPassword(password string) testcontainers.CustomizeRequestOption {
4444
// Deprecated: use Run instead
4545
// RunContainer creates an instance of the MSSQLServer container type
4646
func RunContainer(ctx context.Context, opts ...testcontainers.ContainerCustomizer) (*MSSQLServerContainer, error) {
47-
return Run(ctx, "mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04", opts...)
47+
return Run(ctx, "mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04", opts...)
4848
}
4949

5050
// Run creates an instance of the MSSQLServer container type

modules/mssql/mssql_test.go

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ import (
1414
)
1515

1616
func TestMSSQLServer(t *testing.T) {
17-
t.Skip("broken see #2785")
1817
ctx := context.Background()
1918

2019
ctr, err := mssql.Run(ctx,
21-
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
20+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
2221
mssql.WithAcceptEULA(),
2322
)
2423
testcontainers.CleanupContainer(t, ctr)
@@ -44,11 +43,10 @@ func TestMSSQLServer(t *testing.T) {
4443
}
4544

4645
func TestMSSQLServerWithMissingEulaOption(t *testing.T) {
47-
t.Skip("broken see #2785")
4846
ctx := context.Background()
4947

5048
ctr, err := mssql.Run(ctx,
51-
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
49+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
5250
testcontainers.WithWaitStrategy(
5351
wait.ForLog("The SQL Server End-User License Agreement (EULA) must be accepted")),
5452
)
@@ -64,11 +62,10 @@ func TestMSSQLServerWithMissingEulaOption(t *testing.T) {
6462
}
6563

6664
func TestMSSQLServerWithConnectionStringParameters(t *testing.T) {
67-
t.Skip("broken see #2785")
6865
ctx := context.Background()
6966

7067
ctr, err := mssql.Run(ctx,
71-
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
68+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
7269
mssql.WithAcceptEULA(),
7370
)
7471
testcontainers.CleanupContainer(t, ctr)
@@ -95,11 +92,10 @@ func TestMSSQLServerWithConnectionStringParameters(t *testing.T) {
9592
}
9693

9794
func TestMSSQLServerWithCustomStrongPassword(t *testing.T) {
98-
t.Skip("broken see #2785")
9995
ctx := context.Background()
10096

10197
ctr, err := mssql.Run(ctx,
102-
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
98+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
10399
mssql.WithAcceptEULA(),
104100
mssql.WithPassword("Strong@Passw0rd"),
105101
)
@@ -120,11 +116,10 @@ func TestMSSQLServerWithCustomStrongPassword(t *testing.T) {
120116

121117
// tests that a weak password is not accepted by the container due to Microsoft's password strength policy
122118
func TestMSSQLServerWithInvalidPassword(t *testing.T) {
123-
t.Skip("broken see #2785")
124119
ctx := context.Background()
125120

126121
ctr, err := mssql.Run(ctx,
127-
"mcr.microsoft.com/mssql/server:2022-CU10-ubuntu-22.04",
122+
"mcr.microsoft.com/mssql/server:2022-CU14-ubuntu-22.04",
128123
testcontainers.WithWaitStrategy(
129124
wait.ForLog("Password validation failed")),
130125
mssql.WithAcceptEULA(),
@@ -133,26 +128,3 @@ func TestMSSQLServerWithInvalidPassword(t *testing.T) {
133128
testcontainers.CleanupContainer(t, ctr)
134129
require.NoError(t, err)
135130
}
136-
137-
func TestMSSQLServerWithAlternativeImage(t *testing.T) {
138-
t.Skip("broken see #2785")
139-
ctx := context.Background()
140-
141-
ctr, err := mssql.Run(ctx,
142-
"mcr.microsoft.com/mssql/server:2022-RTM-GDR1-ubuntu-20.04",
143-
mssql.WithAcceptEULA(),
144-
)
145-
testcontainers.CleanupContainer(t, ctr)
146-
require.NoError(t, err)
147-
148-
// perform assertions
149-
connectionString, err := ctr.ConnectionString(ctx)
150-
require.NoError(t, err)
151-
152-
db, err := sql.Open("sqlserver", connectionString)
153-
require.NoError(t, err)
154-
defer db.Close()
155-
156-
err = db.Ping()
157-
require.NoError(t, err)
158-
}

0 commit comments

Comments
 (0)