diff --git a/tests/NATS.Client.CheckNativeAot/Program.cs b/tests/NATS.Client.CheckNativeAot/Program.cs index bd65f2f2e..7a719698d 100644 --- a/tests/NATS.Client.CheckNativeAot/Program.cs +++ b/tests/NATS.Client.CheckNativeAot/Program.cs @@ -7,10 +7,10 @@ using NATS.Client.KeyValueStore; using NATS.Client.ObjectStore; using NATS.Client.ObjectStore.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.Services; using NATS.Client.Services.Internal; using NATS.Client.Services.Models; +using Synadia.Orbit.Testing.NatsServerProcessManager; Log("Starting..."); diff --git a/tests/NATS.Client.Core.Tests/AuthErrorTest.cs b/tests/NATS.Client.Core.Tests/AuthErrorTest.cs index 1999e2794..8b278901c 100644 --- a/tests/NATS.Client.Core.Tests/AuthErrorTest.cs +++ b/tests/NATS.Client.Core.Tests/AuthErrorTest.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Logging; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core.Tests/ConnectionRetryTest.cs b/tests/NATS.Client.Core.Tests/ConnectionRetryTest.cs index 0cdef2c8e..d05455452 100644 --- a/tests/NATS.Client.Core.Tests/ConnectionRetryTest.cs +++ b/tests/NATS.Client.Core.Tests/ConnectionRetryTest.cs @@ -1,4 +1,4 @@ -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core.Tests/LowLevelApiTest.cs b/tests/NATS.Client.Core.Tests/LowLevelApiTest.cs index 2f0c1f172..7b259630f 100644 --- a/tests/NATS.Client.Core.Tests/LowLevelApiTest.cs +++ b/tests/NATS.Client.Core.Tests/LowLevelApiTest.cs @@ -1,6 +1,6 @@ using System.Buffers; using System.Text; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core.Tests/ProtocolTest.cs b/tests/NATS.Client.Core.Tests/ProtocolTest.cs index 9709019a0..464d3068b 100644 --- a/tests/NATS.Client.Core.Tests/ProtocolTest.cs +++ b/tests/NATS.Client.Core.Tests/ProtocolTest.cs @@ -1,6 +1,6 @@ using Microsoft.Extensions.Logging; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core.Tests/SubscriptionTest.cs b/tests/NATS.Client.Core.Tests/SubscriptionTest.cs index 66674a3eb..edb709ce3 100644 --- a/tests/NATS.Client.Core.Tests/SubscriptionTest.cs +++ b/tests/NATS.Client.Core.Tests/SubscriptionTest.cs @@ -1,5 +1,5 @@ using System.Net; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core2.Tests/CancellationTest.cs b/tests/NATS.Client.Core2.Tests/CancellationTest.cs index ca6d9f9ac..06c3660e0 100644 --- a/tests/NATS.Client.Core2.Tests/CancellationTest.cs +++ b/tests/NATS.Client.Core2.Tests/CancellationTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core2.Tests/MessageInterfaceTest.cs b/tests/NATS.Client.Core2.Tests/MessageInterfaceTest.cs index 094b84d6a..526500545 100644 --- a/tests/NATS.Client.Core2.Tests/MessageInterfaceTest.cs +++ b/tests/NATS.Client.Core2.Tests/MessageInterfaceTest.cs @@ -1,5 +1,5 @@ using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Client.Core2.Tests/NatsServerFixture.cs b/tests/NATS.Client.Core2.Tests/NatsServerFixture.cs index 24d679005..a661fb275 100644 --- a/tests/NATS.Client.Core2.Tests/NatsServerFixture.cs +++ b/tests/NATS.Client.Core2.Tests/NatsServerFixture.cs @@ -1,4 +1,4 @@ -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core2.Tests; diff --git a/tests/NATS.Client.Core2.Tests/OnConnectingUriTest.cs b/tests/NATS.Client.Core2.Tests/OnConnectingUriTest.cs index 04c83a2c3..5265e880d 100644 --- a/tests/NATS.Client.Core2.Tests/OnConnectingUriTest.cs +++ b/tests/NATS.Client.Core2.Tests/OnConnectingUriTest.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.Logging; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core2.Tests; diff --git a/tests/NATS.Client.Core2.Tests/ReconnectTests.cs b/tests/NATS.Client.Core2.Tests/ReconnectTests.cs index 01a6e945d..101c28d9d 100644 --- a/tests/NATS.Client.Core2.Tests/ReconnectTests.cs +++ b/tests/NATS.Client.Core2.Tests/ReconnectTests.cs @@ -1,8 +1,8 @@ using Microsoft.Extensions.Logging; using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core2.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ConsumerConsumeTest.cs b/tests/NATS.Client.JetStream.Tests/ConsumerConsumeTest.cs index 3ba125bad..13ee99293 100644 --- a/tests/NATS.Client.JetStream.Tests/ConsumerConsumeTest.cs +++ b/tests/NATS.Client.JetStream.Tests/ConsumerConsumeTest.cs @@ -3,10 +3,10 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; using NATS.Net; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ConsumerNextTest.cs b/tests/NATS.Client.JetStream.Tests/ConsumerNextTest.cs index cf4ebf1dc..3e6f9ad46 100644 --- a/tests/NATS.Client.JetStream.Tests/ConsumerNextTest.cs +++ b/tests/NATS.Client.JetStream.Tests/ConsumerNextTest.cs @@ -1,7 +1,7 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ConsumerNotificationTest.cs b/tests/NATS.Client.JetStream.Tests/ConsumerNotificationTest.cs index da70947e4..01606aa58 100644 --- a/tests/NATS.Client.JetStream.Tests/ConsumerNotificationTest.cs +++ b/tests/NATS.Client.JetStream.Tests/ConsumerNotificationTest.cs @@ -2,8 +2,8 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ConsumerSetupTest.cs b/tests/NATS.Client.JetStream.Tests/ConsumerSetupTest.cs index 3ef4feffd..1132d27c8 100644 --- a/tests/NATS.Client.JetStream.Tests/ConsumerSetupTest.cs +++ b/tests/NATS.Client.JetStream.Tests/ConsumerSetupTest.cs @@ -2,8 +2,8 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/DoubleAckTest.cs b/tests/NATS.Client.JetStream.Tests/DoubleAckTest.cs index 6bcf89dac..0a5f4de23 100644 --- a/tests/NATS.Client.JetStream.Tests/DoubleAckTest.cs +++ b/tests/NATS.Client.JetStream.Tests/DoubleAckTest.cs @@ -1,5 +1,5 @@ using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/JetStreamTest.cs b/tests/NATS.Client.JetStream.Tests/JetStreamTest.cs index 939af8798..9bdf2d8f6 100644 --- a/tests/NATS.Client.JetStream.Tests/JetStreamTest.cs +++ b/tests/NATS.Client.JetStream.Tests/JetStreamTest.cs @@ -1,8 +1,8 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ListTests.cs b/tests/NATS.Client.JetStream.Tests/ListTests.cs index 679e1a4a1..6dfa36b8c 100644 --- a/tests/NATS.Client.JetStream.Tests/ListTests.cs +++ b/tests/NATS.Client.JetStream.Tests/ListTests.cs @@ -1,7 +1,7 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/ManageStreamTest.cs b/tests/NATS.Client.JetStream.Tests/ManageStreamTest.cs index 63c98dd13..89125e6aa 100644 --- a/tests/NATS.Client.JetStream.Tests/ManageStreamTest.cs +++ b/tests/NATS.Client.JetStream.Tests/ManageStreamTest.cs @@ -1,9 +1,9 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/MessageInterfaceTest.cs b/tests/NATS.Client.JetStream.Tests/MessageInterfaceTest.cs index ffcf63961..3baa66985 100644 --- a/tests/NATS.Client.JetStream.Tests/MessageInterfaceTest.cs +++ b/tests/NATS.Client.JetStream.Tests/MessageInterfaceTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/NatsJsContextFactoryTest.cs b/tests/NATS.Client.JetStream.Tests/NatsJsContextFactoryTest.cs index 6df2e7f2d..5627affb8 100644 --- a/tests/NATS.Client.JetStream.Tests/NatsJsContextFactoryTest.cs +++ b/tests/NATS.Client.JetStream.Tests/NatsJsContextFactoryTest.cs @@ -2,7 +2,7 @@ using System.Text; using System.Threading.Channels; using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/OrderedConsumerTest.cs b/tests/NATS.Client.JetStream.Tests/OrderedConsumerTest.cs index 8527dfdf9..85235fffb 100644 --- a/tests/NATS.Client.JetStream.Tests/OrderedConsumerTest.cs +++ b/tests/NATS.Client.JetStream.Tests/OrderedConsumerTest.cs @@ -2,8 +2,8 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/PublishConcurrentTests.cs b/tests/NATS.Client.JetStream.Tests/PublishConcurrentTests.cs index 03baed346..cc2dfe86c 100644 --- a/tests/NATS.Client.JetStream.Tests/PublishConcurrentTests.cs +++ b/tests/NATS.Client.JetStream.Tests/PublishConcurrentTests.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.JetStream.Tests/PublishTest.cs b/tests/NATS.Client.JetStream.Tests/PublishTest.cs index fd8591a4c..865b6681c 100644 --- a/tests/NATS.Client.JetStream.Tests/PublishTest.cs +++ b/tests/NATS.Client.JetStream.Tests/PublishTest.cs @@ -2,10 +2,10 @@ using Microsoft.Extensions.Logging; using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; using NATS.Net; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.JetStream.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/DirectGetTest.cs b/tests/NATS.Client.KeyValueStore.Tests/DirectGetTest.cs index d8aebc979..cb4310b7c 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/DirectGetTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/DirectGetTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/GetKeysTest.cs b/tests/NATS.Client.KeyValueStore.Tests/GetKeysTest.cs index 9872b2f7a..d450184cc 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/GetKeysTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/GetKeysTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/KeyValueContextTest.cs b/tests/NATS.Client.KeyValueStore.Tests/KeyValueContextTest.cs index c90dc2934..41f83548d 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/KeyValueContextTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/KeyValueContextTest.cs @@ -1,5 +1,5 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/KeyValueStoreTest.cs b/tests/NATS.Client.KeyValueStore.Tests/KeyValueStoreTest.cs index 407b2fb1a..d8eddf3b8 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/KeyValueStoreTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/KeyValueStoreTest.cs @@ -1,8 +1,8 @@ using System.Diagnostics; using NATS.Client.Core.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/NatsKVContextFactoryTest.cs b/tests/NATS.Client.KeyValueStore.Tests/NatsKVContextFactoryTest.cs index ae9e2e766..6a769ee4a 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/NatsKVContextFactoryTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/NatsKVContextFactoryTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.KeyValueStore.Tests/NatsKVWatcherTest.cs b/tests/NATS.Client.KeyValueStore.Tests/NatsKVWatcherTest.cs index 35b02ac5a..2589a8927 100644 --- a/tests/NATS.Client.KeyValueStore.Tests/NatsKVWatcherTest.cs +++ b/tests/NATS.Client.KeyValueStore.Tests/NatsKVWatcherTest.cs @@ -3,9 +3,9 @@ using NATS.Client.Core.Tests; using NATS.Client.Core2.Tests; using NATS.Client.KeyValueStore.Internal; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.KeyValueStore.Tests; diff --git a/tests/NATS.Client.ObjectStore.Tests/CompatTest.cs b/tests/NATS.Client.ObjectStore.Tests/CompatTest.cs index 4c667007b..3ad3f6198 100644 --- a/tests/NATS.Client.ObjectStore.Tests/CompatTest.cs +++ b/tests/NATS.Client.ObjectStore.Tests/CompatTest.cs @@ -2,7 +2,7 @@ using System.Text.Json.Nodes; using NATS.Client.Core.Tests; using NATS.Client.ObjectStore.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.ObjectStore.Tests; diff --git a/tests/NATS.Client.ObjectStore.Tests/NatsObjContextFactoryTest.cs b/tests/NATS.Client.ObjectStore.Tests/NatsObjContextFactoryTest.cs index 7c2e0bdff..b9e675f61 100644 --- a/tests/NATS.Client.ObjectStore.Tests/NatsObjContextFactoryTest.cs +++ b/tests/NATS.Client.ObjectStore.Tests/NatsObjContextFactoryTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.ObjectStore.Tests; diff --git a/tests/NATS.Client.ObjectStore.Tests/ObjectStoreTest.cs b/tests/NATS.Client.ObjectStore.Tests/ObjectStoreTest.cs index 02e653720..023618421 100644 --- a/tests/NATS.Client.ObjectStore.Tests/ObjectStoreTest.cs +++ b/tests/NATS.Client.ObjectStore.Tests/ObjectStoreTest.cs @@ -5,9 +5,9 @@ using NATS.Client.JetStream.Models; using NATS.Client.ObjectStore.Internal; using NATS.Client.ObjectStore.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.Serializers.Json; using NATS.Client.TestUtilities; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.ObjectStore.Tests; diff --git a/tests/NATS.Client.ObjectStore.Tests/SlowConsumerTest.cs b/tests/NATS.Client.ObjectStore.Tests/SlowConsumerTest.cs index c698aa368..a1d3bc271 100644 --- a/tests/NATS.Client.ObjectStore.Tests/SlowConsumerTest.cs +++ b/tests/NATS.Client.ObjectStore.Tests/SlowConsumerTest.cs @@ -1,6 +1,6 @@ using NATS.Client.Core.Tests; using NATS.Client.ObjectStore.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.ObjectStore.Tests; diff --git a/tests/NATS.Client.ObjectStore.Tests/WatcherTest.cs b/tests/NATS.Client.ObjectStore.Tests/WatcherTest.cs index 73fa43f0f..ea7bdf726 100644 --- a/tests/NATS.Client.ObjectStore.Tests/WatcherTest.cs +++ b/tests/NATS.Client.ObjectStore.Tests/WatcherTest.cs @@ -1,5 +1,5 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.ObjectStore.Tests; diff --git a/tests/NATS.Client.Perf/Program.cs b/tests/NATS.Client.Perf/Program.cs index f32143859..64445f2ca 100644 --- a/tests/NATS.Client.Perf/Program.cs +++ b/tests/NATS.Client.Perf/Program.cs @@ -4,7 +4,7 @@ using System.Threading.Channels; using NATS.Client.Core; using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; var t = new TestParams { diff --git a/tests/NATS.Client.Platform.Windows.Tests/BaseNatsServerFixture.cs b/tests/NATS.Client.Platform.Windows.Tests/BaseNatsServerFixture.cs index f81dccfa8..5a4ce2089 100644 --- a/tests/NATS.Client.Platform.Windows.Tests/BaseNatsServerFixture.cs +++ b/tests/NATS.Client.Platform.Windows.Tests/BaseNatsServerFixture.cs @@ -1,3 +1,5 @@ +using Synadia.Orbit.Testing.NatsServerProcessManager; + namespace NATS.Client.Platform.Windows.Tests; public class BaseNatsServerFixture : IDisposable diff --git a/tests/NATS.Client.Services.Tests/ServicesSerializationTest.cs b/tests/NATS.Client.Services.Tests/ServicesSerializationTest.cs index a62ca0fc0..d05d8afd7 100644 --- a/tests/NATS.Client.Services.Tests/ServicesSerializationTest.cs +++ b/tests/NATS.Client.Services.Tests/ServicesSerializationTest.cs @@ -2,10 +2,10 @@ using System.Text.Json; using System.Threading.Channels; using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.Serializers.Json; using NATS.Client.Services.Internal; using NATS.Client.Services.Models; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Services.Tests; diff --git a/tests/NATS.Client.Services.Tests/ServicesTests.cs b/tests/NATS.Client.Services.Tests/ServicesTests.cs index 901f6b9ba..25188991d 100644 --- a/tests/NATS.Client.Services.Tests/ServicesTests.cs +++ b/tests/NATS.Client.Services.Tests/ServicesTests.cs @@ -1,10 +1,10 @@ using System.Text.Json.Nodes; using System.Text.RegularExpressions; using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.Services.Internal; using NATS.Client.Services.Models; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Services.Tests; diff --git a/tests/NATS.Client.Services.Tests/SlowConsumerTest.cs b/tests/NATS.Client.Services.Tests/SlowConsumerTest.cs index 4bffe6518..74d2dc5e5 100644 --- a/tests/NATS.Client.Services.Tests/SlowConsumerTest.cs +++ b/tests/NATS.Client.Services.Tests/SlowConsumerTest.cs @@ -1,5 +1,5 @@ using NATS.Client.Core.Tests; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Services.Tests; diff --git a/tests/NATS.Client.Simplified.Tests/ClientTest.cs b/tests/NATS.Client.Simplified.Tests/ClientTest.cs index 153830045..d2be1f92f 100644 --- a/tests/NATS.Client.Simplified.Tests/ClientTest.cs +++ b/tests/NATS.Client.Simplified.Tests/ClientTest.cs @@ -3,9 +3,9 @@ using NATS.Client.Core; using NATS.Client.Core.Tests; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.Serializers.Json; using NATS.Net; +using Synadia.Orbit.Testing.NatsServerProcessManager; // ReSharper disable AccessToDisposedClosure namespace NATS.Client.Simplified.Tests; diff --git a/tests/NATS.Client.TestUtilities/NATS.Client.TestUtilities.csproj b/tests/NATS.Client.TestUtilities/NATS.Client.TestUtilities.csproj index bedcd4990..c3e0b05f5 100644 --- a/tests/NATS.Client.TestUtilities/NATS.Client.TestUtilities.csproj +++ b/tests/NATS.Client.TestUtilities/NATS.Client.TestUtilities.csproj @@ -10,6 +10,7 @@ + diff --git a/tests/NATS.Client.TestUtilities/NatsServerProcess.cs b/tests/NATS.Client.TestUtilities/NatsServerProcess.cs deleted file mode 100644 index 34015d2d7..000000000 --- a/tests/NATS.Client.TestUtilities/NatsServerProcess.cs +++ /dev/null @@ -1,380 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics; -using System.Net.Sockets; -using System.Runtime.InteropServices; -using System.Text.RegularExpressions; -using Exception = System.Exception; - -#pragma warning disable VSTHRD103 -#pragma warning disable VSTHRD105 -#pragma warning disable SA1512 - -// ReSharper disable SuggestVarOrType_BuiltInTypes -// ReSharper disable SuggestVarOrType_SimpleTypes -// ReSharper disable NotAccessedField.Local -// ReSharper disable UseObjectOrCollectionInitializer -// ReSharper disable InconsistentNaming - -namespace NATS.Client.Platform.Windows.Tests; - -public class NatsServerProcess : IAsyncDisposable, IDisposable -{ - private readonly Action _logger; - private readonly Process _process; - private readonly string _scratch; - private readonly bool _withJs; - private readonly string? _config; - private readonly int _port; - private bool _stopped; - - private NatsServerProcess(Action logger, Process process, string url, string scratch, bool withJs, string? config, int port) - { - Url = url; - _logger = logger; - _process = process; - _scratch = scratch; - _withJs = withJs; - _config = config; - _port = port; - } - - public string Url { get; } - - public int Pid => _process.Id; - - public string? Config => _config; - - public int Port => new Uri(Url).Port; - - public static ValueTask StartAsync(Action? logger = null, string? config = null, bool withJs = true, int port = -1, string? scratch = null) - => new(Start(logger, config, withJs, port, scratch)); - - public static NatsServerProcess Start(Action? logger = null, string? config = null, bool withJs = true, int port = -1, string? scratch = null) - { - var isLoggingEnabled = logger != null; - var log = logger ?? (_ => { }); - - scratch ??= Path.Combine(Path.GetTempPath(), "nats.net.tests", Guid.NewGuid().ToString()); - - var portsFileDir = Path.Combine(scratch, "port"); - Directory.CreateDirectory(portsFileDir); - - var isWindows = RuntimeInformation.IsOSPlatform(OSPlatform.Windows); - - var natsServerExe = isWindows ? "nats-server.exe" : "nats-server"; - var configFlag = config == null ? string.Empty : $"-c \"{config}\""; - var portsFileDirEsc = portsFileDir.Replace(@"\", @"\\"); - - string? sdEsc = null; - if (withJs) - { - var sd = Path.Combine(scratch, "data"); - Directory.CreateDirectory(sd); - sdEsc = sd.Replace(@"\", @"\\"); - } - - var info = new ProcessStartInfo - { - FileName = natsServerExe, - Arguments = withJs - ? $"{configFlag} -a 127.0.0.1 -p {port} -js -sd \"{sdEsc}\" --ports_file_dir \"{portsFileDirEsc}\"" - : $"{configFlag} -a 127.0.0.1 -p {port} --ports_file_dir \"{portsFileDirEsc}\"", - UseShellExecute = false, - CreateNoWindow = false, - - // RedirectStandardError = isLoggingEnabled, - // RedirectStandardOutput = isLoggingEnabled, - RedirectStandardError = true, - RedirectStandardOutput = true, - }; - var process = new Process { StartInfo = info, }; - - if (isLoggingEnabled) - { -#pragma warning disable CS8604 // Possible null reference argument. - DataReceivedEventHandler outputHandler = (_, e) => log(e.Data); -#pragma warning restore CS8604 // Possible null reference argument. - process.OutputDataReceived += outputHandler; - process.ErrorDataReceived += outputHandler; - } - else - { - process.OutputDataReceived += (_, e) => { }; - process.ErrorDataReceived += (_, e) => { }; - } - - process.Start(); - - if (isWindows) - ChildProcessTracker.AddProcess(process); - - // if (isLoggingEnabled) - { - process.BeginOutputReadLine(); - process.BeginErrorReadLine(); - } - - var portsFile = Path.Combine(portsFileDir, $"{natsServerExe}_{process.Id}.ports"); - log($"portsFile={portsFile}"); - - string? ports = null; - Exception? exception = null; - for (var i = 0; i < 10; i++) - { - try - { - ports = File.ReadAllText(portsFile); - break; - } - catch (Exception e) - { - exception = e; - Thread.Sleep(100 + (500 * i)); - } - } - - if (ports == null) - { - throw exception ?? new Exception("Failed to read ports file."); - } - - var url = Regex.Match(ports, @"\w+://[\d\.]+:\d+").Groups[0].Value; - port = new Uri(url).Port; - log($"ports={ports}"); - log($"url={url}"); - - for (var i = 0; i < 10; i++) - { - try - { - using var tcpClient = new TcpClient(); - tcpClient.Connect("127.0.0.1", port); - using var networkStream = tcpClient.GetStream(); - using var streamReader = new StreamReader(networkStream); - var readLine = streamReader.ReadLine(); - if (readLine == null || !readLine.StartsWith("INFO", StringComparison.OrdinalIgnoreCase)) - { - continue; - } - - return new NatsServerProcess(log, process, url, scratch, withJs, config, port); - } - catch - { - Thread.Sleep(1_000 + (i * 500)); - } - } - - throw new Exception("Failed to setup the server."); - } - - public ValueTask DisposeAsync() - { - Dispose(); - return default; - } - - public void Dispose() - { - Stop(); - for (var i = 0; i < 3; i++) - { - try - { - Directory.Delete(_scratch, recursive: true); - break; - } - catch - { - Thread.Sleep(100); - } - } - - _process.Dispose(); - } - - public ValueTask RestartAsync() - { - Stop(); - return StartAsync(_logger, _config, _withJs, _port, _scratch); - } - - public ValueTask StopAsync() - { - Stop(); - return default; - } - - public void Stop() - { - if (_stopped) - return; - - for (var i = 0; i < 10; i++) - { - try - { - _process.Kill(); - } - catch - { - // best effort - } - - if (_process.WaitForExit(1_000)) - break; - } - - _stopped = true; - - // Give OS some time to clean up - Thread.Sleep(500); - } -} - -// Borrowed from https://stackoverflow.com/questions/3342941/kill-child-process-when-parent-process-is-killed/37034966#37034966 - -/// -/// Allows processes to be automatically killed if this parent process unexpectedly quits. -/// This feature requires Windows 8 or greater. On Windows 7, nothing is done. -/// References: -/// https://stackoverflow.com/a/4657392/386091 -/// https://stackoverflow.com/a/9164742/386091 -#pragma warning disable SA1204 -#pragma warning disable SA1129 -#pragma warning disable SA1201 -#pragma warning disable SA1117 -#pragma warning disable SA1400 -#pragma warning disable SA1311 -#pragma warning disable SA1308 -#pragma warning disable SA1413 -#pragma warning disable SA1121 -public static class ChildProcessTracker -{ - /// - /// Add the process to be tracked. If our current process is killed, the child processes - /// that we are tracking will be automatically killed, too. If the child process terminates - /// first, that's fine, too. - /// - public static void AddProcess(Process process) - { - if (s_jobHandle != IntPtr.Zero) - { - var success = AssignProcessToJobObject(s_jobHandle, process.Handle); - if (!success && !process.HasExited) - throw new Win32Exception(); - } - } - - static ChildProcessTracker() - { - // This feature requires Windows 8 or later. To support Windows 7, requires - // registry settings to be added if you are using Visual Studio plus an - // app.manifest change. - // https://stackoverflow.com/a/4232259/386091 - // https://stackoverflow.com/a/9507862/386091 - if (Environment.OSVersion.Version < new Version(6, 2)) - return; - - // The job name is optional (and can be null), but it helps with diagnostics. - // If it's not null, it has to be unique. Use SysInternals' Handle command-line - // utility: handle -a ChildProcessTracker - var jobName = "ChildProcessTracker" + Process.GetCurrentProcess().Id; - s_jobHandle = CreateJobObject(IntPtr.Zero, jobName); - - var info = new JOBOBJECT_BASIC_LIMIT_INFORMATION(); - - // This is the key flag. When our process is killed, Windows will automatically - // close the job handle, and when that happens, we want the child processes to - // be killed, too. - info.LimitFlags = JOBOBJECTLIMIT.JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE; - - var extendedInfo = new JOBOBJECT_EXTENDED_LIMIT_INFORMATION(); - extendedInfo.BasicLimitInformation = info; - - var length = Marshal.SizeOf(typeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION)); - var extendedInfoPtr = Marshal.AllocHGlobal(length); - try - { - Marshal.StructureToPtr(extendedInfo, extendedInfoPtr, false); - - if (!SetInformationJobObject(s_jobHandle, JobObjectInfoType.ExtendedLimitInformation, - extendedInfoPtr, (uint)length)) - { - throw new Win32Exception(); - } - } - finally - { - Marshal.FreeHGlobal(extendedInfoPtr); - } - } - - [DllImport("kernel32.dll", CharSet = CharSet.Unicode)] - static extern IntPtr CreateJobObject(IntPtr lpJobAttributes, string name); - - [DllImport("kernel32.dll")] - static extern bool SetInformationJobObject(IntPtr job, JobObjectInfoType infoType, - IntPtr lpJobObjectInfo, uint cbJobObjectInfoLength); - - [DllImport("kernel32.dll", SetLastError = true)] - static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process); - - // Windows will automatically close any open job handles when our process terminates. - // This can be verified by using SysInternals' Handle utility. When the job handle - // is closed, the child processes will be killed. - private static readonly IntPtr s_jobHandle; -} - -public enum JobObjectInfoType -{ - AssociateCompletionPortInformation = 7, - BasicLimitInformation = 2, - BasicUIRestrictions = 4, - EndOfJobTimeInformation = 6, - ExtendedLimitInformation = 9, - SecurityLimitInformation = 5, - GroupInformation = 11 -} - -[StructLayout(LayoutKind.Sequential)] -public struct JOBOBJECT_BASIC_LIMIT_INFORMATION -{ - public long PerProcessUserTimeLimit; - public long PerJobUserTimeLimit; - public JOBOBJECTLIMIT LimitFlags; - public UIntPtr MinimumWorkingSetSize; - public UIntPtr MaximumWorkingSetSize; - public uint ActiveProcessLimit; - public long Affinity; - public uint PriorityClass; - public uint SchedulingClass; -} - -[Flags] -public enum JOBOBJECTLIMIT : uint -{ - JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE = 0x2000 -} - -[StructLayout(LayoutKind.Sequential)] -public struct IO_COUNTERS -{ - public ulong ReadOperationCount; - public ulong WriteOperationCount; - public ulong OtherOperationCount; - public ulong ReadTransferCount; - public ulong WriteTransferCount; - public ulong OtherTransferCount; -} - -[StructLayout(LayoutKind.Sequential)] -public struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION -{ - public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; - public IO_COUNTERS IoInfo; - public UIntPtr ProcessMemoryLimit; - public UIntPtr JobMemoryLimit; - public UIntPtr PeakProcessMemoryUsed; - public UIntPtr PeakJobMemoryUsed; -} diff --git a/tests/NATS.Extensions.Microsoft.DependencyInjection.Tests/NatsHostingExtensionsTests.cs b/tests/NATS.Extensions.Microsoft.DependencyInjection.Tests/NatsHostingExtensionsTests.cs index a0930da81..75f904bdc 100644 --- a/tests/NATS.Extensions.Microsoft.DependencyInjection.Tests/NatsHostingExtensionsTests.cs +++ b/tests/NATS.Extensions.Microsoft.DependencyInjection.Tests/NatsHostingExtensionsTests.cs @@ -3,8 +3,8 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using NATS.Client.Core; -using NATS.Client.Platform.Windows.Tests; using NATS.Net; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Extensions.Microsoft.DependencyInjection.Tests; diff --git a/tests/NATS.Net.OpenTelemetry.Tests/OpenTelemetryTest.cs b/tests/NATS.Net.OpenTelemetry.Tests/OpenTelemetryTest.cs index 7e41edfaa..7c8f7902f 100644 --- a/tests/NATS.Net.OpenTelemetry.Tests/OpenTelemetryTest.cs +++ b/tests/NATS.Net.OpenTelemetry.Tests/OpenTelemetryTest.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using NATS.Client.JetStream; using NATS.Client.JetStream.Models; -using NATS.Client.Platform.Windows.Tests; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests; diff --git a/tests/NATS.Slow.Tests/NatsServer.cs b/tests/NATS.Slow.Tests/NatsServer.cs index f51b4b259..37f5509a2 100644 --- a/tests/NATS.Slow.Tests/NatsServer.cs +++ b/tests/NATS.Slow.Tests/NatsServer.cs @@ -2,9 +2,9 @@ using System.Net.Sockets; using System.Runtime.InteropServices; using Microsoft.Extensions.Logging; -using NATS.Client.Platform.Windows.Tests; using NATS.Client.TestUtilities; using NATS.Client.TestUtilities2; +using Synadia.Orbit.Testing.NatsServerProcessManager; namespace NATS.Client.Core.Tests;