diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml
index f2e1e531b..0d69bae73 100644
--- a/.github/workflows/cicd.yml
+++ b/.github/workflows/cicd.yml
@@ -48,6 +48,7 @@ jobs:
{ name: "Testcontainers.CosmosDb", runs-on: "ubuntu-22.04" },
{ name: "Testcontainers.Couchbase", runs-on: "ubuntu-22.04" },
{ name: "Testcontainers.CouchDb", runs-on: "ubuntu-22.04" },
+ { name: "Testcontainers.Db2", runs-on: "ubuntu-22.04" },
{ name: "Testcontainers.DynamoDb", runs-on: "ubuntu-22.04" },
{ name: "Testcontainers.Elasticsearch", runs-on: "ubuntu-22.04" },
{ name: "Testcontainers.EventStoreDb", runs-on: "ubuntu-22.04" },
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 335ebf0ca..7d9ef6146 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -41,8 +41,8 @@
-
-
+
+
diff --git a/Testcontainers.sln b/Testcontainers.sln
index f7627cefe..27c8be5bd 100644
--- a/Testcontainers.sln
+++ b/Testcontainers.sln
@@ -35,6 +35,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Couchbase",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.CouchDb", "src\Testcontainers.CouchDb\Testcontainers.CouchDb.csproj", "{DCECB1F6-D9AA-431F-AE42-25D56B9E7DFC}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Db2", "src\Testcontainers.Db2\Testcontainers.Db2.csproj", "{ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}"
+EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.DynamoDb", "src\Testcontainers.DynamoDb\Testcontainers.DynamoDb.csproj", "{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Elasticsearch", "src\Testcontainers.Elasticsearch\Testcontainers.Elasticsearch.csproj", "{641DDEA5-B6E0-41E6-BA11-7A28C0913127}"
@@ -79,9 +81,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Neo4j", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Oracle", "src\Testcontainers.Oracle\Testcontainers.Oracle.csproj", "{596EAFC1-0496-495C-B382-D57415FA456A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Papercut", "src\Testcontainers.Papercut\Testcontainers.Papercut.csproj", "{B2608563-8EE4-49AA-A9A0-B1614486AEEF}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Papercut", "src\Testcontainers.Papercut\Testcontainers.Papercut.csproj", "{B2608563-8EE4-49AA-A9A0-B1614486AEEF}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.PostgreSql", "src\Testcontainers.PostgreSql\Testcontainers.PostgreSql.csproj", "{8AB91636-9055-4900-A72A-7CFFACDFDBF0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.PostgreSql", "src\Testcontainers.PostgreSql\Testcontainers.PostgreSql.csproj", "{8AB91636-9055-4900-A72A-7CFFACDFDBF0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.PubSub", "src\Testcontainers.PubSub\Testcontainers.PubSub.csproj", "{E6642255-667D-476B-B584-089AA5E6C0B1}"
EndProject
@@ -95,15 +97,15 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Redis", "src
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Redpanda", "src\Testcontainers.Redpanda\Testcontainers.Redpanda.csproj", "{45D6F69C-4D87-4130-AA90-0DB2F7460DAE}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ServiceBus", "src\Testcontainers.ServiceBus\Testcontainers.ServiceBus.csproj", "{2E39E532-B81E-4B48-A004-FAE18EDF9E79}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.ServiceBus", "src\Testcontainers.ServiceBus\Testcontainers.ServiceBus.csproj", "{2E39E532-B81E-4B48-A004-FAE18EDF9E79}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.WebDriver", "src\Testcontainers.WebDriver\Testcontainers.WebDriver.csproj", "{64A87DE5-29B0-4A54-9E74-560484D8C7C0}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.WebDriver", "src\Testcontainers.WebDriver\Testcontainers.WebDriver.csproj", "{64A87DE5-29B0-4A54-9E74-560484D8C7C0}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Xunit", "src\Testcontainers.Xunit\Testcontainers.Xunit.csproj", "{380BB29B-F556-404D-B13B-CA250599C565}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Xunit", "src\Testcontainers.Xunit\Testcontainers.Xunit.csproj", "{380BB29B-F556-404D-B13B-CA250599C565}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.XunitV3", "src\Testcontainers.XunitV3\Testcontainers.XunitV3.csproj", "{84911C93-C2A9-46E9-AE5E-D567306589E5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.XunitV3", "src\Testcontainers.XunitV3\Testcontainers.XunitV3.csproj", "{84911C93-C2A9-46E9-AE5E-D567306589E5}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers", "src\Testcontainers\Testcontainers.csproj", "{EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers", "src\Testcontainers\Testcontainers.csproj", "{EC76857B-A3B8-4B7A-A1B0-8D867A4D1733}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.ActiveMq.Tests", "tests\Testcontainers.ActiveMq.Tests\Testcontainers.ActiveMq.Tests.csproj", "{AB93C67F-0A53-4525-AE6C-29B065820ABE}"
EndProject
@@ -131,6 +133,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.CouchDb.Test
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Databases.Tests", "tests\Testcontainers.Databases.Tests\Testcontainers.Databases.Tests.csproj", "{DA54916E-1128-4200-B6AE-9F5BF02D832D}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Db2.Tests", "tests\Testcontainers.Db2.Tests\Testcontainers.Db2.Tests.csproj", "{AF9853AB-86E7-49DE-8DF8-454838E90D6F}"
+EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.DynamoDb.Tests", "tests\Testcontainers.DynamoDb.Tests\Testcontainers.DynamoDb.Tests.csproj", "{101515E6-74C1-40F9-85C8-871F742A378D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Elasticsearch.Tests", "tests\Testcontainers.Elasticsearch.Tests\Testcontainers.Elasticsearch.Tests.csproj", "{DD5B3678-468F-4D73-AECE-705E3D66CD43}"
@@ -175,9 +179,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Neo4j.Tests"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Oracle.Tests", "tests\Testcontainers.Oracle.Tests\Testcontainers.Oracle.Tests.csproj", "{4AC1088B-9965-4497-AC8E-570F1AD5631F}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Papercut.Tests", "tests\Testcontainers.Papercut.Tests\Testcontainers.Papercut.Tests.csproj", "{F03FA970-BE2B-4AE2-96FE-7E1F805CEA20}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Papercut.Tests", "tests\Testcontainers.Papercut.Tests\Testcontainers.Papercut.Tests.csproj", "{F03FA970-BE2B-4AE2-96FE-7E1F805CEA20}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Platform.Linux.Tests", "tests\Testcontainers.Platform.Linux.Tests\Testcontainers.Platform.Linux.Tests.csproj", "{DA1D7ADE-452C-4369-83CC-56289176EACD}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Platform.Linux.Tests", "tests\Testcontainers.Platform.Linux.Tests\Testcontainers.Platform.Linux.Tests.csproj", "{DA1D7ADE-452C-4369-83CC-56289176EACD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Platform.Windows.Tests", "tests\Testcontainers.Platform.Windows.Tests\Testcontainers.Platform.Windows.Tests.csproj", "{3E55CBE8-AFE8-426D-9470-49D63CD1051C}"
EndProject
@@ -197,17 +201,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Redpanda.Tes
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.ResourceReaper.Tests", "tests\Testcontainers.ResourceReaper.Tests\Testcontainers.ResourceReaper.Tests.csproj", "{9E8E6AA5-65D1-498F-BEAB-BA34723A0050}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.ServiceBus.Tests", "tests\Testcontainers.ServiceBus.Tests\Testcontainers.ServiceBus.Tests.csproj", "{232DD918-46ED-4BA8-B383-1A9146D83064}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.ServiceBus.Tests", "tests\Testcontainers.ServiceBus.Tests\Testcontainers.ServiceBus.Tests.csproj", "{232DD918-46ED-4BA8-B383-1A9146D83064}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Tests", "tests\Testcontainers.Tests\Testcontainers.Tests.csproj", "{27CDB869-A150-4593-958F-6F26E5391E7C}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Tests", "tests\Testcontainers.Tests\Testcontainers.Tests.csproj", "{27CDB869-A150-4593-958F-6F26E5391E7C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.WebDriver.Tests", "tests\Testcontainers.WebDriver.Tests\Testcontainers.WebDriver.Tests.csproj", "{EBA72C3B-57D5-43FF-A5B4-3D55B3B6D4C2}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Xunit.Tests", "tests\Testcontainers.Xunit.Tests\Testcontainers.Xunit.Tests.csproj", "{E901DF14-6F05-4FC2-825A-3055FAD33561}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Db2", "src\Testcontainers.Db2\Testcontainers.Db2.csproj", "{ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Testcontainers.Db2.Tests", "tests\Testcontainers.Db2.Tests\Testcontainers.Db2.Tests.csproj", "{AF9853AB-86E7-49DE-8DF8-454838E90D6F}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Testcontainers.Xunit.Tests", "tests\Testcontainers.Xunit.Tests\Testcontainers.Xunit.Tests.csproj", "{E901DF14-6F05-4FC2-825A-3055FAD33561}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -259,6 +259,10 @@ Global
{DCECB1F6-D9AA-431F-AE42-25D56B9E7DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCECB1F6-D9AA-431F-AE42-25D56B9E7DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DCECB1F6-D9AA-431F-AE42-25D56B9E7DFC}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Release|Any CPU.Build.0 = Release|Any CPU
{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -451,6 +455,10 @@ Global
{DA54916E-1128-4200-B6AE-9F5BF02D832D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA54916E-1128-4200-B6AE-9F5BF02D832D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA54916E-1128-4200-B6AE-9F5BF02D832D}.Release|Any CPU.Build.0 = Release|Any CPU
+ {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Release|Any CPU.Build.0 = Release|Any CPU
{101515E6-74C1-40F9-85C8-871F742A378D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{101515E6-74C1-40F9-85C8-871F742A378D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{101515E6-74C1-40F9-85C8-871F742A378D}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -599,14 +607,6 @@ Global
{E901DF14-6F05-4FC2-825A-3055FAD33561}.Debug|Any CPU.Build.0 = Debug|Any CPU
{E901DF14-6F05-4FC2-825A-3055FAD33561}.Release|Any CPU.ActiveCfg = Release|Any CPU
{E901DF14-6F05-4FC2-825A-3055FAD33561}.Release|Any CPU.Build.0 = Release|Any CPU
- {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9}.Release|Any CPU.Build.0 = Release|Any CPU
- {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {AF9853AB-86E7-49DE-8DF8-454838E90D6F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{5365F780-0E6C-41F0-B1B9-7DC34368F80C} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
@@ -620,6 +620,7 @@ Global
{A724806F-8C94-4438-8011-04A9A1575318} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{58E94721-2681-4D82-8D94-0B2F9DB0D575} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{DCECB1F6-D9AA-431F-AE42-25D56B9E7DFC} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
+ {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{2EAFA567-9F68-4C52-9DBC-8F3EC11BB2CE} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{641DDEA5-B6E0-41E6-BA11-7A28C0913127} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
{84D707E0-C9FA-4327-85DC-0AFEBEA73572} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
@@ -668,6 +669,7 @@ Global
{809322BA-D690-4F2B-B884-23F895663963} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{E4520FB1-4466-4DCA-AD08-4075102C68D3} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{DA54916E-1128-4200-B6AE-9F5BF02D832D} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
+ {AF9853AB-86E7-49DE-8DF8-454838E90D6F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{101515E6-74C1-40F9-85C8-871F742A378D} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{DD5B3678-468F-4D73-AECE-705E3D66CD43} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{64F8E9B9-78FD-4E13-BDDF-0340E2D4E1D0} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
@@ -705,7 +707,5 @@ Global
{27CDB869-A150-4593-958F-6F26E5391E7C} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{EBA72C3B-57D5-43FF-A5B4-3D55B3B6D4C2} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
{E901DF14-6F05-4FC2-825A-3055FAD33561} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
- {ED3C611F-DFE2-4AB7-A323-B500E95B4FF9} = {673F23AE-7694-4BB9-ABD4-136D6C13634E}
- {AF9853AB-86E7-49DE-8DF8-454838E90D6F} = {7164F1FB-7F24-444A-ACD2-2C329C2B3CCF}
EndGlobalSection
EndGlobal
diff --git a/src/Testcontainers.Db2/Db2Builder.cs b/src/Testcontainers.Db2/Db2Builder.cs
index f8fd17849..322c30c53 100644
--- a/src/Testcontainers.Db2/Db2Builder.cs
+++ b/src/Testcontainers.Db2/Db2Builder.cs
@@ -1,143 +1,140 @@
-using System.Linq;
-using System.Threading.Tasks;
-
namespace Testcontainers.Db2;
///
[PublicAPI]
public sealed class Db2Builder : ContainerBuilder
{
- public const string Db2Image = "icr.io/db2_community/db2:latest";
-
- public const ushort Db2Port = 50000;
-
- public const string DefaultDatabase = "test";
-
- public const string DefaultUsername = "db2inst1";
-
- public const string DefaultPassword = "test123";
-
- public const string DefaultLicenseAgreement = "accept";
-
- public const string DefaultInMemoryDatabasePath = "/home/db2inst1/data";
-
- ///
- /// Initializes a new instance of the class.
- ///
- public Db2Builder()
- : this(new Db2Configuration())
- {
- DockerResourceConfiguration = Init().DockerResourceConfiguration;
- }
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Docker resource configuration.
- private Db2Builder(Db2Configuration resourceConfiguration)
- : base(resourceConfiguration)
- {
- DockerResourceConfiguration = resourceConfiguration;
- }
-
- ///
- protected override Db2Configuration DockerResourceConfiguration { get; }
-
- ///
- /// Sets the Db2 database name.
- ///
- /// The Db2 database.
- /// A configured instance of .
- public Db2Builder WithDatabase(string database)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(database: database))
- .WithEnvironment("DBNAME", database);
- }
-
- ///
- /// Sets the Db2 username.
- ///
- /// The Db2 username.
- /// A configured instance of .
- public Db2Builder WithUsername(string username)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(username: username))
- .WithEnvironment("DB2INSTANCE", username);
- }
-
- ///
- /// Sets the Db2 password.
- ///
- /// The Db2 password.
- /// A configured instance of .
- public Db2Builder WithPassword(string password)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(password: password))
- .WithEnvironment("DB2INST1_PASSWORD", password);
- }
-
- ///
- /// Sets the Db2 archive logs.
- ///
- /// The Db2 archive logs setting.
- /// A configured instance of .
- public Db2Builder WithArchiveLogs(bool archiveLogs)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(archiveLogs: archiveLogs))
- .WithEnvironment("ARCHIVE_LOGS", archiveLogs.ToString());
- }
-
- ///
- /// Sets the Db2 autoconfig setting.
- ///
- /// The Db2 autoconfig setting.
- /// A configured instance of .
- public Db2Builder WithAutoconfig(bool autoConfig)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(autoConfig: autoConfig))
- .WithEnvironment("AUTOCONFIG", autoConfig.ToString());
- }
-
- ///
- /// Accepts the Db2 license agreement.
- ///
- /// A configured instance of .
- public Db2Builder WithLicenseAgreement()
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(licenseAgreement: DefaultLicenseAgreement))
- .WithEnvironment("LICENSE", DefaultLicenseAgreement);
- }
-
- ///
- /// Maps the database to memory.
- ///
- /// A configured instance of .
- public Db2Builder WithInMemoryDatabase()
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(licenseAgreement: DefaultInMemoryDatabasePath))
- .WithTmpfsMount(DefaultInMemoryDatabasePath);
- }
-
- ///
- public override Db2Container Build()
- {
- Validate();
-
- // By default, the base builder waits until the container is running. However, for Db2, a more advanced waiting strategy is necessary
- // If the user does not provide a custom waiting strategy, append the default Db2 waiting strategy.
- var db2Builder = DockerResourceConfiguration.WaitStrategies.Count() > 1
- ? this
- : WithWaitStrategy(Wait.ForUnixContainer()
- .UntilMessageIsLogged("All databases are now active")
- .UntilMessageIsLogged("Setup has completed.")
- .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
- );
-
- return new Db2Container(db2Builder.DockerResourceConfiguration);
- }
-
- ///
- protected override Db2Builder Init() => base.Init()
+ public const string Db2Image = "icr.io/db2_community/db2:latest";
+
+ public const ushort Db2Port = 50000;
+
+ public const string DefaultDatabase = "test";
+
+ public const string DefaultUsername = "db2inst1";
+
+ public const string DefaultPassword = "db2inst1";
+
+ public const string DefaultLicenseAgreement = "accept";
+
+ public const string DefaultInMemoryDatabasePath = "/home/db2inst1/data";
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public Db2Builder()
+ : this(new Db2Configuration())
+ {
+ DockerResourceConfiguration = Init().DockerResourceConfiguration;
+ }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Docker resource configuration.
+ private Db2Builder(Db2Configuration resourceConfiguration)
+ : base(resourceConfiguration)
+ {
+ DockerResourceConfiguration = resourceConfiguration;
+ }
+
+ ///
+ protected override Db2Configuration DockerResourceConfiguration { get; }
+
+ ///
+ /// Sets the Db2 database name.
+ ///
+ /// The Db2 database.
+ /// A configured instance of .
+ public Db2Builder WithDatabase(string database)
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(database: database))
+ .WithEnvironment("DBNAME", database);
+ }
+
+ ///
+ /// Sets the Db2 username.
+ ///
+ /// The Db2 username.
+ /// A configured instance of .
+ public Db2Builder WithUsername(string username)
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(username: username))
+ .WithEnvironment("DB2INSTANCE", username);
+ }
+
+ ///
+ /// Sets the Db2 password.
+ ///
+ /// The Db2 password.
+ /// A configured instance of .
+ public Db2Builder WithPassword(string password)
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(password: password))
+ .WithEnvironment("DB2INST1_PASSWORD", password);
+ }
+
+ ///
+ /// Sets the Db2 archive logs.
+ ///
+ /// The Db2 archive logs setting.
+ /// A configured instance of .
+ public Db2Builder WithArchiveLogs(bool archiveLogs)
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(archiveLogs: archiveLogs))
+ .WithEnvironment("ARCHIVE_LOGS", archiveLogs.ToString());
+ }
+
+ ///
+ /// Sets the Db2 autoconfig setting.
+ ///
+ /// The Db2 autoconfig setting.
+ /// A configured instance of .
+ public Db2Builder WithAutoconfig(bool autoConfig)
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(autoConfig: autoConfig))
+ .WithEnvironment("AUTOCONFIG", autoConfig.ToString());
+ }
+
+ ///
+ /// Accepts the Db2 license agreement.
+ ///
+ /// A configured instance of .
+ public Db2Builder WithLicenseAgreement()
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(licenseAgreement: DefaultLicenseAgreement))
+ .WithEnvironment("LICENSE", DefaultLicenseAgreement);
+ }
+
+ ///
+ /// Maps the database to memory.
+ ///
+ /// A configured instance of .
+ public Db2Builder WithInMemoryDatabase()
+ {
+ return Merge(DockerResourceConfiguration, new Db2Configuration(licenseAgreement: DefaultInMemoryDatabasePath))
+ .WithTmpfsMount(DefaultInMemoryDatabasePath);
+ }
+
+ ///
+ public override Db2Container Build()
+ {
+ Validate();
+
+ // By default, the base builder waits until the container is running. However, for Db2, a more advanced waiting strategy is necessary
+ // If the user does not provide a custom waiting strategy, append the default Db2 waiting strategy.
+ var db2Builder = DockerResourceConfiguration.WaitStrategies.Count() > 1
+ ? this
+ : WithWaitStrategy(Wait.ForUnixContainer()
+ .UntilMessageIsLogged("All databases are now active")
+ .UntilMessageIsLogged("Setup has completed.")
+ .AddCustomWaitStrategy(new WaitUntil(DockerResourceConfiguration))
+ );
+
+ return new Db2Container(db2Builder.DockerResourceConfiguration);
+ }
+
+ ///
+ protected override Db2Builder Init() => base.Init()
.WithImage(Db2Image)
.WithPortBinding(Db2Port, true)
.WithDatabase(DefaultDatabase)
@@ -149,57 +146,57 @@ protected override Db2Builder Init() => base.Init()
.WithInMemoryDatabase()
.WithPrivileged(true);
- ///
- protected override void Validate()
- {
- base.Validate();
-
- _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
- .NotNull()
- .NotEmpty();
-
- _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
- .NotNull()
- .NotEmpty();
- }
-
- ///
- protected override Db2Builder Clone(IResourceConfiguration resourceConfiguration)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(resourceConfiguration));
- }
-
- ///
- protected override Db2Builder Clone(IContainerConfiguration resourceConfiguration)
- {
- return Merge(DockerResourceConfiguration, new Db2Configuration(resourceConfiguration));
- }
-
- ///
- protected override Db2Builder Merge(Db2Configuration oldValue, Db2Configuration newValue)
- {
- return new Db2Builder(new Db2Configuration(oldValue, newValue));
- }
-
- ///
- private sealed class WaitUntil : IWaitUntil
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// The container configuration.
- public WaitUntil(Db2Configuration configuration)
+ ///
+ protected override void Validate()
+ {
+ base.Validate();
+
+ _ = Guard.Argument(DockerResourceConfiguration.Username, nameof(DockerResourceConfiguration.Username))
+ .NotNull()
+ .NotEmpty();
+
+ _ = Guard.Argument(DockerResourceConfiguration.Password, nameof(DockerResourceConfiguration.Password))
+ .NotNull()
+ .NotEmpty();
+ }
+
+ ///
+ protected override Db2Builder Clone(IResourceConfiguration resourceConfiguration)
{
+ return Merge(DockerResourceConfiguration, new Db2Configuration(resourceConfiguration));
}
///
- public async Task UntilAsync(IContainer container)
+ protected override Db2Builder Clone(IContainerConfiguration resourceConfiguration)
{
- var db2Container = (Db2Container)container;
+ return Merge(DockerResourceConfiguration, new Db2Configuration(resourceConfiguration));
+ }
- var execResult = await db2Container.ExecScriptAsync("SELECT 1 FROM SYSIBM.SYSDUMMY1").ConfigureAwait(false);
+ ///
+ protected override Db2Builder Merge(Db2Configuration oldValue, Db2Configuration newValue)
+ {
+ return new Db2Builder(new Db2Configuration(oldValue, newValue));
+ }
- return 0L.Equals(execResult.ExitCode);
+ ///
+ private sealed class WaitUntil : IWaitUntil
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The container configuration.
+ public WaitUntil(Db2Configuration configuration)
+ {
+ }
+
+ ///
+ public async Task UntilAsync(IContainer container)
+ {
+ var db2Container = (Db2Container)container;
+
+ var execResult = await db2Container.ExecScriptAsync("SELECT 1 FROM SYSIBM.SYSDUMMY1").ConfigureAwait(false);
+
+ return 0L.Equals(execResult.ExitCode);
+ }
}
- }
-}
+}
\ No newline at end of file
diff --git a/src/Testcontainers.Db2/Db2Configuration.cs b/src/Testcontainers.Db2/Db2Configuration.cs
index fbde4991f..e761990d0 100644
--- a/src/Testcontainers.Db2/Db2Configuration.cs
+++ b/src/Testcontainers.Db2/Db2Configuration.cs
@@ -4,18 +4,17 @@ namespace Testcontainers.Db2;
[PublicAPI]
public sealed class Db2Configuration : ContainerConfiguration
{
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Db2 database.
- /// The Db2 username.
- /// The Db2 password.
- /// The Db2 archive logs setting.
- /// The Db2 auto config setting.
- /// The Db2 license agreement.
- /// The Db2 database path to map into memory (tmpfs).
- public Db2Configuration(
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Db2 database.
+ /// The Db2 username.
+ /// The Db2 password.
+ /// The Db2 archive logs setting.
+ /// The Db2 auto config setting.
+ /// The Db2 license agreement.
+ /// The Db2 database path to map into memory (tmpfs).
+ public Db2Configuration(
string database = null,
string username = null,
string password = null,
@@ -23,95 +22,95 @@ public Db2Configuration(
bool autoConfig = false,
string licenseAgreement = null,
string inMemoryDatabasePath = null)
- {
- Database = database;
- Username = username;
- Password = password;
- ArchiveLogs = archiveLogs;
- AutoConfig = autoConfig;
- LicenseAgreement = licenseAgreement;
- InMemoryDatabasePath = inMemoryDatabasePath;
- }
+ {
+ Database = database;
+ Username = username;
+ Password = password;
+ ArchiveLogs = archiveLogs;
+ AutoConfig = autoConfig;
+ LicenseAgreement = licenseAgreement;
+ InMemoryDatabasePath = inMemoryDatabasePath;
+ }
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Docker resource configuration.
- public Db2Configuration(IResourceConfiguration resourceConfiguration)
- : base(resourceConfiguration)
- {
- // Passes the configuration upwards to the base implementations to create an updated immutable copy.
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Docker resource configuration.
+ public Db2Configuration(IResourceConfiguration resourceConfiguration)
+ : base(resourceConfiguration)
+ {
+ // Passes the configuration upwards to the base implementations to create an updated immutable copy.
+ }
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Docker resource configuration.
- public Db2Configuration(IContainerConfiguration resourceConfiguration)
- : base(resourceConfiguration)
- {
- // Passes the configuration upwards to the base implementations to create an updated immutable copy.
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Docker resource configuration.
+ public Db2Configuration(IContainerConfiguration resourceConfiguration)
+ : base(resourceConfiguration)
+ {
+ // Passes the configuration upwards to the base implementations to create an updated immutable copy.
+ }
- ///
- /// Initializes a new instance of the class.
- ///
- /// The Docker resource configuration.
- public Db2Configuration(Db2Configuration resourceConfiguration)
- : this(new Db2Configuration(), resourceConfiguration)
- {
- // Passes the configuration upwards to the base implementations to create an updated immutable copy.
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The Docker resource configuration.
+ public Db2Configuration(Db2Configuration resourceConfiguration)
+ : this(new Db2Configuration(), resourceConfiguration)
+ {
+ // Passes the configuration upwards to the base implementations to create an updated immutable copy.
+ }
- ///
- /// Initializes a new instance of the class.
- ///
- /// The old Docker resource configuration.
- /// The new Docker resource configuration.
- public Db2Configuration(Db2Configuration oldValue, Db2Configuration newValue)
- : base(oldValue, newValue)
- {
- Database = BuildConfiguration.Combine(oldValue.Database, newValue.Database);
- Username = BuildConfiguration.Combine(oldValue.Username, newValue.Username);
- Password = BuildConfiguration.Combine(oldValue.Password, newValue.Password);
- ArchiveLogs = BuildConfiguration.Combine(oldValue.ArchiveLogs, newValue.ArchiveLogs);
- AutoConfig = BuildConfiguration.Combine(oldValue.AutoConfig, newValue.AutoConfig);
- LicenseAgreement = BuildConfiguration.Combine(oldValue.LicenseAgreement, newValue.LicenseAgreement);
- InMemoryDatabasePath = BuildConfiguration.Combine(oldValue.InMemoryDatabasePath, newValue.InMemoryDatabasePath);
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The old Docker resource configuration.
+ /// The new Docker resource configuration.
+ public Db2Configuration(Db2Configuration oldValue, Db2Configuration newValue)
+ : base(oldValue, newValue)
+ {
+ Database = BuildConfiguration.Combine(oldValue.Database, newValue.Database);
+ Username = BuildConfiguration.Combine(oldValue.Username, newValue.Username);
+ Password = BuildConfiguration.Combine(oldValue.Password, newValue.Password);
+ ArchiveLogs = BuildConfiguration.Combine(oldValue.ArchiveLogs, newValue.ArchiveLogs);
+ AutoConfig = BuildConfiguration.Combine(oldValue.AutoConfig, newValue.AutoConfig);
+ LicenseAgreement = BuildConfiguration.Combine(oldValue.LicenseAgreement, newValue.LicenseAgreement);
+ InMemoryDatabasePath = BuildConfiguration.Combine(oldValue.InMemoryDatabasePath, newValue.InMemoryDatabasePath);
+ }
- ///
- /// Gets the Db2 database.
- ///
- public string Database { get; }
+ ///
+ /// Gets the Db2 database.
+ ///
+ public string Database { get; }
- ///
- /// Gets the Db2 username.
- ///
- public string Username { get; }
+ ///
+ /// Gets the Db2 username.
+ ///
+ public string Username { get; }
- ///
- /// Gets the Db2 password.
- ///
- public string Password { get; }
+ ///
+ /// Gets the Db2 password.
+ ///
+ public string Password { get; }
- ///
- /// Toggle for archivation of logs.
- ///
- public bool ArchiveLogs { get; }
+ ///
+ /// Toggle for archivation of logs.
+ ///
+ public bool ArchiveLogs { get; }
- ///
- /// Toggle for database autoconfiguration.
- ///
- public bool AutoConfig { get; }
+ ///
+ /// Toggle for database autoconfiguration.
+ ///
+ public bool AutoConfig { get; }
- ///
- /// License agreement value.
- ///
- public string LicenseAgreement { get; }
+ ///
+ /// License agreement value.
+ ///
+ public string LicenseAgreement { get; }
- ///
- /// Path to the database files that should be mapped into memory (tmpfs).
- ///
- public string InMemoryDatabasePath { get; }
-}
+ ///
+ /// Path to the database files that should be mapped into memory (tmpfs).
+ ///
+ public string InMemoryDatabasePath { get; }
+}
\ No newline at end of file
diff --git a/src/Testcontainers.Db2/Db2Container.cs b/src/Testcontainers.Db2/Db2Container.cs
index a81469b02..7e55509f4 100644
--- a/src/Testcontainers.Db2/Db2Container.cs
+++ b/src/Testcontainers.Db2/Db2Container.cs
@@ -1,13 +1,9 @@
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
+namespace Testcontainers.Db2;
-namespace Testcontainers.Db2
+///
+[PublicAPI]
+public sealed class Db2Container : DockerContainer, IDatabaseContainer
{
- ///
- [PublicAPI]
- public sealed class Db2Container : DockerContainer, IDatabaseContainer
- {
private static string Db2CommandPath = "/opt/ibm/db2/*/bin/db2";
private readonly Db2Configuration _configuration;
@@ -16,27 +12,29 @@ public sealed class Db2Container : DockerContainer, IDatabaseContainer
public Db2Container(Db2Configuration configuration) : base(configuration)
{
- _configuration = configuration;
+ _configuration = configuration;
}
public string GetConnectionString() => new StringBuilder()
- .Append("Server=").Append(Hostname).Append(':').Append(GetMappedPublicPort(Db2Builder.Db2Port).ToString()).Append(ConnectionStringDelimiter)
- .Append("Database=").Append(_configuration.Database).Append(ConnectionStringDelimiter)
- .Append("UID=").Append(_configuration.Username).Append(ConnectionStringDelimiter)
- .Append("PWD=").Append(_configuration.Password).Append(ConnectionStringDelimiter)
- .ToString();
+ .Append("Server=").Append(Hostname).Append(':').Append(GetMappedPublicPort(Db2Builder.Db2Port).ToString())
+ .Append(ConnectionStringDelimiter)
+ .Append("Database=").Append(_configuration.Database).Append(ConnectionStringDelimiter)
+ .Append("UID=").Append(_configuration.Username).Append(ConnectionStringDelimiter)
+ .Append("PWD=").Append(_configuration.Password).Append(ConnectionStringDelimiter)
+ .ToString();
public async Task ExecScriptAsync(string scriptContent, CancellationToken cancellationToken = default)
{
- string[] command = ["su", "db2inst1", "-c", new StringBuilder()
- .Append(Db2CommandPath).Append(" connect to ").Append(_configuration.Database)
- .Append(" user ").Append(_configuration.Username).Append(" using ").Append(_configuration.Password)
- .Append("; ")
- .Append(Db2CommandPath).Append(' ').Append(scriptContent)
- .ToString()
- ];
+ string[] command =
+ [
+ "su", "db2inst1", "-c", new StringBuilder()
+ .Append(Db2CommandPath).Append(" connect to ").Append(_configuration.Database)
+ .Append(" user ").Append(_configuration.Username).Append(" using ").Append(_configuration.Password)
+ .Append("; ")
+ .Append(Db2CommandPath).Append(' ').Append(scriptContent)
+ .ToString()
+ ];
- return await ExecAsync(command).ConfigureAwait(false);
+ return await ExecAsync(command).ConfigureAwait(false);
}
- }
-}
+}
\ No newline at end of file
diff --git a/src/Testcontainers.Db2/Testcontainers.Db2.csproj b/src/Testcontainers.Db2/Testcontainers.Db2.csproj
index 7a7ebd95d..9a25b9c4d 100644
--- a/src/Testcontainers.Db2/Testcontainers.Db2.csproj
+++ b/src/Testcontainers.Db2/Testcontainers.Db2.csproj
@@ -1,12 +1,12 @@
-
- net6.0;net8.0;netstandard2.0;netstandard2.1
- latest
-
-
-
-
-
-
-
-
+
+ net8.0;net9.0;netstandard2.0;netstandard2.1
+ latest
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Testcontainers.Db2/Usings.cs b/src/Testcontainers.Db2/Usings.cs
index 6d8716201..7a1babb38 100644
--- a/src/Testcontainers.Db2/Usings.cs
+++ b/src/Testcontainers.Db2/Usings.cs
@@ -1,7 +1,11 @@
+global using System;
+global using System.Linq;
+global using System.Text;
+global using System.Threading;
+global using System.Threading.Tasks;
global using Docker.DotNet.Models;
global using DotNet.Testcontainers;
global using DotNet.Testcontainers.Builders;
global using DotNet.Testcontainers.Configurations;
global using DotNet.Testcontainers.Containers;
-global using JetBrains.Annotations;
-global using System;
+global using JetBrains.Annotations;
\ No newline at end of file
diff --git a/tests/Testcontainers.Db2.Tests/Db2ContainerTest.cs b/tests/Testcontainers.Db2.Tests/Db2ContainerTest.cs
index 4e67214d3..e5b21ef2a 100644
--- a/tests/Testcontainers.Db2.Tests/Db2ContainerTest.cs
+++ b/tests/Testcontainers.Db2.Tests/Db2ContainerTest.cs
@@ -1,55 +1,53 @@
-using IBM.Data.Db2;
-
namespace Testcontainers.Db2;
public sealed class Db2ContainerTest : IAsyncLifetime
{
- // # --8<-- [start:UseDb2Container]
- private readonly Db2Container _db2Container = new Db2Builder().Build();
-
- public Task InitializeAsync()
- {
- return _db2Container.StartAsync();
- }
-
- public Task DisposeAsync()
- {
- return _db2Container.DisposeAsync().AsTask();
- }
-
- [Fact]
- [Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
- public async Task ReadFromDb2Database()
- {
- // Given
- using DbConnection connection = new DB2Connection(_db2Container.GetConnectionString());
-
- // When
- connection.Open();
-
- using DbCommand command = connection.CreateCommand();
- command.CommandText = "SELECT 1 FROM SYSIBM.SYSDUMMY1;";
-
- var actual = await command.ExecuteScalarAsync() as int?;
- Assert.Equal(1, actual.GetValueOrDefault());
-
- // Then
- Assert.Equal(ConnectionState.Open, connection.State);
- }
-
- [Fact]
- [Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
- public async Task ExecScriptReturnsSuccessful()
- {
- // Given
- const string scriptContent = "SELECT 1 FROM SYSIBM.SYSDUMMY1;";
-
- // When
- var execResult = await _db2Container.ExecScriptAsync(scriptContent);
-
- // Then
- Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
- Assert.Empty(execResult.Stderr);
- }
- // # --8<-- [end:UseDb2Container]
-}
+ // # --8<-- [start:UseDb2Container]
+ private readonly Db2Container _db2Container = new Db2Builder().Build();
+
+ public Task InitializeAsync()
+ {
+ return _db2Container.StartAsync();
+ }
+
+ public Task DisposeAsync()
+ {
+ return _db2Container.DisposeAsync().AsTask();
+ }
+
+ [Fact]
+ [Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
+ public async Task ReadFromDb2Database()
+ {
+ // Given
+ using DbConnection connection = new DB2Connection(_db2Container.GetConnectionString());
+
+ // When
+ connection.Open();
+
+ using DbCommand command = connection.CreateCommand();
+ command.CommandText = "SELECT 1 FROM SYSIBM.SYSDUMMY1;";
+
+ var actual = await command.ExecuteScalarAsync() as int?;
+ Assert.Equal(1, actual.GetValueOrDefault());
+
+ // Then
+ Assert.Equal(ConnectionState.Open, connection.State);
+ }
+
+ [Fact]
+ [Trait(nameof(DockerCli.DockerPlatform), nameof(DockerCli.DockerPlatform.Linux))]
+ public async Task ExecScriptReturnsSuccessful()
+ {
+ // Given
+ const string scriptContent = "SELECT 1 FROM SYSIBM.SYSDUMMY1;";
+
+ // When
+ var execResult = await _db2Container.ExecScriptAsync(scriptContent);
+
+ // Then
+ Assert.True(0L.Equals(execResult.ExitCode), execResult.Stderr);
+ Assert.Empty(execResult.Stderr);
+ }
+ // # --8<-- [end:UseDb2Container]
+}
\ No newline at end of file
diff --git a/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.csproj b/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.csproj
index 5b344a196..024d95cb7 100644
--- a/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.csproj
+++ b/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.csproj
@@ -1,40 +1,24 @@
-
-
-
-
-
-
- net8.0
+ net9.0
false
false
- amd64
- $(MSBuildProjectDirectory)/linux.runsettings
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
\ No newline at end of file
+
+
\ No newline at end of file
diff --git a/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.targets b/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.targets
new file mode 100644
index 000000000..32b2c12b2
--- /dev/null
+++ b/tests/Testcontainers.Db2.Tests/Testcontainers.Db2.Tests.targets
@@ -0,0 +1,22 @@
+
+
+ $(MSBuildProjectDirectory)/linux.runsettings
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/Testcontainers.Db2.Tests/Usings.cs b/tests/Testcontainers.Db2.Tests/Usings.cs
index 7b43902c3..dbf73bb31 100644
--- a/tests/Testcontainers.Db2.Tests/Usings.cs
+++ b/tests/Testcontainers.Db2.Tests/Usings.cs
@@ -1,5 +1,6 @@
-global using DotNet.Testcontainers.Commons;
global using System.Data;
global using System.Data.Common;
global using System.Threading.Tasks;
+global using DotNet.Testcontainers.Commons;
+global using IBM.Data.Db2;
global using Xunit;
\ No newline at end of file
diff --git a/tests/Testcontainers.Db2.Tests/linux.runsettings b/tests/Testcontainers.Db2.Tests/linux.runsettings
index 451ec8843..71fa659a1 100644
--- a/tests/Testcontainers.Db2.Tests/linux.runsettings
+++ b/tests/Testcontainers.Db2.Tests/linux.runsettings
@@ -1,10 +1,10 @@
-
+
-
-
- Filled by msbuild
- Filled by msbuild
- Filled by msbuild
-
-
+
+
+ Filled by msbuild
+ Filled by msbuild
+ Filled by msbuild
+
+
\ No newline at end of file