Skip to content

Commit 194b611

Browse files
committed
can't run docker in CI
1 parent 4ed649d commit 194b611

File tree

2 files changed

+31
-16
lines changed

2 files changed

+31
-16
lines changed

tracer/test/Datadog.Trace.Security.IntegrationTests/IAST/AspNetCore5IastDbTests.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public AspNetCore5IastDbTests(AspNetCoreTestFixture fixture, ITestOutputHelper o
2929
[InlineData("System.Data.SqlClient")]
3030
[InlineData("Npgsql")]
3131
[InlineData("MySql.Data")]
32-
[InlineData("Oracle")]
32+
// [InlineData("Oracle")] // This test requires the Oracle DB image, which is huge (8GB unpacked), so we cannot enable it without taking precautionary measures.
3333
public async Task TestIastStoredXssRequest(string database)
3434
{
3535
#if NETCOREAPP3_0
@@ -69,7 +69,7 @@ await VerifyHelper.VerifySpans(spansFiltered, settings)
6969
[InlineData("System.Data.SqlClient")]
7070
[InlineData("Npgsql")]
7171
[InlineData("MySql.Data")]
72-
[InlineData("Oracle")]
72+
// [InlineData("Oracle")] // This test requires the Oracle DB image, which is huge (8GB unpacked), so we cannot enable it without taking precautionary measures.
7373
public async Task TestIastStoredXssEscapedRequest(string database)
7474
{
7575
#if NETCOREAPP3_0
@@ -105,7 +105,7 @@ await VerifyHelper.VerifySpans(spansFiltered, settings)
105105
[InlineData("System.Data.SqlClient")]
106106
[InlineData("Npgsql")]
107107
[InlineData("MySql.Data")]
108-
[InlineData("Oracle")]
108+
// [InlineData("Oracle")] // This test requires the Oracle DB image, which is huge (8GB unpacked), so we cannot enable it without taking precautionary measures.
109109
public async Task TestIastStoredSqliRequest(string database)
110110
{
111111
#if NETCOREAPP3_0

tracer/test/test-applications/security/Samples.Security.AspNetCore5.DatabaseIntegration/Data/IastControllerHelper.cs

+28-13
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,34 @@ public static SqlConnection CreateSqlServerDatabase()
136136
var connectionString = Environment.GetEnvironmentVariable("SQLSERVER_CONNECTION_STRING") ??
137137
@"Server=localhost;User Id=sa;Password=Strong!Passw0rd;";
138138

139-
var connection = new SqlConnection("Server=localhost;User Id=sa;Password=Strong!Passw0rd;");
140-
connection.Open();
141-
142-
foreach (var command in SqlServerTables)
143-
{
144-
new SqlCommand(command, connection).ExecuteNonQuery();
145-
}
146-
foreach (var command in PopulateCommands)
147-
{
148-
new SqlCommand(command, connection).ExecuteNonQuery();
149-
}
150-
151-
return connection;
139+
int numAttempts = 3;
140+
for (int i = 0; i < numAttempts; i++)
141+
{
142+
SqlConnection connection = null;
143+
try
144+
{
145+
connection =new SqlConnection(connectionString);
146+
connection.Open();
147+
148+
foreach (var command in SqlServerTables)
149+
{
150+
new SqlCommand(command, connection).ExecuteNonQuery();
151+
}
152+
foreach (var command in PopulateCommands)
153+
{
154+
new SqlCommand(command, connection).ExecuteNonQuery();
155+
}
156+
return connection;
157+
}
158+
catch (Exception e)
159+
{
160+
Console.WriteLine(e);
161+
connection?.Dispose();
162+
}
163+
164+
}
165+
166+
throw new Exception($"Unable to open connection to connection string {connectionString} after {numAttempts} attempts");
152167
}
153168

154169
public static SQLiteConnection CreateSystemDataDatabase()

0 commit comments

Comments
 (0)