Skip to content

Commit dfe62e1

Browse files
committed
test containsers
1 parent 8909d82 commit dfe62e1

File tree

14 files changed

+678
-464
lines changed

14 files changed

+678
-464
lines changed

.github/workflows/dotnet.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ jobs:
2020
- name: checkout
2121
uses: actions/checkout@v3
2222

23-
- name: docker run fake-gcs-server
24-
run: |
25-
docker run -d --name fake-gcs-server -p 4443:4443 -v ${PWD}/examples/data:/data fsouza/fake-gcs-server -scheme http -external-url "http://localhost:4443"
26-
sleep 5s
27-
28-
- name: check storage emulators
29-
run: |
30-
curl http://localhost:4443
31-
32-
3323
- name: Setup .NET
3424
uses: actions/setup-dotnet@v3
3525
with:
Lines changed: 100 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,100 @@
1-
using System;
2-
using Amazon;
3-
using Amazon.S3;
4-
using FluentAssertions;
5-
using ManagedCode.Storage.Aws;
6-
using ManagedCode.Storage.Aws.Extensions;
7-
using ManagedCode.Storage.Aws.Options;
8-
using ManagedCode.Storage.Core;
9-
using ManagedCode.Storage.Core.Exceptions;
10-
using Microsoft.Extensions.DependencyInjection;
11-
using Testcontainers.LocalStack;
12-
using Xunit;
13-
14-
namespace ManagedCode.Storage.Tests.AWS;
15-
16-
public class AWSStorageTests : StorageBaseTests
17-
{
18-
protected override ServiceProvider ConfigureServices()
19-
{
20-
21-
22-
var services = new ServiceCollection();
23-
24-
// AWS library overwrites property values. you should only create configurations this way.
25-
var awsConfig = new AmazonS3Config
26-
{
27-
RegionEndpoint = RegionEndpoint.EUWest1,
28-
ForcePathStyle = true,
29-
UseHttp = true,
30-
ServiceURL = "http://localhost:4566" // this is the default port for the aws s3 emulator, must be last in the list
31-
};
32-
33-
services.AddAWSStorageAsDefault(opt =>
34-
{
35-
opt.PublicKey = "localkey";
36-
opt.SecretKey = "localsecret";
37-
opt.Bucket = "managed-code-bucket";
38-
opt.OriginalOptions = awsConfig;
39-
});
40-
41-
services.AddAWSStorage(new AWSStorageOptions
42-
{
43-
PublicKey = "localkey",
44-
SecretKey = "localsecret",
45-
Bucket = "managed-code-bucket",
46-
OriginalOptions = awsConfig
47-
});
48-
return services.BuildServiceProvider();
49-
}
50-
51-
[Fact]
52-
public void BadConfigurationForStorage_WithoutPublicKey_ThrowException()
53-
{
54-
var services = new ServiceCollection();
55-
56-
Action action = () => services.AddAWSStorage(opt =>
57-
{
58-
opt.SecretKey = "localsecret";
59-
opt.Bucket = "managed-code-bucket";
60-
});
61-
62-
action.Should().Throw<BadConfigurationException>();
63-
}
64-
65-
[Fact]
66-
public void BadConfigurationForStorage_WithoutSecretKey_ThrowException()
67-
{
68-
var services = new ServiceCollection();
69-
70-
Action action = () => services.AddAWSStorageAsDefault(opt =>
71-
{
72-
opt.PublicKey = "localkey";
73-
opt.Bucket = "managed-code-bucket";
74-
});
75-
76-
action.Should().Throw<BadConfigurationException>();
77-
}
78-
79-
[Fact]
80-
public void BadConfigurationForStorage_WithoutBucket_ThrowException()
81-
{
82-
var services = new ServiceCollection();
83-
84-
Action action = () => services.AddAWSStorageAsDefault(new AWSStorageOptions
85-
{
86-
PublicKey = "localkey",
87-
SecretKey = "localsecret"
88-
});
89-
90-
action.Should().Throw<BadConfigurationException>();
91-
}
92-
93-
[Fact]
94-
public void StorageAsDefaultTest()
95-
{
96-
var storage = ServiceProvider.GetService<IAWSStorage>();
97-
var defaultStorage = ServiceProvider.GetService<IStorage>();
98-
storage?.GetType().FullName.Should().Be(defaultStorage?.GetType().FullName);
99-
}
100-
}
1+
// using System;
2+
// using Amazon;
3+
// using Amazon.S3;
4+
// using FluentAssertions;
5+
// using ManagedCode.Storage.Aws;
6+
// using ManagedCode.Storage.Aws.Extensions;
7+
// using ManagedCode.Storage.Aws.Options;
8+
// using ManagedCode.Storage.Core;
9+
// using ManagedCode.Storage.Core.Exceptions;
10+
// using Microsoft.Extensions.DependencyInjection;
11+
// using Testcontainers.LocalStack;
12+
// using Xunit;
13+
//
14+
// namespace ManagedCode.Storage.Tests.AWS;
15+
//
16+
// public class AWSStorageTests : StorageBaseTests
17+
// {
18+
// protected override ServiceProvider ConfigureServices()
19+
// {
20+
//
21+
//
22+
// var services = new ServiceCollection();
23+
//
24+
// // AWS library overwrites property values. you should only create configurations this way.
25+
// var awsConfig = new AmazonS3Config
26+
// {
27+
// RegionEndpoint = RegionEndpoint.EUWest1,
28+
// ForcePathStyle = true,
29+
// UseHttp = true,
30+
// ServiceURL = "http://localhost:4566" // this is the default port for the aws s3 emulator, must be last in the list
31+
// };
32+
//
33+
// services.AddAWSStorageAsDefault(opt =>
34+
// {
35+
// opt.PublicKey = "localkey";
36+
// opt.SecretKey = "localsecret";
37+
// opt.Bucket = "managed-code-bucket";
38+
// opt.OriginalOptions = awsConfig;
39+
// });
40+
//
41+
// services.AddAWSStorage(new AWSStorageOptions
42+
// {
43+
// PublicKey = "localkey",
44+
// SecretKey = "localsecret",
45+
// Bucket = "managed-code-bucket",
46+
// OriginalOptions = awsConfig
47+
// });
48+
// return services.BuildServiceProvider();
49+
// }
50+
//
51+
// [Fact]
52+
// public void BadConfigurationForStorage_WithoutPublicKey_ThrowException()
53+
// {
54+
// var services = new ServiceCollection();
55+
//
56+
// Action action = () => services.AddAWSStorage(opt =>
57+
// {
58+
// opt.SecretKey = "localsecret";
59+
// opt.Bucket = "managed-code-bucket";
60+
// });
61+
//
62+
// action.Should().Throw<BadConfigurationException>();
63+
// }
64+
//
65+
// [Fact]
66+
// public void BadConfigurationForStorage_WithoutSecretKey_ThrowException()
67+
// {
68+
// var services = new ServiceCollection();
69+
//
70+
// Action action = () => services.AddAWSStorageAsDefault(opt =>
71+
// {
72+
// opt.PublicKey = "localkey";
73+
// opt.Bucket = "managed-code-bucket";
74+
// });
75+
//
76+
// action.Should().Throw<BadConfigurationException>();
77+
// }
78+
//
79+
// [Fact]
80+
// public void BadConfigurationForStorage_WithoutBucket_ThrowException()
81+
// {
82+
// var services = new ServiceCollection();
83+
//
84+
// Action action = () => services.AddAWSStorageAsDefault(new AWSStorageOptions
85+
// {
86+
// PublicKey = "localkey",
87+
// SecretKey = "localsecret"
88+
// });
89+
//
90+
// action.Should().Throw<BadConfigurationException>();
91+
// }
92+
//
93+
// [Fact]
94+
// public void StorageAsDefaultTest()
95+
// {
96+
// var storage = ServiceProvider.GetService<IAWSStorage>();
97+
// var defaultStorage = ServiceProvider.GetService<IStorage>();
98+
// storage?.GetType().FullName.Should().Be(defaultStorage?.GetType().FullName);
99+
// }
100+
// }

0 commit comments

Comments
 (0)