-
Notifications
You must be signed in to change notification settings - Fork 1
Open RavenDB.Client version range for broader compatibility #726
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
Merged
Merged
Changes from 9 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bcd0b70
Have a latest project with renovate configured
danielmarbach 07384d1
Try latest action
danielmarbach 90439ff
Deliberately use something lower for now
danielmarbach d12e78d
Correct format
danielmarbach 0a30a09
Try this
danielmarbach 1c73ce3
Move
danielmarbach f6ac4c9
Cluster wide latest
danielmarbach 486b836
Cap upper bound
danielmarbach 0218fa2
Indent
danielmarbach a80a17f
Stable action
danielmarbach d6c6781
Upgrade to latest for now
danielmarbach File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| packageRules: [ | ||
| { | ||
| description: "Keep non-Latest projects on RavenDB.Client v6.x", | ||
| matchFiles: ["**/*.csproj"], | ||
| excludeFiles: ["**/*.Latest.*.csproj"], | ||
| matchPackageNames: ["RavenDB.Client"], | ||
| allowedVersions: ">=6.0.0 <7.0.0" | ||
| }, | ||
| { | ||
| description: "Allow .Latest. projects to use RavenDB.Client v7.x and above", | ||
| matchFiles: ["**/*.Latest.*.csproj"], | ||
| matchPackageNames: ["RavenDB.Client"], | ||
| allowedVersions: ">=7.0.0" | ||
| } | ||
| ] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/NServiceBus.Gateway.RavenDB.ClusterWideTx.Latest.AcceptanceTests/.editorconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [*.cs] | ||
|
|
||
| # Justification: Test project | ||
| dotnet_diagnostic.CA2007.severity = none | ||
|
|
||
| # may be enabled in future | ||
| dotnet_diagnostic.PS0018.severity = suggestion # A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext | ||
|
|
||
| # Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken | ||
| dotnet_diagnostic.NSB0002.severity = suggestion |
112 changes: 112 additions & 0 deletions
112
...ceBus.Gateway.RavenDB.ClusterWideTx.Latest.AcceptanceTests/GatewayTestSuiteConstraints.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| namespace NServiceBus.Gateway.AcceptanceTests | ||
| { | ||
| using NServiceBus.AcceptanceTesting.Support; | ||
| using NServiceBus.Configuration.AdvancedExtensibility; | ||
| using Raven.Client.Documents; | ||
| using Raven.Client.ServerWide; | ||
| using Raven.Client.ServerWide.Operations; | ||
| using System; | ||
| using System.Threading.Tasks; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
|
|
||
| public partial class GatewayTestSuiteConstraints | ||
| { | ||
| public Task<GatewayDeduplicationConfiguration> ConfigureDeduplicationStorage(string endpointName, EndpointConfiguration configuration, RunSettings settings) | ||
| { | ||
| var ravenGatewayDeduplicationConfiguration = new RavenGatewayDeduplicationConfiguration((builder, _) => | ||
| { | ||
| var databaseName = Guid.NewGuid().ToString(); | ||
| var documentStore = GetInitializedDocumentStore(databaseName); | ||
|
|
||
| documentStore.Maintenance.Server.Send(new CreateDatabaseOperation(new DatabaseRecord(databaseName))); | ||
|
|
||
| try | ||
| { | ||
| semaphoreSlim.Wait(); | ||
| databases.Add(databaseName); | ||
| } | ||
| finally | ||
| { | ||
| semaphoreSlim.Release(); | ||
| } | ||
|
|
||
| return documentStore; | ||
| }) | ||
| { | ||
| EnableClusterWideTransactions = true | ||
| }; | ||
|
|
||
| var gatewaySettings = configuration.Gateway(ravenGatewayDeduplicationConfiguration); | ||
| configuration.GetSettings().Set(gatewaySettings); | ||
|
|
||
| return Task.FromResult<GatewayDeduplicationConfiguration>(ravenGatewayDeduplicationConfiguration); | ||
| } | ||
|
|
||
| public async Task Cleanup() | ||
| { | ||
| await semaphoreSlim.WaitAsync(); | ||
| try | ||
| { | ||
| foreach (var databaseName in databases) | ||
| { | ||
| // Periodically the delete will throw an exception because Raven has the database locked | ||
| // To solve this we have a retry loop with a delay | ||
| var triesLeft = 3; | ||
|
|
||
| while (triesLeft-- > 0) | ||
| { | ||
| try | ||
| { | ||
| // We are using a new store because the global one is disposed of before cleanup | ||
| using (var storeForDeletion = GetInitializedDocumentStore(databaseName)) | ||
| { | ||
| storeForDeletion.Maintenance.Server.Send(new DeleteDatabasesOperation(storeForDeletion.Database, hardDelete: true)); | ||
| break; | ||
| } | ||
| } | ||
| catch | ||
| { | ||
| if (triesLeft == 0) | ||
| { | ||
| throw; | ||
| } | ||
|
|
||
| await Task.Delay(250); | ||
| } | ||
| } | ||
|
|
||
| Console.WriteLine("Deleted '{0}' database", databaseName); | ||
| } | ||
|
|
||
| databases.Clear(); | ||
| } | ||
| finally | ||
| { | ||
| semaphoreSlim.Release(); | ||
| } | ||
| } | ||
|
|
||
| static DocumentStore GetInitializedDocumentStore(string defaultDatabase) | ||
| { | ||
| var urls = Environment.GetEnvironmentVariable("CommaSeparatedRavenClusterUrls"); | ||
| if (urls == null) | ||
| { | ||
| throw new Exception("RavenDB cluster URLs must be specified in an environment variable named CommaSeparatedRavenClusterUrls."); | ||
| } | ||
|
|
||
| var documentStore = new DocumentStore | ||
| { | ||
| Urls = urls.Split(','), | ||
| Database = defaultDatabase | ||
| }; | ||
|
|
||
| documentStore.Initialize(); | ||
|
|
||
| return documentStore; | ||
| } | ||
|
|
||
| static SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1, 1); | ||
| List<string> databases = []; | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
...t.AcceptanceTests/NServiceBus.Gateway.RavenDB.ClusterWideTx.Latest.AcceptanceTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\NServiceBus.Gateway.RavenDB\NServiceBus.Gateway.RavenDB.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" /> | ||
| <PackageReference Include="NUnit" Version="4.4.0" /> | ||
| <PackageReference Include="NUnit.Analyzers" Version="4.10.0" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="5.1.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <!-- We are pulling in latest here to ensure we are testing against the latest RavenDB.Client --> | ||
| <PackageReference Include="RavenDB.Client" Version="7.0.2" /> | ||
danielmarbach marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="NServiceBus.AcceptanceTesting" Version="10.0.0-alpha.4" /> | ||
| <PackageReference Include="NServiceBus.Gateway.AcceptanceTests.Sources" Version="6.0.0-alpha.2" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
10 changes: 10 additions & 0 deletions
10
src/NServiceBus.Gateway.RavenDB.Latest.AcceptanceTests/.editorconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| [*.cs] | ||
|
|
||
| # Justification: Test project | ||
| dotnet_diagnostic.CA2007.severity = none | ||
|
|
||
| # may be enabled in future | ||
| dotnet_diagnostic.PS0018.severity = suggestion # A task-returning method should have a CancellationToken parameter unless it has a parameter implementing ICancellableContext | ||
|
|
||
| # Justification: Tests don't support cancellation and don't need to forward IMessageHandlerContext.CancellationToken | ||
| dotnet_diagnostic.NSB0002.severity = suggestion |
116 changes: 116 additions & 0 deletions
116
src/NServiceBus.Gateway.RavenDB.Latest.AcceptanceTests/GatewayTestSuiteConstraints.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| namespace NServiceBus.Gateway.AcceptanceTests | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using NServiceBus.AcceptanceTesting.Support; | ||
| using NServiceBus.Configuration.AdvancedExtensibility; | ||
| using Raven.Client.Documents; | ||
| using Raven.Client.ServerWide; | ||
| using Raven.Client.ServerWide.Operations; | ||
|
|
||
| public partial class GatewayTestSuiteConstraints | ||
| { | ||
| public Task<GatewayDeduplicationConfiguration> ConfigureDeduplicationStorage(string endpointName, EndpointConfiguration configuration, RunSettings settings) | ||
| { | ||
| var ravenGatewayDeduplicationConfiguration = new RavenGatewayDeduplicationConfiguration((builder, _) => | ||
| { | ||
| var databaseName = Guid.NewGuid().ToString(); | ||
| var documentStore = GetInitializedDocumentStore(databaseName); | ||
|
|
||
| for (var i = 0; i < 3; i++) | ||
| { | ||
| try | ||
| { | ||
| documentStore.Maintenance.Server.Send(new CreateDatabaseOperation(new DatabaseRecord(databaseName))); | ||
| break; | ||
| } | ||
| catch (AggregateException) | ||
| { | ||
| // Usually, Failed to retrieve cluster topology from all known nodes | ||
| } | ||
| } | ||
|
|
||
| try | ||
| { | ||
| semaphoreSlim.Wait(); | ||
| databases.Add(databaseName); | ||
| } | ||
| finally | ||
| { | ||
| semaphoreSlim.Release(); | ||
| } | ||
|
|
||
| return documentStore; | ||
| }); | ||
|
|
||
| var gatewaySettings = configuration.Gateway(ravenGatewayDeduplicationConfiguration); | ||
| configuration.GetSettings().Set(gatewaySettings); | ||
|
|
||
| return Task.FromResult<GatewayDeduplicationConfiguration>(ravenGatewayDeduplicationConfiguration); | ||
| } | ||
|
|
||
| public async Task Cleanup() | ||
| { | ||
| await semaphoreSlim.WaitAsync(); | ||
| try | ||
| { | ||
| foreach (var databaseName in databases) | ||
| { | ||
| // Periodically the delete will throw an exception because Raven has the database locked | ||
| // To solve this we have a retry loop with a delay | ||
| var triesLeft = 3; | ||
|
|
||
| while (triesLeft-- > 0) | ||
| { | ||
| try | ||
| { | ||
| // We are using a new store because the global one is disposed of before cleanup | ||
| using (var storeForDeletion = GetInitializedDocumentStore(databaseName)) | ||
| { | ||
| storeForDeletion.Maintenance.Server.Send(new DeleteDatabasesOperation(storeForDeletion.Database, hardDelete: true)); | ||
| break; | ||
| } | ||
| } | ||
| catch | ||
| { | ||
| if (triesLeft == 0) | ||
| { | ||
| throw; | ||
| } | ||
|
|
||
| await Task.Delay(250); | ||
| } | ||
| } | ||
|
|
||
| Console.WriteLine("Deleted '{0}' database", databaseName); | ||
| } | ||
|
|
||
| databases.Clear(); | ||
| } | ||
| finally | ||
| { | ||
| semaphoreSlim.Release(); | ||
| } | ||
| } | ||
|
|
||
| static DocumentStore GetInitializedDocumentStore(string defaultDatabase) | ||
| { | ||
| var url = Environment.GetEnvironmentVariable("RavenSingleNodeUrl") ?? throw new Exception("RavenDB URL must be specified in an environment variable named RavenSingleNodeUrl."); | ||
|
|
||
| var documentStore = new DocumentStore | ||
| { | ||
| Urls = new[] { url }, | ||
| Database = defaultDatabase | ||
| }; | ||
|
|
||
| documentStore.Initialize(); | ||
|
|
||
| return documentStore; | ||
| } | ||
|
|
||
| static SemaphoreSlim semaphoreSlim = new SemaphoreSlim(1, 1); | ||
| List<string> databases = []; | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
....RavenDB.Latest.AcceptanceTests/NServiceBus.Gateway.RavenDB.Latest.AcceptanceTests.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFramework>net10.0</TargetFramework> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\NServiceBus.Gateway.RavenDB\NServiceBus.Gateway.RavenDB.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" /> | ||
| <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" /> | ||
| <PackageReference Include="NUnit" Version="4.4.0" /> | ||
| <PackageReference Include="NUnit.Analyzers" Version="4.10.0" /> | ||
| <PackageReference Include="NUnit3TestAdapter" Version="5.1.0" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <!-- We are pulling in latest here to ensure we are testing against the latest RavenDB.Client --> | ||
| <PackageReference Include="RavenDB.Client" Version="7.0.2" /> | ||
danielmarbach marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="NServiceBus.AcceptanceTesting" Version="10.0.0-alpha.4" /> | ||
| <PackageReference Include="NServiceBus.Gateway.AcceptanceTests.Sources" Version="6.0.0-alpha.2" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.