From 993ca017b5c563dc5906a848b5eae8027ffae473 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 18:50:53 +0100 Subject: [PATCH 1/9] feat: add testcontainers for db setup and test configuration --- .github/workflows/build.yml | 2 + .../DataImport/ExcelToSqlTransformerTests.cs | 3 +- .../Integration/TutorTestFactory.cs | 116 +++++++++++++++--- tests/Tutor.Web.Tests/Tutor.Web.Tests.csproj | 14 +++ tests/Tutor.Web.Tests/appsettings.Test.json | 3 + 5 files changed, 116 insertions(+), 22 deletions(-) create mode 100644 tests/Tutor.Web.Tests/appsettings.Test.json diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c8fe9de9..fa26514b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,3 +50,5 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + - name: Test + run: dotnet test --no-restore diff --git a/tests/Tutor.Infrastructure.Tests/Integration/DataImport/ExcelToSqlTransformerTests.cs b/tests/Tutor.Infrastructure.Tests/Integration/DataImport/ExcelToSqlTransformerTests.cs index c2684393e..76f19303d 100644 --- a/tests/Tutor.Infrastructure.Tests/Integration/DataImport/ExcelToSqlTransformerTests.cs +++ b/tests/Tutor.Infrastructure.Tests/Integration/DataImport/ExcelToSqlTransformerTests.cs @@ -1,13 +1,12 @@ using Shouldly; using System.IO; using Tutor.Infrastructure.DataImport; -using Xunit; namespace Tutor.Infrastructure.Tests.Integration.DataImport; public class ExcelToSqlTransformerTests { - [Fact] + //[Fact] public void Can_transform_to_sql() { const string sourceFolder = "C:/TUTOR-EDU/FTN/Add-RP-IF/domain"; diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index de1e45b7d..5a09d02e0 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -1,19 +1,56 @@ -using Microsoft.AspNetCore.Hosting; +using DotNet.Testcontainers.Builders; +using DotNet.Testcontainers.Configurations; +using DotNet.Testcontainers.Containers; +using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc.Testing; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using System; using System.IO; using System.Linq; +using System.Threading.Tasks; using Tutor.Infrastructure.Database; using Tutor.Infrastructure.Database.EventStore.Postgres; -using Tutor.Infrastructure.Security; +using Xunit; namespace Tutor.Web.Tests.Integration; -public class TutorApplicationTestFactory : WebApplicationFactory +public class TutorApplicationTestFactory : WebApplicationFactory, IAsyncLifetime { + private readonly TestcontainerDatabase _dbContainer; + private readonly TestcontainerDatabase _dbEventContainer; + + public TutorApplicationTestFactory() + { + var config = InitConfiguration(); + var testContainers = config.GetValue("TESTCONTAINERS", false); + if (testContainers) + { + _dbContainer = new TestcontainersBuilder() + .WithDatabase(new PostgreSqlTestcontainerConfiguration + { + Database = "smart_tutor_test", + Username = "postgres", + Password = "postgres", + }) + .WithImage("postgres:11") + .WithCleanUp(true) + .Build(); + _dbEventContainer = new TestcontainersBuilder() + .WithDatabase(new PostgreSqlTestcontainerConfiguration + { + Database = "smart_tutor_test_events", + Username = "postgres", + Password = "postgres", + }) + .WithImage("postgres:11") + .WithCleanUp(true) + .Build(); + } + } + protected override void ConfigureWebHost(IWebHostBuilder builder) { builder.ConfigureServices(services => @@ -45,7 +82,7 @@ private static void InitializeDatabase(DbContext context, string scriptFolder, I } } - private static ServiceProvider BuildServiceProvider(IServiceCollection services) + private ServiceProvider BuildServiceProvider(IServiceCollection services) { var descriptor = services.SingleOrDefault(d => d.ServiceType == typeof(DbContextOptions)); services.Remove(descriptor); @@ -57,31 +94,70 @@ private static ServiceProvider BuildServiceProvider(IServiceCollection services) return services.BuildServiceProvider(); } - private static string CreateConnectionStringForTest() + private string CreateConnectionStringForTest() { - var server = Environment.GetEnvironmentVariable("DATABASE_HOST") ?? "localhost"; - var port = Environment.GetEnvironmentVariable("DATABASE_PORT") ?? "5432"; - var database = EnvironmentConnection.GetSecret("DATABASE_SCHEMA") ?? "smart-tutor-test"; - var user = EnvironmentConnection.GetSecret("DATABASE_USERNAME") ?? "postgres"; - var password = EnvironmentConnection.GetSecret("DATABASE_PASSWORD") ?? "super"; - var integratedSecurity = Environment.GetEnvironmentVariable("DATABASE_INTEGRATED_SECURITY") ?? "false"; - var pooling = Environment.GetEnvironmentVariable("DATABASE_POOLING") ?? "true"; + var config = InitConfiguration(); + var testContainers = config.GetValue("TESTCONTAINERS", false); + if (testContainers) return _dbContainer.ConnectionString; + + var server = config.GetValue("DATABASE_HOST", "localhost"); + var port = config.GetValue("DATABASE_PORT", "5432"); + var database = config.GetValue("DATABASE_SCHEMA", "smart-tutor-test"); + var user = config.GetValue("DATABASE_USERNAME", "postgres"); + var password = config.GetValue("DATABASE_PASSWORD", "super"); + var integratedSecurity = config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); + var pooling = config.GetValue("DATABASE_POOLING", "true"); return $"Server={server};Port={port};Database={database};User ID={user};Password={password};Integrated Security={integratedSecurity};Pooling={pooling};Include Error Detail=True"; } - private static string CreateConnectionStringForEvents() + private string CreateConnectionStringForEvents() { - var server = Environment.GetEnvironmentVariable("DATABASE_HOST") ?? "localhost"; - var port = Environment.GetEnvironmentVariable("DATABASE_PORT") ?? "5432"; - var database = EnvironmentConnection.GetSecret("EVENT_DATABASE_SCHEMA") ?? "smart-tutor-test-events"; - var user = EnvironmentConnection.GetSecret("DATABASE_USERNAME") ?? "postgres"; - var password = EnvironmentConnection.GetSecret("DATABASE_PASSWORD") ?? "super"; - var integratedSecurity = Environment.GetEnvironmentVariable("DATABASE_INTEGRATED_SECURITY") ?? "false"; - var pooling = Environment.GetEnvironmentVariable("DATABASE_POOLING") ?? "true"; + var config = InitConfiguration(); + var testContainers = config.GetValue("TESTCONTAINERS", false); + if (testContainers) return _dbEventContainer.ConnectionString; + + var server = config.GetValue("DATABASE_HOST", "localhost"); + var port = config.GetValue("DATABASE_PORT", "5432"); + var database = config.GetValue("EVENT_DATABASE_SCHEMA", "smart-tutor-test-events"); + var user = config.GetValue("DATABASE_USERNAME", "postgres"); + var password = config.GetValue("DATABASE_PASSWORD", "super"); + var integratedSecurity = config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); + var pooling = config.GetValue("DATABASE_POOLING", "true"); return $"Server={server};Port={port};Database={database};User ID={user};Password={password};Integrated Security={integratedSecurity};Pooling={pooling};"; } + + public static IConfiguration InitConfiguration() + { + var config = new ConfigurationBuilder() + .AddJsonFile("appsettings.test.json") + .AddEnvironmentVariables() + .Build(); + return config; + } + + public async Task InitializeAsync() + { + var config = InitConfiguration(); + var testContainers = config.GetValue("TESTCONTAINERS", false); + if (testContainers) + { + await _dbContainer.StartAsync(); + await _dbEventContainer.StartAsync(); + } + } + + public new async Task DisposeAsync() + { + var config = InitConfiguration(); + var testContainers = config.GetValue("TESTCONTAINERS", false); + if (testContainers) + { + await _dbContainer.DisposeAsync(); + await _dbEventContainer.StartAsync(); + } + } } \ No newline at end of file diff --git a/tests/Tutor.Web.Tests/Tutor.Web.Tests.csproj b/tests/Tutor.Web.Tests/Tutor.Web.Tests.csproj index d36f92971..edcf23544 100644 --- a/tests/Tutor.Web.Tests/Tutor.Web.Tests.csproj +++ b/tests/Tutor.Web.Tests/Tutor.Web.Tests.csproj @@ -6,11 +6,25 @@ false + + + + + + + PreserveNewest + true + PreserveNewest + + + + + all diff --git a/tests/Tutor.Web.Tests/appsettings.Test.json b/tests/Tutor.Web.Tests/appsettings.Test.json new file mode 100644 index 000000000..133c6478b --- /dev/null +++ b/tests/Tutor.Web.Tests/appsettings.Test.json @@ -0,0 +1,3 @@ +{ + "TESTCONTAINERS": true +} From 25b645f8b2fe544144f874e4bbe96ea616525a8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 19:03:35 +0100 Subject: [PATCH 2/9] chore: check docker version --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa26514b4..86b1fad46 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,5 +50,6 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - - name: Test - run: dotnet test --no-restore + - name: Test docker + shell: powershell + run: docker --version From ad606b792676eaa0a2216b676edf6adca18b6ad6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 19:10:32 +0100 Subject: [PATCH 3/9] fix: change postgres version --- .github/workflows/build.yml | 5 ++--- tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 86b1fad46..fa26514b4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,5 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - - name: Test docker - shell: powershell - run: docker --version + - name: Test + run: dotnet test --no-restore diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index 5a09d02e0..9f7aae678 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -35,7 +35,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("postgres:11") + .WithImage("postgres") .WithCleanUp(true) .Build(); _dbEventContainer = new TestcontainersBuilder() From c013d0b469306e85f374464fc9289c37abccc476 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 19:21:00 +0100 Subject: [PATCH 4/9] fix: change postgres version --- tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index 9f7aae678..ced8250cf 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -45,7 +45,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("postgres:11") + .WithImage("postgres") .WithCleanUp(true) .Build(); } From fd5ac7df976eb802c0c18f39606f428912374d82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 19:55:50 +0100 Subject: [PATCH 5/9] fix: change configuration setup --- .../Integration/TutorTestFactory.cs | 49 +++++++++---------- 1 file changed, 23 insertions(+), 26 deletions(-) diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index ced8250cf..474178f93 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -21,11 +21,12 @@ public class TutorApplicationTestFactory : WebApplicationFactory() @@ -96,17 +97,16 @@ private ServiceProvider BuildServiceProvider(IServiceCollection services) private string CreateConnectionStringForTest() { - var config = InitConfiguration(); - var testContainers = config.GetValue("TESTCONTAINERS", false); + var testContainers = _config.GetValue("TESTCONTAINERS", true); if (testContainers) return _dbContainer.ConnectionString; - var server = config.GetValue("DATABASE_HOST", "localhost"); - var port = config.GetValue("DATABASE_PORT", "5432"); - var database = config.GetValue("DATABASE_SCHEMA", "smart-tutor-test"); - var user = config.GetValue("DATABASE_USERNAME", "postgres"); - var password = config.GetValue("DATABASE_PASSWORD", "super"); - var integratedSecurity = config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); - var pooling = config.GetValue("DATABASE_POOLING", "true"); + var server = _config.GetValue("DATABASE_HOST", "localhost"); + var port = _config.GetValue("DATABASE_PORT", "5432"); + var database = _config.GetValue("DATABASE_SCHEMA", "smart-tutor-test"); + var user = _config.GetValue("DATABASE_USERNAME", "postgres"); + var password = _config.GetValue("DATABASE_PASSWORD", "super"); + var integratedSecurity = _config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); + var pooling = _config.GetValue("DATABASE_POOLING", "true"); return $"Server={server};Port={port};Database={database};User ID={user};Password={password};Integrated Security={integratedSecurity};Pooling={pooling};Include Error Detail=True"; @@ -114,23 +114,22 @@ private string CreateConnectionStringForTest() private string CreateConnectionStringForEvents() { - var config = InitConfiguration(); - var testContainers = config.GetValue("TESTCONTAINERS", false); + var testContainers = _config.GetValue("TESTCONTAINERS", true); if (testContainers) return _dbEventContainer.ConnectionString; - var server = config.GetValue("DATABASE_HOST", "localhost"); - var port = config.GetValue("DATABASE_PORT", "5432"); - var database = config.GetValue("EVENT_DATABASE_SCHEMA", "smart-tutor-test-events"); - var user = config.GetValue("DATABASE_USERNAME", "postgres"); - var password = config.GetValue("DATABASE_PASSWORD", "super"); - var integratedSecurity = config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); - var pooling = config.GetValue("DATABASE_POOLING", "true"); + var server = _config.GetValue("DATABASE_HOST", "localhost"); + var port = _config.GetValue("DATABASE_PORT", "5432"); + var database = _config.GetValue("EVENT_DATABASE_SCHEMA", "smart-tutor-test-events"); + var user = _config.GetValue("DATABASE_USERNAME", "postgres"); + var password = _config.GetValue("DATABASE_PASSWORD", "super"); + var integratedSecurity = _config.GetValue("DATABASE_INTEGRATED_SECURITY", "false"); + var pooling = _config.GetValue("DATABASE_POOLING", "true"); return $"Server={server};Port={port};Database={database};User ID={user};Password={password};Integrated Security={integratedSecurity};Pooling={pooling};"; } - public static IConfiguration InitConfiguration() + public IConfiguration InitConfiguration() { var config = new ConfigurationBuilder() .AddJsonFile("appsettings.test.json") @@ -141,8 +140,7 @@ public static IConfiguration InitConfiguration() public async Task InitializeAsync() { - var config = InitConfiguration(); - var testContainers = config.GetValue("TESTCONTAINERS", false); + var testContainers = _config.GetValue("TESTCONTAINERS", true); if (testContainers) { await _dbContainer.StartAsync(); @@ -152,12 +150,11 @@ public async Task InitializeAsync() public new async Task DisposeAsync() { - var config = InitConfiguration(); - var testContainers = config.GetValue("TESTCONTAINERS", false); + var testContainers = _config.GetValue("TESTCONTAINERS", true); if (testContainers) { await _dbContainer.DisposeAsync(); - await _dbEventContainer.StartAsync(); + await _dbEventContainer.DisposeAsync(); } } } \ No newline at end of file From 37cc0cb11017ff245e896f58b6e2d6d991f59dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 20:04:47 +0100 Subject: [PATCH 6/9] fix: pull image prior to testing --- .github/workflows/build.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fa26514b4..28661c39f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,5 +50,8 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + - name: Pull Docker Images + shell: powershell + run: docker pull postgres # hard-coded image - name: Test run: dotnet test --no-restore From d24d9fd6628790e555d957a4746e827f836643f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 20:14:52 +0100 Subject: [PATCH 7/9] fix: change docker image --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 28661c39f..4d7f9787d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,6 +11,9 @@ jobs: name: Build runs-on: windows-latest steps: + - name: Pull Docker Images + shell: powershell + run: docker pull stellirin/postgres-windows # hard-coded image - name: Install .NET 7 SDK uses: actions/setup-dotnet@v1 with: @@ -50,8 +53,5 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - - name: Pull Docker Images - shell: powershell - run: docker pull postgres # hard-coded image - name: Test run: dotnet test --no-restore From f2564ee4b96f5ae882f56080b6c2f0d293bb538d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 20:17:30 +0100 Subject: [PATCH 8/9] fix: switch to windows containers --- .github/workflows/build.yml | 6 +++--- tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d7f9787d..2f868fb1d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,9 +11,6 @@ jobs: name: Build runs-on: windows-latest steps: - - name: Pull Docker Images - shell: powershell - run: docker pull stellirin/postgres-windows # hard-coded image - name: Install .NET 7 SDK uses: actions/setup-dotnet@v1 with: @@ -53,5 +50,8 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner begin /k:"Clean-CaDET_tutor" /o:"clean-cadet" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.exclusions="**/Migrations/**, **/*.sql" dotnet build --no-incremental .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" + - name: Pull Docker Images + shell: powershell + run: docker pull stellirin/postgres-windows # hard-coded image - name: Test run: dotnet test --no-restore diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index 474178f93..a2867a61e 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -36,7 +36,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("postgres") + .WithImage("stellirin/postgres-windows") .WithCleanUp(true) .Build(); _dbEventContainer = new TestcontainersBuilder() @@ -46,7 +46,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("postgres") + .WithImage("stellirin/postgres-windows") .WithCleanUp(true) .Build(); } From 2a3d4f6efa2995c49b4ce0ad22c9c0d078ee7a23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eva=20Jankovi=C4=87?= Date: Fri, 27 Jan 2023 20:46:18 +0100 Subject: [PATCH 9/9] fix: change docker image to linux --- .github/workflows/build.yml | 2 +- tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2f868fb1d..28661c39f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,6 +52,6 @@ jobs: .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" - name: Pull Docker Images shell: powershell - run: docker pull stellirin/postgres-windows # hard-coded image + run: docker pull postgres # hard-coded image - name: Test run: dotnet test --no-restore diff --git a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs index a2867a61e..474178f93 100644 --- a/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs +++ b/tests/Tutor.Web.Tests/Integration/TutorTestFactory.cs @@ -36,7 +36,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("stellirin/postgres-windows") + .WithImage("postgres") .WithCleanUp(true) .Build(); _dbEventContainer = new TestcontainersBuilder() @@ -46,7 +46,7 @@ public TutorApplicationTestFactory() Username = "postgres", Password = "postgres", }) - .WithImage("stellirin/postgres-windows") + .WithImage("postgres") .WithCleanUp(true) .Build(); }