Skip to content
Snippets Groups Projects
Commit 7b2f5b25 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Fix: To long default retention

parent a7b5a0d2
No related tags found
1 merge request!3Fix: To long default retention
Pipeline #724464 passed
......@@ -182,7 +182,7 @@ namespace Coscine.ResourceTypes.RdsWorm
try
{
//await _s3client.PutBucketPolicyAsync(putRequest);
await _s3client.PutBucketPolicyAsync(putRequest);
}
#pragma warning disable RCS1075 // Avoid empty catch clause that catches System.Exception.
catch (Exception)
......@@ -203,14 +203,13 @@ namespace Coscine.ResourceTypes.RdsWorm
throw new ArgumentNullException(nameof(quota));
}
// Retention default for Int64 max value is about 292471208677 years
// Should be enough
var retention = long.MaxValue;
// Approximately 11 years. At least 10.
var retention = 60L * 60L * 24L * 365L * 11L;
// Set retention to one day for our simulator
// Set retention to one week for our simulator
if (RdsS3WormResourceTypeConfiguration.Endpoint.Contains("ecs-sim01.itc.rwth-aachen.de"))
{
retention = 60 * 60 * 24;
retention = 60L * 60L * 24L * 7L;
}
if (options?.ContainsKey("retention") == true && long.TryParse(options["retention"], out var retentionResult))
......
......@@ -150,6 +150,12 @@ namespace Coscine.ResourceTypes.Tests
var s3Client = GetS3Client(_type, specificType);
Assert.Throws<AggregateException>(() => s3Client.DeleteObjectAsync(deleteObjectRequest).Wait());
memoryStream = new MemoryStream();
memoryStream.Write(testData, 0, testData.Length);
memoryStream.Position = 0;
Assert.Throws<AggregateException>(() => resourceType.StoreEntry(_bucketName, randomFileName, memoryStream).Wait());
bool objectDeleted = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment