Skip to content

Commit

Permalink
Added missing tests - removed some skips
Browse files Browse the repository at this point in the history
  • Loading branch information
niemyjski committed Sep 26, 2024
1 parent 75d29d7 commit 675c196
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 38 deletions.
8 changes: 6 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: '2.1'
services:
localstack:
image: localstack/localstack:3.0.2
image: localstack/localstack:3.7.2
ports:
- 4563-4599:4563-4599
- 8055:8080
Expand All @@ -11,6 +10,11 @@ services:
volumes:
- "localstackdata:/var/lib/localstack"
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
resources:
limits:
memory: 1g

ready:
image: andrewlock/wait-for-dependencies
command: localstack:4566
Expand Down
1 change: 0 additions & 1 deletion src/Foundatio.AWS/Queues/SQSQueueEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ namespace Foundatio.Queues;
public class SQSQueueEntry<T>
: QueueEntry<T> where T : class
{

public Message UnderlyingMessage { get; }

public SQSQueueEntry(Message message, T value, IQueue<T> queue)
Expand Down
117 changes: 88 additions & 29 deletions tests/Foundatio.AWS.Tests/Queues/SQSQueueTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,35 +52,15 @@ protected IQueue<SimpleWorkItem> GetQueue(int retries = 1, TimeSpan? workItemTim
}

[Fact]
public void RetryBackoff()
public override Task CanQueueAndDequeueWorkItemAsync()
{
var options = new SQSQueueOptions<SimpleWorkItem>();
var backoff1 = options.RetryDelay(1);
Assert.InRange(backoff1, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3));
var backoff2 = options.RetryDelay(2);
Assert.InRange(backoff2, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(5));
var backoff3 = options.RetryDelay(3);
Assert.InRange(backoff3, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(9));
var backoff4 = options.RetryDelay(4);
Assert.InRange(backoff4, TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(17));
var backoff5 = options.RetryDelay(5);
Assert.InRange(backoff5, TimeSpan.FromSeconds(32), TimeSpan.FromSeconds(33));
var backoff6 = options.RetryDelay(6);
Assert.InRange(backoff6, TimeSpan.FromSeconds(64), TimeSpan.FromSeconds(65));
var backoff7 = options.RetryDelay(7);
Assert.InRange(backoff7, TimeSpan.FromSeconds(128), TimeSpan.FromSeconds(129));
var backoff8 = options.RetryDelay(8);
Assert.InRange(backoff8, TimeSpan.FromSeconds(256), TimeSpan.FromSeconds(257));
var backoff9 = options.RetryDelay(9);
Assert.InRange(backoff9, TimeSpan.FromSeconds(512), TimeSpan.FromSeconds(513));
var backoff10 = options.RetryDelay(10);
Assert.InRange(backoff10, TimeSpan.FromSeconds(1024), TimeSpan.FromSeconds(1025));
return base.CanQueueAndDequeueWorkItemAsync();
}

[Fact]
public override Task CanQueueAndDequeueWorkItemAsync()
public override Task CanQueueAndDequeueWorkItemWithDelayAsync()
{
return base.CanQueueAndDequeueWorkItemAsync();
return base.CanQueueAndDequeueWorkItemWithDelayAsync();
}

[Fact]
Expand All @@ -89,23 +69,46 @@ public override Task CanUseQueueOptionsAsync()
return base.CanUseQueueOptionsAsync();
}

[Fact]
public override Task CanDiscardDuplicateQueueEntriesAsync()
{
return base.CanDiscardDuplicateQueueEntriesAsync();
}

[Fact]
public override Task CanDequeueWithCancelledTokenAsync()
{
return base.CanDequeueWithCancelledTokenAsync();
}

[Fact]
public override Task CanDequeueEfficientlyAsync()
{
return base.CanDequeueEfficientlyAsync();
}

[Fact]
public override Task CanResumeDequeueEfficientlyAsync()
{
return base.CanResumeDequeueEfficientlyAsync();
}

[Fact]
public override Task CanQueueAndDequeueMultipleWorkItemsAsync()
{
return base.CanQueueAndDequeueMultipleWorkItemsAsync();
}

[Fact(Skip = "Some issue where this test fails if it's run with others")]
public override async Task WillWaitForItemAsync()
[Fact]
public override Task WillNotWaitForItemAsync()
{
await Task.Delay(5000);
await base.WillWaitForItemAsync();
return base.WillNotWaitForItemAsync();
}

[Fact]
public override Task WillWaitForItemAsync()
{
return base.WillWaitForItemAsync();
}

[Fact]
Expand Down Expand Up @@ -144,12 +147,18 @@ public override Task CanAutoCompleteWorkerAsync()
return base.CanAutoCompleteWorkerAsync();
}

[Fact(Skip = "Doesn't work well on SQS")]
[Fact]
public override Task CanHaveMultipleQueueInstancesAsync()
{
return base.CanHaveMultipleQueueInstancesAsync();
}

[Fact]
public override Task CanDelayRetryAsync()
{
return base.CanDelayRetryAsync();
}

[Fact]
public override Task CanRunWorkItemWithMetricsAsync()
{
Expand All @@ -174,6 +183,24 @@ public override Task CanCompleteQueueEntryOnceAsync()
return base.CanCompleteQueueEntryOnceAsync();
}

[Fact]
public override Task CanDequeueWithLockingAsync()
{
return base.CanDequeueWithLockingAsync();
}

[Fact]
public override Task CanHaveMultipleQueueInstancesWithLockingAsync()
{
return base.CanHaveMultipleQueueInstancesWithLockingAsync();
}

[Fact]
public override Task MaintainJobNotAbandon_NotWorkTimeOutEntry()
{
return base.MaintainJobNotAbandon_NotWorkTimeOutEntry();
}

[Fact]
public override Task VerifyRetryAttemptsAsync()
{
Expand All @@ -186,6 +213,38 @@ public override Task VerifyDelayedRetryAttemptsAsync()
return base.VerifyDelayedRetryAttemptsAsync();
}

[Fact]
public override Task CanHandleAutoAbandonInWorker()
{
return base.CanHandleAutoAbandonInWorker();
}

[Fact]
public void RetryBackoff()
{
var options = new SQSQueueOptions<SimpleWorkItem>();
var backoff1 = options.RetryDelay(1);
Assert.InRange(backoff1, TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(3));
var backoff2 = options.RetryDelay(2);
Assert.InRange(backoff2, TimeSpan.FromSeconds(4), TimeSpan.FromSeconds(5));
var backoff3 = options.RetryDelay(3);
Assert.InRange(backoff3, TimeSpan.FromSeconds(8), TimeSpan.FromSeconds(9));
var backoff4 = options.RetryDelay(4);
Assert.InRange(backoff4, TimeSpan.FromSeconds(16), TimeSpan.FromSeconds(17));
var backoff5 = options.RetryDelay(5);
Assert.InRange(backoff5, TimeSpan.FromSeconds(32), TimeSpan.FromSeconds(33));
var backoff6 = options.RetryDelay(6);
Assert.InRange(backoff6, TimeSpan.FromSeconds(64), TimeSpan.FromSeconds(65));
var backoff7 = options.RetryDelay(7);
Assert.InRange(backoff7, TimeSpan.FromSeconds(128), TimeSpan.FromSeconds(129));
var backoff8 = options.RetryDelay(8);
Assert.InRange(backoff8, TimeSpan.FromSeconds(256), TimeSpan.FromSeconds(257));
var backoff9 = options.RetryDelay(9);
Assert.InRange(backoff9, TimeSpan.FromSeconds(512), TimeSpan.FromSeconds(513));
var backoff10 = options.RetryDelay(10);
Assert.InRange(backoff10, TimeSpan.FromSeconds(1024), TimeSpan.FromSeconds(1025));
}

[Fact]
public async Task CanGetQueueItemWithDeliveryDelayAndEnsureMessageNotMarkedWorkingWhileWaiting()
{
Expand Down
30 changes: 24 additions & 6 deletions tests/Foundatio.AWS.Tests/Storage/S3FileStorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public override Task CanGetFileListForSingleFolderAsync()
return base.CanGetFileListForSingleFolderAsync();
}

[Fact]
public override Task CanGetFileListForSingleFileAsync()
{
return base.CanGetFileListForSingleFileAsync();
}

[Fact]
public override Task CanGetPagedFileListForSingleFolderAsync()
{
Expand Down Expand Up @@ -93,6 +99,12 @@ public override Task CanDeleteEntireFolderWithWildcardAsync()
return base.CanDeleteEntireFolderWithWildcardAsync();
}

[Fact]
public override Task CanDeleteFolderWithMultiFolderWildcardsAsync()
{
return base.CanDeleteFolderWithMultiFolderWildcardsAsync();
}

[Fact]
public override Task CanDeleteSpecificFilesAsync()
{
Expand All @@ -111,12 +123,6 @@ public override Task CanDeleteSpecificFilesInNestedFolderAsync()
return base.CanDeleteSpecificFilesInNestedFolderAsync();
}

[Fact]
public override Task CanDeleteFolderWithMultiFolderWildcardsAsync()
{
return base.CanDeleteFolderWithMultiFolderWildcardsAsync();
}

[Fact]
public override Task CanRoundTripSeekableStreamAsync()
{
Expand All @@ -129,6 +135,18 @@ public override Task WillRespectStreamOffsetAsync()
return base.WillRespectStreamOffsetAsync();
}

[Fact(Skip = "Write Stream is not yet supported")]
public override Task WillWriteStreamContentAsync()
{
return base.WillWriteStreamContentAsync();
}

[Fact]
public override Task CanSaveOverExistingStoredContent()

Check failure on line 145 in tests/Foundatio.AWS.Tests/Storage/S3FileStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'S3FileStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override

Check failure on line 145 in tests/Foundatio.AWS.Tests/Storage/S3FileStorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'S3FileStorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override
{
return base.CanSaveOverExistingStoredContent();
}

[Fact]
public virtual async Task WillNotReturnDirectoryInGetPagedFileListAsync()
{
Expand Down
36 changes: 36 additions & 0 deletions tests/Foundatio.AWS.Tests/Storage/ScopedS3StorageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ public override Task CanGetFileListForSingleFolderAsync()
return base.CanGetFileListForSingleFolderAsync();
}

[Fact]
public override Task CanGetFileListForSingleFileAsync()
{
return base.CanGetFileListForSingleFileAsync();
}

[Fact]
public override Task CanGetPagedFileListForSingleFolderAsync()
{
Expand Down Expand Up @@ -75,6 +81,12 @@ public override Task CanConcurrentlyManageFilesAsync()
return base.CanConcurrentlyManageFilesAsync();
}

[Fact]
public override void CanUseDataDirectory()
{
base.CanUseDataDirectory();
}

[Fact]
public override Task CanDeleteEntireFolderAsync()
{
Expand Down Expand Up @@ -111,6 +123,30 @@ public override Task CanDeleteSpecificFilesInNestedFolderAsync()
return base.CanDeleteSpecificFilesInNestedFolderAsync();
}

[Fact]
public override Task CanRoundTripSeekableStreamAsync()
{
return base.CanRoundTripSeekableStreamAsync();
}

[Fact]
public override Task WillRespectStreamOffsetAsync()
{
return base.WillRespectStreamOffsetAsync();
}

[Fact(Skip = "Write Stream is not yet supported")]
public override Task WillWriteStreamContentAsync()
{
return base.WillWriteStreamContentAsync();
}

[Fact]
public override Task CanSaveOverExistingStoredContent()

Check failure on line 145 in tests/Foundatio.AWS.Tests/Storage/ScopedS3StorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'ScopedS3StorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override

Check failure on line 145 in tests/Foundatio.AWS.Tests/Storage/ScopedS3StorageTests.cs

View workflow job for this annotation

GitHub Actions / build / build

'ScopedS3StorageTests.CanSaveOverExistingStoredContent()': no suitable method found to override
{
return base.CanSaveOverExistingStoredContent();
}

[Fact]
public virtual async Task WillNotReturnDirectoryInGetPagedFileListAsync()
{
Expand Down

0 comments on commit 675c196

Please sign in to comment.