From 17bcbf4a6cd36e60d44bd10a7dbde4be1f14b94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Silveira?= Date: Tue, 7 Nov 2023 16:56:34 +0100 Subject: [PATCH] * disabled parallel tests. at this point CI hates them. * code format on samples project files. --- samples/Directory.Build.props | 2 +- samples/Samples.sln.DotSettings | 405 ++++++++++++++++++ .../appending-events/appending-events.csproj | 10 +- .../connecting-to-a-cluster.csproj | 22 +- .../connecting-to-a-single-node.csproj | 20 +- .../persistent-subscriptions.csproj | 8 +- .../projection-management.csproj | 16 +- samples/quick-start/quick-start.csproj | 20 +- samples/reading-events/reading-events.csproj | 10 +- .../secure-with-tls/secure-with-tls.csproj | 9 +- .../server-side-filtering.csproj | 10 +- .../setting-up-dependency-injection.csproj | 22 +- .../subscribing-to-streams.csproj | 12 +- src/Directory.Build.props | 112 ++--- test/Directory.Build.props | 30 +- .../AssemblyInfo.cs | 2 +- .../EventStore.Client.Operations.Tests.csproj | 6 +- ...lient.PersistentSubscriptions.Tests.csproj | 4 +- ...e.Client.ProjectionManagement.Tests.csproj | 4 +- .../EventStore.Client.Streams.Tests.csproj | 4 +- .../EventStore.Client.Tests.Common.csproj | 48 +-- .../Fixtures/EventStoreTestNode.cs | 52 ++- .../EventStore.Client.Tests.csproj | 14 +- .../AssemblyInfo.cs | 2 +- ...ntStore.Client.UserManagement.Tests.csproj | 6 +- 25 files changed, 624 insertions(+), 226 deletions(-) create mode 100644 samples/Samples.sln.DotSettings diff --git a/samples/Directory.Build.props b/samples/Directory.Build.props index de3078b18..727fb83c4 100644 --- a/samples/Directory.Build.props +++ b/samples/Directory.Build.props @@ -6,4 +6,4 @@ true Exe - + \ No newline at end of file diff --git a/samples/Samples.sln.DotSettings b/samples/Samples.sln.DotSettings new file mode 100644 index 000000000..16d970453 --- /dev/null +++ b/samples/Samples.sln.DotSettings @@ -0,0 +1,405 @@ + + 1000 + 3000 + 5000 + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + DO_NOT_SHOW + + True + + True + <?xml version="1.0" encoding="utf-16"?><Profile name="EventStore"><XMLReformatCode>True</XMLReformatCode><HtmlReformatCode>True</HtmlReformatCode><CSReformatCode>True</CSReformatCode><CSCodeStyleAttributes ArrangeVarStyle="True" ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" ArrangeArgumentsStyle="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeCodeBodyStyle="True" ArrangeTrailingCommas="True" ArrangeObjectCreation="True" ArrangeDefaultValue="True" ArrangeNamespaces="True" /><CSArrangeQualifiers>True</CSArrangeQualifiers><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CppCodeStyleCleanupDescriptor /><FormatAttributeQuoteDescriptor>True</FormatAttributeQuoteDescriptor><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings></CSOptimizeUsings><CSReorderTypeMembers>True</CSReorderTypeMembers><IDEA_SETTINGS>&lt;profile version="1.0"&gt; + &lt;option name="myName" value="EventStore" /&gt; + &lt;inspection_tool class="ES6ShorthandObjectProperty" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSArrowFunctionBracesCanBeRemoved" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSPrimitiveTypeWrapperUsage" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSRemoveUnnecessaryParentheses" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="JSUnnecessarySemicolon" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="TypeScriptExplicitMemberType" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryContinueJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelOnBreakStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryLabelOnContinueStatementJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; + &lt;inspection_tool class="UnnecessaryReturnJS" enabled="false" level="WARNING" enabled_by_default="false" /&gt; +&lt;/profile&gt;</IDEA_SETTINGS><RIDER_SETTINGS>&lt;profile&gt; + &lt;Language id="CSS"&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="EditorConfig"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="HTML"&gt; + &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="HTTP Request"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="Handlebars"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="Ini"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="JSON"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="Jade"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="JavaScript"&gt; + &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="Markdown"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="Properties"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="RELAX-NG"&gt; + &lt;Reformat&gt;false&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="SQL"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="VueExpr"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="XML"&gt; + &lt;OptimizeImports&gt;false&lt;/OptimizeImports&gt; + &lt;Rearrange&gt;true&lt;/Rearrange&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; + &lt;Language id="yaml"&gt; + &lt;Reformat&gt;true&lt;/Reformat&gt; + &lt;/Language&gt; +&lt;/profile&gt;</RIDER_SETTINGS></Profile> + + True + + EventStore + ExpressionBody + Implicit + Implicit + ExpressionBody + ExpressionBody + BaseClass + 0 + 1 + 0 + Tab + False + True + False + False + True + END_OF_LINE + END_OF_LINE + True + False + True + True + True + False + True + True + END_OF_LINE + 1 + 1 + END_OF_LINE + TOGETHER + END_OF_LINE + True + True + True + True + True + False + True + True + True + True + True + END_OF_LINE + 1 + 1 + False + 6 + 10 + 6 + 6 + 10 + EXPANDED + END_OF_LINE + True + True + True + IF_OWNER_IS_SINGLE_LINE + IF_OWNER_IS_SINGLE_LINE + True + END_OF_LINE + True + True + CHOP_IF_LONG + CHOP_IF_LONG + True + True + True + False + CHOP_IF_LONG + WRAP_IF_LONG + CHOP_IF_LONG + <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern DisplayName="Non-reorderable types"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + <HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" /> + <HasAttribute Name="JetBrains.Annotations.NoReorder" /> + </Or> + </TypePattern.Match> + </TypePattern> + + <TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="True" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="True" /> + </And> + </HasMember> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <Or> + <Kind Is="Constructor" /> + <And> + <Kind Is="Method" /> + <ImplementsInterface Name="System.IDisposable" /> + </And> + </Or> + </Entry.Match> + + <Entry.SortBy> + <Kind> + <Kind.Order> + <DeclarationKind>Constructor</DeclarationKind> + </Kind.Order> + </Kind> + </Entry.SortBy> + </Entry> + + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="false" /> + <HasAttribute Name="Xunit.TheoryAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <Or> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSourceAttribute" Inherited="true" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </HasMember> + </Or> + </And> + </TypePattern.Match> + + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.TestFixtureTearDownAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeSetUpAttribute" Inherited="true" /> + <HasAttribute Name="NUnit.Framework.OneTimeTearDownAttribute" Inherited="true" /> + </Or> + </And> + </Entry.Match> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseAttribute" Inherited="false" /> + <HasAttribute Name="NUnit.Framework.TestCaseSourceAttribute" Inherited="false" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + + <TypePattern DisplayName="Default Pattern"> + <Entry DisplayName="Public Delegates" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Constants" Priority="90"> + <Entry.Match> + <Kind Is="Constant" /> + </Entry.Match> + </Entry> + + <Entry DisplayName="Static Fields" Priority="85"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Entry.Match> + + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Fields"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + + <Entry.SortBy> + <Static/> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="Properties, Indexers"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + + <Entry DisplayName="Interface Implementations" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Member" /> + <ImplementsInterface /> + </And> + </Entry.Match> + + <Entry.SortBy> + <ImplementsInterface Immediate="true" /> + </Entry.SortBy> + </Entry> + + <Entry DisplayName="All other members" /> + + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + </TypePattern> +</Patterns> + + True + False + + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True + True \ No newline at end of file diff --git a/samples/appending-events/appending-events.csproj b/samples/appending-events/appending-events.csproj index 6568339cc..34b8399e9 100644 --- a/samples/appending-events/appending-events.csproj +++ b/samples/appending-events/appending-events.csproj @@ -1,15 +1,13 @@ - Exe appending_events - - - - + + + + - diff --git a/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj b/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj index 2906126b9..1d8ff5b7d 100644 --- a/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj +++ b/samples/connecting-to-a-cluster/connecting-to-a-cluster.csproj @@ -1,15 +1,13 @@ + + Exe + connecting_to_a_cluster + - - Exe - connecting_to_a_cluster - - - - - - - - - + + + + + + diff --git a/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj b/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj index 0d884a279..337b66b85 100644 --- a/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj +++ b/samples/connecting-to-a-single-node/connecting-to-a-single-node.csproj @@ -1,14 +1,12 @@ + + Exe + - - Exe - - - - - - - - - + + + + + + diff --git a/samples/persistent-subscriptions/persistent-subscriptions.csproj b/samples/persistent-subscriptions/persistent-subscriptions.csproj index 8fbad84e3..e845bda8e 100644 --- a/samples/persistent-subscriptions/persistent-subscriptions.csproj +++ b/samples/persistent-subscriptions/persistent-subscriptions.csproj @@ -1,14 +1,12 @@ - Exe persistent_subscriptions - - - + + + - diff --git a/samples/projection-management/projection-management.csproj b/samples/projection-management/projection-management.csproj index a9528b37c..3b5b2c3c7 100644 --- a/samples/projection-management/projection-management.csproj +++ b/samples/projection-management/projection-management.csproj @@ -1,12 +1,10 @@ + + projection_management + - - projection_management - - - - - - - + + + + diff --git a/samples/quick-start/quick-start.csproj b/samples/quick-start/quick-start.csproj index 42ec5bf0b..9921046d6 100644 --- a/samples/quick-start/quick-start.csproj +++ b/samples/quick-start/quick-start.csproj @@ -1,14 +1,12 @@ + + quick_start + - - quick_start - - - - - - - - - + + + + + + diff --git a/samples/reading-events/reading-events.csproj b/samples/reading-events/reading-events.csproj index 5113edb01..0ae95a9a5 100644 --- a/samples/reading-events/reading-events.csproj +++ b/samples/reading-events/reading-events.csproj @@ -1,13 +1,11 @@ - reading_events - - - + + + - - + \ No newline at end of file diff --git a/samples/secure-with-tls/secure-with-tls.csproj b/samples/secure-with-tls/secure-with-tls.csproj index c8ed090c8..149de2f9b 100644 --- a/samples/secure-with-tls/secure-with-tls.csproj +++ b/samples/secure-with-tls/secure-with-tls.csproj @@ -1,12 +1,11 @@ - secure_with_tls - - - + + + - + \ No newline at end of file diff --git a/samples/server-side-filtering/server-side-filtering.csproj b/samples/server-side-filtering/server-side-filtering.csproj index 8b97ad502..34b2d4c39 100644 --- a/samples/server-side-filtering/server-side-filtering.csproj +++ b/samples/server-side-filtering/server-side-filtering.csproj @@ -5,10 +5,10 @@ - - - - + + + + - + \ No newline at end of file diff --git a/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj b/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj index 9c5f54c2a..7f3b511bd 100644 --- a/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj +++ b/samples/setting-up-dependency-injection/setting-up-dependency-injection.csproj @@ -1,14 +1,12 @@ + + setting_up_dependency_injection + - - setting_up_dependency_injection - - - - - - - - - - + + + + + + + \ No newline at end of file diff --git a/samples/subscribing-to-streams/subscribing-to-streams.csproj b/samples/subscribing-to-streams/subscribing-to-streams.csproj index b2de653f2..d67c0a569 100644 --- a/samples/subscribing-to-streams/subscribing-to-streams.csproj +++ b/samples/subscribing-to-streams/subscribing-to-streams.csproj @@ -1,14 +1,12 @@ - subscribing_to_streams - - - - + + + + - - + \ No newline at end of file diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 2a404554d..1921131a9 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -1,64 +1,64 @@ - + EventStore.Client - Debug - full - pdbonly - - $(MSBuildProjectName.Remove(0,18)) - $(ESPackageIdSuffix.ToLower()).proto - ../EventStore.Client.Common/protos/$(ESProto) - EventStore.Client.Grpc.$(ESPackageIdSuffix) - - - - - - - ouro.png - LICENSE.md - https://eventstore.com - false - https://eventstore.com/blog/ - eventstore client grpc - Event Store Ltd - Copyright 2012-2020 Event Store Ltd - v - true - - - - - - - - all - runtime; build; native; contentfiles; analyzers; buildtransitive - - - all - runtime; build; native; contentfiles; analyzers - - - - - - - - - <_Parameter1>$(ProjectName).Tests - - - <_Parameter1>$(ProjectName).Tests.Common - + + + $(MSBuildProjectName.Remove(0,18)) + $(ESPackageIdSuffix.ToLower()).proto + ../EventStore.Client.Common/protos/$(ESProto) + EventStore.Client.Grpc.$(ESPackageIdSuffix) + + + + + + + + + ouro.png + LICENSE.md + https://eventstore.com + false + https://eventstore.com/blog/ + eventstore client grpc + Event Store Ltd + Copyright 2012-2020 Event Store Ltd + v + true + + + + + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + all + runtime; build; native; contentfiles; analyzers + + + + + + + + + + + <_Parameter1>$(ProjectName).Tests + + + <_Parameter1>$(ProjectName).Tests.Common + <_Parameter1>EventStore.Client - + diff --git a/test/Directory.Build.props b/test/Directory.Build.props index ac518287d..fb53b78d9 100644 --- a/test/Directory.Build.props +++ b/test/Directory.Build.props @@ -1,31 +1,31 @@ - - + + true xUnit1031 - - - + + + - - - + + + all runtime; build; native; contentfiles; analyzers - + - - - - - - + + + + + + diff --git a/test/EventStore.Client.Operations.Tests/AssemblyInfo.cs b/test/EventStore.Client.Operations.Tests/AssemblyInfo.cs index 87948ff98..b0b47aa73 100644 --- a/test/EventStore.Client.Operations.Tests/AssemblyInfo.cs +++ b/test/EventStore.Client.Operations.Tests/AssemblyInfo.cs @@ -1 +1 @@ -[assembly: CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file +[assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/test/EventStore.Client.Operations.Tests/EventStore.Client.Operations.Tests.csproj b/test/EventStore.Client.Operations.Tests/EventStore.Client.Operations.Tests.csproj index 62cdb17ed..1febb6cfb 100644 --- a/test/EventStore.Client.Operations.Tests/EventStore.Client.Operations.Tests.csproj +++ b/test/EventStore.Client.Operations.Tests/EventStore.Client.Operations.Tests.csproj @@ -1,6 +1,6 @@ - - - + + + diff --git a/test/EventStore.Client.PersistentSubscriptions.Tests/EventStore.Client.PersistentSubscriptions.Tests.csproj b/test/EventStore.Client.PersistentSubscriptions.Tests/EventStore.Client.PersistentSubscriptions.Tests.csproj index f663773e4..cd15c30d9 100644 --- a/test/EventStore.Client.PersistentSubscriptions.Tests/EventStore.Client.PersistentSubscriptions.Tests.csproj +++ b/test/EventStore.Client.PersistentSubscriptions.Tests/EventStore.Client.PersistentSubscriptions.Tests.csproj @@ -1,9 +1,9 @@  - + - + diff --git a/test/EventStore.Client.ProjectionManagement.Tests/EventStore.Client.ProjectionManagement.Tests.csproj b/test/EventStore.Client.ProjectionManagement.Tests/EventStore.Client.ProjectionManagement.Tests.csproj index ee7d48512..dac52c701 100644 --- a/test/EventStore.Client.ProjectionManagement.Tests/EventStore.Client.ProjectionManagement.Tests.csproj +++ b/test/EventStore.Client.ProjectionManagement.Tests/EventStore.Client.ProjectionManagement.Tests.csproj @@ -1,6 +1,6 @@  - + - + \ No newline at end of file diff --git a/test/EventStore.Client.Streams.Tests/EventStore.Client.Streams.Tests.csproj b/test/EventStore.Client.Streams.Tests/EventStore.Client.Streams.Tests.csproj index ee7d48512..dac52c701 100644 --- a/test/EventStore.Client.Streams.Tests/EventStore.Client.Streams.Tests.csproj +++ b/test/EventStore.Client.Streams.Tests/EventStore.Client.Streams.Tests.csproj @@ -1,6 +1,6 @@  - + - + \ No newline at end of file diff --git a/test/EventStore.Client.Tests.Common/EventStore.Client.Tests.Common.csproj b/test/EventStore.Client.Tests.Common/EventStore.Client.Tests.Common.csproj index 024ae2ad3..b12e5e7db 100644 --- a/test/EventStore.Client.Tests.Common/EventStore.Client.Tests.Common.csproj +++ b/test/EventStore.Client.Tests.Common/EventStore.Client.Tests.Common.csproj @@ -2,30 +2,30 @@ EventStore.Client.Tests - + - - - - - - + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + @@ -47,17 +47,17 @@ Always - PreserveNewest + PreserveNewest - Always + Always - Always + Always - + diff --git a/test/EventStore.Client.Tests.Common/Fixtures/EventStoreTestNode.cs b/test/EventStore.Client.Tests.Common/Fixtures/EventStoreTestNode.cs index 7beb44bf9..c4f6429ad 100644 --- a/test/EventStore.Client.Tests.Common/Fixtures/EventStoreTestNode.cs +++ b/test/EventStore.Client.Tests.Common/Fixtures/EventStoreTestNode.cs @@ -13,17 +13,18 @@ namespace EventStore.Client.Tests; public class EventStoreTestNode(EventStoreFixtureOptions? options = null) : TestContainerService { - static readonly NetworkPortProvider NetworkPortProvider = new(); - + + static readonly NetworkPortProvider NetworkPortProvider = new(NetworkPortProvider.DefaultEsdbPort); + EventStoreFixtureOptions Options { get; } = options ?? DefaultOptions(); public static EventStoreFixtureOptions DefaultOptions() { const string connString = "esdb://admin:changeit@localhost:{port}/?tlsVerifyCert=false"; - var port = $"{NetworkPortProvider.NextAvailablePort}"; + var port = NetworkPortProvider.NextAvailablePort; var defaultSettings = EventStoreClientSettings - .Create(connString.Replace("{port}", port)) + .Create(connString.Replace("{port}", $"{port}")) .With(x => x.LoggerFactory = new SerilogLoggerFactory(Log.Logger)) .With(x => x.DefaultDeadline = Application.DebuggerIsAttached ? new TimeSpan?() : FromSeconds(30)) .With(x => x.ConnectivitySettings.MaxDiscoverAttempts = 20) @@ -41,11 +42,14 @@ public static EventStoreFixtureOptions DefaultOptions() { ["EVENTSTORE_DISABLE_LOG_FILE"] = "true" }; - if (GlobalEnvironment.Variables.TryGetValue("ES_DOCKER_TAG", out var tag) && tag == "ci") - defaultEnvironment["EVENTSTORE_ADVERTISE_NODE_PORT_TO_CLIENT_AS"] = port; - else - defaultEnvironment["EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS"] = port; - + // TODO SS: must find a way to enable parallel tests on CI. It works locally. + if (port != NetworkPortProvider.DefaultEsdbPort) { + if (GlobalEnvironment.Variables.TryGetValue("ES_DOCKER_TAG", out var tag) && tag == "ci") + defaultEnvironment["EVENTSTORE_ADVERTISE_NODE_PORT_TO_CLIENT_AS"] = $"{port}"; + else + defaultEnvironment["EVENTSTORE_ADVERTISE_HTTP_PORT_TO_CLIENT_AS"] = $"{port}"; + } + return new(defaultSettings, defaultEnvironment); } @@ -54,8 +58,10 @@ protected override ContainerBuilder Configure() { var port = Options.ClientSettings.ConnectivitySettings.Address.Port; var certsPath = Path.Combine(Environment.CurrentDirectory, "certs"); - var containerName = $"esbd-dotnet-test-{port}-{Guid.NewGuid().ToString()[30..]}"; - //var containerName = "es-client-dotnet-test"; + + var containerName = port == 2113 + ? "es-client-dotnet-test" + : $"es-client-dotnet-test-{port}-{Guid.NewGuid().ToString()[30..]}"; CertificatesManager.VerifyCertificatesExist(certsPath); @@ -67,10 +73,6 @@ protected override ContainerBuilder Configure() { .MountVolume(certsPath, "/etc/eventstore/certs", MountType.ReadOnly) .ExposePort(port, 2113) .WaitForMessageInLog("'admin' user added to $users.", FromSeconds(60)); - // .KeepContainer() - // .WaitForHealthy(TimeSpan.FromSeconds(60)); - //.WaitForMessageInLog("'ops' user added to $users.") - //.WaitForMessageInLog("'admin' user added to $users."); } /// @@ -97,18 +99,28 @@ await Policy.Handle() } } -class NetworkPortProvider(int port = 2212) { +/// +/// Using the default 2113 port assumes that the test is running sequentially. +/// +/// +class NetworkPortProvider(int port = 2114) { + public const int DefaultEsdbPort = 2113; + static readonly SemaphoreSlim Semaphore = new(1, 1); public async Task GetNextAvailablePort(TimeSpan delay = default) { - await Semaphore.WaitAsync(); + // TODO SS: find a way to enable parallel tests on CI + if (port == DefaultEsdbPort) + return port; + await Semaphore.WaitAsync(); + try { using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); - + while (true) { var nexPort = Interlocked.Increment(ref port); - + try { await socket.ConnectAsync(IPAddress.Any, nexPort); } @@ -116,7 +128,7 @@ public async Task GetNextAvailablePort(TimeSpan delay = default) { if (ex.SocketErrorCode is SocketError.ConnectionRefused or not SocketError.IsConnected) { return nexPort; } - + await Task.Delay(delay); } finally { diff --git a/test/EventStore.Client.Tests/EventStore.Client.Tests.csproj b/test/EventStore.Client.Tests/EventStore.Client.Tests.csproj index 254549455..f383c966d 100644 --- a/test/EventStore.Client.Tests/EventStore.Client.Tests.csproj +++ b/test/EventStore.Client.Tests/EventStore.Client.Tests.csproj @@ -1,21 +1,21 @@  - + - + - + - + - - - + + + all runtime; build; native; contentfiles; analyzers diff --git a/test/EventStore.Client.UserManagement.Tests/AssemblyInfo.cs b/test/EventStore.Client.UserManagement.Tests/AssemblyInfo.cs index 87948ff98..b0b47aa73 100644 --- a/test/EventStore.Client.UserManagement.Tests/AssemblyInfo.cs +++ b/test/EventStore.Client.UserManagement.Tests/AssemblyInfo.cs @@ -1 +1 @@ -[assembly: CollectionBehavior(DisableTestParallelization = false)] \ No newline at end of file +[assembly: CollectionBehavior(DisableTestParallelization = true)] \ No newline at end of file diff --git a/test/EventStore.Client.UserManagement.Tests/EventStore.Client.UserManagement.Tests.csproj b/test/EventStore.Client.UserManagement.Tests/EventStore.Client.UserManagement.Tests.csproj index fb80ba76e..d4b52e67f 100644 --- a/test/EventStore.Client.UserManagement.Tests/EventStore.Client.UserManagement.Tests.csproj +++ b/test/EventStore.Client.UserManagement.Tests/EventStore.Client.UserManagement.Tests.csproj @@ -4,9 +4,9 @@ EventStore.Client.Tests - + - + - + \ No newline at end of file