Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare repo for .NET 8 #292

Merged
merged 31 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e001a26
Bump major version
kentdr Aug 21, 2023
10714df
Update TFMs for net8.0 and remove if defs
kentdr Aug 21, 2023
3f4858d
Update workflows
kentdr Aug 21, 2023
fa9114a
Update Test SDK and GitHubActionsLogger
kentdr Aug 25, 2023
dd2276b
Bump NServiceBus.AmazonSQS
kentdr Aug 25, 2023
0d175b4
Adjust FodyWeavers.xml
kentdr Aug 25, 2023
eefdffc
Update TFM on Analyzer project
kentdr Sep 25, 2023
7d8976d
Fix collection intialization error
kentdr Sep 25, 2023
428c209
Tweaks
andreasohlund Feb 29, 2024
f8c242c
Update refs
andreasohlund Feb 29, 2024
e65019e
Fixes after rebase
andreasohlund Feb 29, 2024
3f549a9
Set serializer
andreasohlund Feb 29, 2024
c6b35fa
Use xml serializer
andreasohlund Feb 29, 2024
10bd513
Approve api
andreasohlund Feb 29, 2024
01a2e73
Set serializer
andreasohlund Feb 29, 2024
8e1419b
Use xml where needed
andreasohlund Feb 29, 2024
2305c13
Tweaks
andreasohlund Mar 1, 2024
db3832e
Remove uneeded calls to set error queue
andreasohlund Mar 4, 2024
105970e
Do not disable delayed delivery since currently the FIFO queue is any…
danielmarbach Feb 22, 2024
db83beb
Adjust tests to handle that delayed retried now are enabled by default
andreasohlund Mar 4, 2024
b464573
Fix test
andreasohlund Mar 4, 2024
c2a75f9
Update refs
andreasohlund Mar 4, 2024
64001e7
Remove weavers file
andreasohlund Mar 4, 2024
9ba1a3e
Revert "Remove weavers file"
bording Mar 4, 2024
e77826a
Tweaks
bording Mar 4, 2024
c9df1a4
Address TODO
bording Mar 4, 2024
a828331
Don't set analyzer version
bording Mar 5, 2024
2a77f1e
Remove need for Fody entirely
bording Mar 5, 2024
c718da2
Fix analyzer project build ordering
bording Mar 5, 2024
efa959e
Adjust test
bording Mar 5, 2024
8933c0c
Move code to avoid throw from nested catch
bording Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ env:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
NSERVICEBUS_AMAZONSQS_S3BUCKET: ${{ secrets.NSERVICEBUS_AMAZONSQS_S3BUCKET }}
jobs:
build:
build:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-2019
- os: windows-2022
name: Windows
- os: ubuntu-20.04
- os: ubuntu-22.04
name: Linux
fail-fast: false
steps:
Expand All @@ -33,13 +33,11 @@ jobs:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: |
7.0.x
6.0.x
dotnet-version: 8.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Upload packages
Expand All @@ -51,4 +49,3 @@ jobs:
retention-days: 7
- name: Run tests
uses: Particular/[email protected]

8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ env:
DOTNET_NOLOGO: true
jobs:
release:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/[email protected]
with:
fetch-depth: 0
fetch-depth: 0
- name: Setup .NET SDK
uses: actions/[email protected]
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Build
run: dotnet build src --configuration Release
- name: Sign NuGet packages
Expand All @@ -36,4 +36,4 @@ jobs:
- name: Deploy
uses: Particular/[email protected]
with:
octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }}
octopus-deploy-api-key: ${{ secrets.OCTOPUS_DEPLOY_API_KEY }}
3 changes: 1 addition & 2 deletions src/Custom.Build.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project>

<PropertyGroup>
<ParticularAnalyzersVersion>0.9.0</ParticularAnalyzersVersion>
<AnalyzerTargetFramework>netstandard2.0</AnalyzerTargetFramework>
</PropertyGroup>

<PropertyGroup>
<MinVerMinimumMajorMinor>1.0</MinVerMinimumMajorMinor>
<MinVerMinimumMajorMinor>2.0</MinVerMinimumMajorMinor>
<MinVerAutoIncrement>minor</MinVerAutoIncrement>
</PropertyGroup>

Expand Down
56 changes: 0 additions & 56 deletions src/GuardTemplates.DotSettings

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# Justification: Test project
dotnet_diagnostic.CA2007.severity = none
dotnet_diagnostic.PS0018.severity = none

# Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken
dotnet_diagnostic.NSB0002.severity = suggestion
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Amazon.SQS;
using Amazon.SQS.Model;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.VisualStudio.TestPlatform.ObjectModel;
using NUnit.Framework;

[TestFixture]
Expand All @@ -40,7 +39,7 @@ class AwsLambdaSQSEndpointTestBase
[SetUp]
public async Task Setup()
{
queueNames = new List<string>();
queueNames = [];

Prefix = Path.GetFileNameWithoutExtension(Path.GetRandomFileName()).ToLowerInvariant();

Expand Down Expand Up @@ -103,22 +102,35 @@ await s3Client.DeleteObjectsAsync(new DeleteObjectsRequest
}
}

protected AwsLambdaSQSEndpointConfiguration DefaultLambdaEndpointConfiguration<TTestContext>(TTestContext testContext)
protected AwsLambdaSQSEndpointConfiguration DefaultLambdaEndpointConfiguration<TTestContext>(TTestContext testContext, bool useXmlSerializer = false)
{
var configuration = DefaultLambdaEndpointConfiguration();
var configuration = DefaultLambdaEndpointConfiguration(useXmlSerializer);
configuration.AdvancedConfiguration.RegisterComponents(c => c.AddSingleton(typeof(TTestContext), testContext));
return configuration;
}

protected AwsLambdaSQSEndpointConfiguration DefaultLambdaEndpointConfiguration()
protected AwsLambdaSQSEndpointConfiguration DefaultLambdaEndpointConfiguration(bool useXmlSerializer = false)
{
var configuration = new AwsLambdaSQSEndpointConfiguration(QueueName, CreateSQSClient(), CreateSNSClient());
configuration.Transport.QueueNamePrefix = Prefix;
configuration.Transport.TopicNamePrefix = Prefix;
configuration.Transport.S3 = new S3Settings(BucketName, Prefix, CreateS3Client());

var advanced = configuration.AdvancedConfiguration;
advanced.SendFailedMessagesTo(ErrorQueueAddress);

if (useXmlSerializer)
{
advanced.UseSerialization<XmlSerializer>();
}
else
{
advanced.UseSerialization<SystemJsonSerializer>();
}

var recoverability = advanced.Recoverability();

recoverability.Immediate(i => i.NumberOfRetries(0));
recoverability.Delayed(d => d.NumberOfRetries(0));

return configuration;
}
Expand All @@ -138,6 +150,7 @@ protected void RegisterQueueNameToCleanup(string queueName)
S3 = new S3Settings(BucketName, Prefix, CreateS3Client())
};

endpointConfiguration.UseSerialization<SystemJsonSerializer>();
endpointConfiguration.UseTransport(transport);

var endpointInstance = await Endpoint.Start(endpointConfiguration)
Expand All @@ -156,8 +169,8 @@ protected void RegisterQueueNameToCleanup(string queueName)
{
MaxNumberOfMessages = count,
WaitTimeSeconds = 20,
AttributeNames = new List<string> { "SentTimestamp" },
MessageAttributeNames = new List<string> { "*" }
AttributeNames = ["SentTimestamp"],
MessageAttributeNames = ["*"]
};

var receivedMessages = await sqsClient.ReceiveMessageAsync(receiveRequest);
Expand All @@ -183,8 +196,8 @@ await sqsClient.SendMessageAsync(sendMessageRequest)
{
MaxNumberOfMessages = 10,
WaitTimeSeconds = 20,
AttributeNames = new List<string> { "SentTimestamp" },
MessageAttributeNames = new List<string> { "*" }
AttributeNames = ["SentTimestamp"],
MessageAttributeNames = ["*"]
};

var receivedMessages = await sqsClient.ReceiveMessageAsync(receiveRequest);
Expand Down Expand Up @@ -214,8 +227,8 @@ protected async Task<SQSEvent> RetrieveMessagesInErrorQueue(int maxMessageCount
{
MaxNumberOfMessages = maxMessageCount,
WaitTimeSeconds = 20,
AttributeNames = new List<string> { "SentTimestamp" },
MessageAttributeNames = new List<string> { "*" }
AttributeNames = ["SentTimestamp"],
MessageAttributeNames = ["*"]
};

var receivedMessages = await sqsClient.ReceiveMessageAsync(receiveRequest);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<RootNamespace>NServiceBus.AcceptanceTests</RootNamespace>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\NServiceBus.AwsLambda.SQS\NServiceBus.AwsLambda.SQS.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="2.2.0" />
<PackageReference Include="Amazon.Lambda.SQSEvents" Version="2.2.0" />
<PackageReference Include="NServiceBus" Version="9.0.0" />
<PackageReference Include="NServiceBus.AmazonSQS" Version="7.0.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Include="NUnit" Version="3.14.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.5.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\NServiceBus.AwsLambda.SQS\NServiceBus.AwsLambda.SQS.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task Should_be_processed_when_messagetypefullname_present()

var context = new TestContext();

var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context));
var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context, useXmlSerializer: true));

await endpoint.Process(receivedMessages, null);

Expand All @@ -48,7 +48,7 @@ public async Task Should_fail_when_messagetypefullname_not_present()

var context = new TestContext();

var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context));
var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context, useXmlSerializer: true));

await endpoint.Process(receivedMessages, null);

Expand All @@ -74,7 +74,7 @@ public async Task Should_preserve_poison_message_attributes_in_error_queue()

var context = new TestContext();

var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context));
var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context, useXmlSerializer: true));

await endpoint.Process(receivedMessages, null);
var poisonMessages = await RetrieveMessagesInErrorQueue();
Expand Down Expand Up @@ -103,12 +103,7 @@ public async Task Should_preserve_message_attributes_in_error_queue()

}, FailingMessageToSend);

var endpoint = new AwsLambdaSQSEndpoint(ctx =>
{
var configuration = DefaultLambdaEndpointConfiguration();
configuration.AdvancedConfiguration.Recoverability().Immediate(s => s.NumberOfRetries(0));
return configuration;
});
var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(useXmlSerializer: true));

await endpoint.Process(receivedMessages, null);
var poisonMessages = await RetrieveMessagesInErrorQueue();
Expand Down Expand Up @@ -139,7 +134,7 @@ public async Task Should_support_loading_body_from_s3()

var context = new TestContext();

var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context));
var endpoint = new AwsLambdaSQSEndpoint(_ => DefaultLambdaEndpointConfiguration(context, useXmlSerializer: true));

await endpoint.Process(receivedMessages, null);

Expand Down
Loading