Commit 6eb1a877 authored by Petar Hristov's avatar Petar Hristov 💬
Browse files

Fix: Updated dependency

parent 2f175428
# Resource Type Waterbutler RDS S3
\ No newline at end of file
......@@ -11,7 +11,7 @@ using System.Reflection;
namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
{
[TestFixture]
public class ResourceTypeWaterbutlerS3Tests
public class ResourceTypeWaterbutlerRdsS3Tests
{
private readonly string _testPrefix = "Coscine-ResourceTypeWaterbutlerS3Tests-Tests";
private readonly string _rdsS3KeyPrefix = "coscine/global/rds/ecs-rwth/rds-s3";
......@@ -22,6 +22,9 @@ namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
private EcsManager _rdsS3EcsManager;
private EcsManager _userEcsManager;
private string _resourceType;
private string _localAssemblyName;
private long _quota;
private Guid _guid;
......@@ -36,20 +39,23 @@ namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
private string _accessKey;
[OneTimeSetUp]
public void Setup()
public void OneTimeSetUp()
{
_resourceTypeConfiguration.Config = new Dictionary<string, string>
{
};
_resourceType = "rdss3";
_localAssemblyName = "Coscine.ResourceTypeWaterbutlerRdsS3";
_quota = 1;
_guid = Guid.NewGuid();
_bucketName = $"{_testPrefix}.{_guid}";
_secretKey = "VERY_S3cr3t_Key!!!";
_readUser = $"{_testPrefix}.read_{_guid}";
_writeUser = $"{_testPrefix}.write_{_guid}";
_endpoint = _configuration.GetString("coscine/global/rds/ecs-rwth/rds-s3/s3_endpoint");
_accessKey = _configuration.GetString("coscine/global/rds/ecs-rwth/rds-s3/object_user_name");
_endpoint = _configuration.GetString($"{_rdsS3KeyPrefix}/s3_endpoint");
_accessKey = _configuration.GetString($"{_rdsS3KeyPrefix}/object_user_name");
_rdsS3EcsManager = new EcsManager
{
EcsManagerConfiguration = new EcsManagerConfiguration
......@@ -78,9 +84,9 @@ namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
}
[OneTimeTearDown]
public void End()
public void OneTimeTearDown()
{
/*try
try
{
_userEcsManager.DeleteObjectUser(_readUser).Wait();
_userEcsManager.DeleteObjectUser(_writeUser).Wait();
......@@ -89,19 +95,19 @@ namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
catch (Exception)
{
}*/
}
}
[Test]
public void TestConstructor()
{
_ = new ResourceTypeWaterbutlerRdsS3("rdss3", _configuration, _resourceTypeConfiguration);
_ = new ResourceTypeWaterbutlerRdsS3(_resourceType, _configuration, _resourceTypeConfiguration);
}
/*[Test]
[Test]
public void TestCreate()
{
var resourceType = new ResourceTypeWaterbutlerRdsS3("rdss3", _configuration, _resourceTypeConfiguration);
var resourceType = new ResourceTypeWaterbutlerRdsS3(_resourceType, _configuration, _resourceTypeConfiguration);
resourceType.CreateResource(new Dictionary<string, string> {
{ "bucketname", _bucketName },
{ "size", $"{_quota}" },
......@@ -114,19 +120,18 @@ namespace Coscine.ResourceTypeWaterbutlerRdsS3.Test
{ "readonly", "false" },
}).Wait();
// No implementation for deletion
Assert.True(_userEcsManager.DeleteObjectUser(_readUser).Result);
Assert.True(_userEcsManager.DeleteObjectUser(_writeUser).Result);
Assert.True(_rdsS3EcsManager.DeleteBucket(_bucketName).Result);
}*/
}
[Test]
public void TestResourceTypeInformation()
{
// Load the current assembly from the ref and not the locally installed.
var assemblyName = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Where(x => x.Name == "Coscine.ResourceTypeWaterbutlerRdsS3").FirstOrDefault();
var assemblyName = Assembly.GetExecutingAssembly().GetReferencedAssemblies().Where(x => x.Name == _localAssemblyName).FirstOrDefault();
var assembly = Assembly.Load(assemblyName);
var resourceType = ResourceTypeFactory.CreateResourceTypeObject("rdss3", new ConsulConfiguration(), assembly);
var resourceType = ResourceTypeFactory.CreateResourceTypeObject(_resourceType, new ConsulConfiguration(), assembly);
var resourceTypeInformation = resourceType.GetResourceTypeInformation().Result;
Assert.IsTrue(resourceTypeInformation.IsQuotaAvailable);
Assert.IsFalse(resourceTypeInformation.IsQuotaAdjustable);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment