Skip to content

Commit

Permalink
Testcontainers - images
Browse files Browse the repository at this point in the history
  • Loading branch information
KSemenenko committed Jun 3, 2024
1 parent e64b91f commit 1b5fd89
Show file tree
Hide file tree
Showing 18 changed files with 58 additions and 16 deletions.
1 change: 0 additions & 1 deletion ManagedCode.Storage.Azure/ManagedCode.Storage.Azure.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

<ItemGroup>
<PackageReference Include="Azure.Identity" Version="1.11.3" />
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.18.0" />
<PackageReference Include="ManagedCode.Communication" Version="8.0.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.20.0" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ProjectReference Include="..\ManagedCode.Storage.FileSystem\ManagedCode.Storage.FileSystem.csproj" />
<ProjectReference Include="..\ManagedCode.Storage.Google\ManagedCode.Storage.Google.csproj" />
<ProjectReference Include="..\ManagedCode.Storage.Server\ManagedCode.Storage.Server.csproj" />
<ProjectReference Include="..\ManagedCode.Storage.Tests\ManagedCode.Storage.Tests.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using ManagedCode.Storage.Google.Extensions;
using ManagedCode.Storage.Google.Options;
using ManagedCode.Storage.IntegrationTests.TestApp;
using ManagedCode.Storage.Tests.Common;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
Expand All @@ -27,7 +28,7 @@ public class StorageTestApplication : WebApplicationFactory<HttpHostProgram>, IC
public StorageTestApplication()
{
_azuriteContainer = new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.30.0")
.WithImage(ContainerImages.Azurite)
.Build();

_azuriteContainer.StartAsync().Wait();
Expand Down
8 changes: 8 additions & 0 deletions ManagedCode.Storage.Tests/Common/ContainerImages.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace ManagedCode.Storage.Tests.Common;

public class ContainerImages
{
public const string Azurite = "mcr.microsoft.com/azure-storage/azurite:3.30.0";
public const string FakeGCSServer = "fsouza/fake-gcs-server:1.49.1";
public const string LocalStack = "localstack/localstack:3.4.0";
}
4 changes: 4 additions & 0 deletions ManagedCode.Storage.Tests/ManagedCode.Storage.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,9 @@
<ProjectReference Include="..\ManagedCode.Storage.TestFakes\ManagedCode.Storage.TestFakes.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="TestFakes\" />
</ItemGroup>

</Project>

5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/AWS/AWSBlobTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.LocalStack;

Expand All @@ -7,7 +8,9 @@ public class AWSBlobTests : BlobTests<LocalStackContainer>
{
protected override LocalStackContainer Build()
{
return new LocalStackBuilder().Build();
return new LocalStackBuilder()
.WithImage(ContainerImages.LocalStack)
.Build();

Check warning on line 13 in ManagedCode.Storage.Tests/Storages/AWS/AWSBlobTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/AWS/AWSBlobTests.cs#L11-L13

Added lines #L11 - L13 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/AWS/AWSContainerTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.LocalStack;

Expand All @@ -7,7 +8,9 @@ public class AWSContainerTests : ContainerTests<LocalStackContainer>
{
protected override LocalStackContainer Build()
{
return new LocalStackBuilder().Build();
return new LocalStackBuilder()
.WithImage(ContainerImages.LocalStack)
.Build();

Check warning on line 13 in ManagedCode.Storage.Tests/Storages/AWS/AWSContainerTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/AWS/AWSContainerTests.cs#L11-L13

Added lines #L11 - L13 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/AWS/AWSDownloadTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.LocalStack;

Expand All @@ -7,7 +8,9 @@ public class AWSDownloadTests : DownloadTests<LocalStackContainer>
{
protected override LocalStackContainer Build()
{
return new LocalStackBuilder().Build();
return new LocalStackBuilder()
.WithImage(ContainerImages.LocalStack)
.Build();

Check warning on line 13 in ManagedCode.Storage.Tests/Storages/AWS/AWSDownloadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/AWS/AWSDownloadTests.cs#L11-L13

Added lines #L11 - L13 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/AWS/AWSUploadTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.LocalStack;

Expand All @@ -7,7 +8,9 @@ public class AWSUploadTests : UploadTests<LocalStackContainer>
{
protected override LocalStackContainer Build()
{
return new LocalStackBuilder().Build();
return new LocalStackBuilder()
.WithImage(ContainerImages.LocalStack)
.Build();

Check warning on line 13 in ManagedCode.Storage.Tests/Storages/AWS/AWSUploadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/AWS/AWSUploadTests.cs#L11-L13

Added lines #L11 - L13 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class AzureBlobStreamTests : StreamTests<AzuriteContainer>
protected override AzuriteContainer Build()
{
return new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
.WithImage(ContainerImages.Azurite)

Check warning on line 20 in ManagedCode.Storage.Tests/Storages/Azure/AzureBlobStreamTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/Azure/AzureBlobStreamTests.cs#L20

Added line #L20 was not covered by tests
.Build();
}

Expand Down
3 changes: 2 additions & 1 deletion ManagedCode.Storage.Tests/Storages/Azure/AzureBlobTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.Azurite;

Expand All @@ -8,7 +9,7 @@ public class AzureBlobTests : BlobTests<AzuriteContainer>
protected override AzuriteContainer Build()
{
return new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
.WithImage(ContainerImages.Azurite)

Check warning on line 12 in ManagedCode.Storage.Tests/Storages/Azure/AzureBlobTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/Azure/AzureBlobTests.cs#L12

Added line #L12 was not covered by tests
.Build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.Azurite;

Expand All @@ -8,7 +9,7 @@ public class AzureContainerTests : ContainerTests<AzuriteContainer>
protected override AzuriteContainer Build()
{
return new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
.WithImage(ContainerImages.Azurite)

Check warning on line 12 in ManagedCode.Storage.Tests/Storages/Azure/AzureContainerTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/Azure/AzureContainerTests.cs#L12

Added line #L12 was not covered by tests
.Build();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.Azurite;

Expand All @@ -8,7 +9,7 @@ public class AzureDownloadTests : DownloadTests<AzuriteContainer>
protected override AzuriteContainer Build()
{
return new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
.WithImage(ContainerImages.Azurite)

Check warning on line 12 in ManagedCode.Storage.Tests/Storages/Azure/AzureDownloadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/Azure/AzureDownloadTests.cs#L12

Added line #L12 was not covered by tests
.Build();
}

Expand Down
3 changes: 2 additions & 1 deletion ManagedCode.Storage.Tests/Storages/Azure/AzureUploadTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.Azurite;

Expand All @@ -8,7 +9,7 @@ public class AzureUploadTests : UploadTests<AzuriteContainer>
protected override AzuriteContainer Build()
{
return new AzuriteBuilder()
.WithImage("mcr.microsoft.com/azure-storage/azurite:3.26.0")
.WithImage(ContainerImages.Azurite)

Check warning on line 12 in ManagedCode.Storage.Tests/Storages/Azure/AzureUploadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/Azure/AzureUploadTests.cs#L12

Added line #L12 was not covered by tests
.Build();
}

Expand Down
7 changes: 5 additions & 2 deletions ManagedCode.Storage.Tests/Storages/GCS/GCSBlobTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Extensions.DependencyInjection;
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.FakeGcsServer;
using Xunit;

Expand All @@ -11,7 +12,9 @@ public class GCSBlobTests : BlobTests<FakeGcsServerContainer>
{
protected override FakeGcsServerContainer Build()
{
return new FakeGcsServerBuilder().Build();
return new FakeGcsServerBuilder()
.WithImage(ContainerImages.FakeGCSServer)
.Build();

Check warning on line 17 in ManagedCode.Storage.Tests/Storages/GCS/GCSBlobTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/GCS/GCSBlobTests.cs#L15-L17

Added lines #L15 - L17 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/GCS/GCSContainerTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.FakeGcsServer;
using Xunit;
Expand All @@ -9,7 +10,9 @@ public class GCSContainerTests : ContainerTests<FakeGcsServerContainer>
{
protected override FakeGcsServerContainer Build()
{
return new FakeGcsServerBuilder().Build();
return new FakeGcsServerBuilder()
.WithImage(ContainerImages.FakeGCSServer)
.Build();

Check warning on line 15 in ManagedCode.Storage.Tests/Storages/GCS/GCSContainerTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/GCS/GCSContainerTests.cs#L13-L15

Added lines #L13 - L15 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
5 changes: 4 additions & 1 deletion ManagedCode.Storage.Tests/Storages/GCS/GCSDownloadTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.FakeGcsServer;
using Xunit;
Expand All @@ -9,7 +10,9 @@ public class GCSDownloadTests : DownloadTests<FakeGcsServerContainer>
{
protected override FakeGcsServerContainer Build()
{
return new FakeGcsServerBuilder().Build();
return new FakeGcsServerBuilder()
.WithImage(ContainerImages.FakeGCSServer)
.Build();

Check warning on line 15 in ManagedCode.Storage.Tests/Storages/GCS/GCSDownloadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/GCS/GCSDownloadTests.cs#L13-L15

Added lines #L13 - L15 were not covered by tests
}

protected override ServiceProvider ConfigureServices()
Expand Down
6 changes: 5 additions & 1 deletion ManagedCode.Storage.Tests/Storages/GCS/GCSUploadTests.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using ManagedCode.Storage.Tests.Common;
using Microsoft.Extensions.DependencyInjection;
using Testcontainers.FakeGcsServer;
using Xunit;
Expand All @@ -9,7 +10,10 @@ public class GCSUploadTests : UploadTests<FakeGcsServerContainer>
{
protected override FakeGcsServerContainer Build()
{
return new FakeGcsServerBuilder().Build();
return new FakeGcsServerBuilder()
.WithImage(ContainerImages.FakeGCSServer)
.Build();

Check warning on line 15 in ManagedCode.Storage.Tests/Storages/GCS/GCSUploadTests.cs

View check run for this annotation

Codecov / codecov/patch

ManagedCode.Storage.Tests/Storages/GCS/GCSUploadTests.cs#L13-L15

Added lines #L13 - L15 were not covered by tests

}

protected override ServiceProvider ConfigureServices()
Expand Down

0 comments on commit 1b5fd89

Please sign in to comment.