Skip to content

Commit

Permalink
[Async TestKit] Merge feature/async_testkit branch into dev branch (
Browse files Browse the repository at this point in the history
#5953)

* Add peek methods into BlockingQueue and TestKitBase (#5660)

* Add peek methods into BlockingQueue and TestKitBase

* Add Obsolete attribute to BlockingQueue.AddFirst

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* Remove test actor deadletter logging (#5662)

* Modernize Receive function to switch instead of if...else

* Remove TestActor DeadLetter logging

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* Extract ITestQueue<T> interface from BlockingQueue<T> (#5665)

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* [TEST] Add AsyncQueue to TestKit (#5672)

* Moved the `akka core` configuration page into `modules`` (#5664)

* Fix link issue with `xref` (#5666)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* [Docs]: Fix Metadata Reference  (#5668)

* Turn on `ProduceReferenceAssembly`

* Add `ProduceReferenceAssembly` to `common.props`

* Fix build failures in Akka.FSharp

* Revert `<ProduceReferenceAssembly>$(ProduceReferenceAssembly)</ProduceReferenceAssembly>` added to affected projects because it already exists in `common.props'

* Resolved invalid links (#5669)

* Check for possible broken documentation by failing on DocFX warning (#5542)

* Add --warningsAsErrors flag to DocFX

* Add check in AzDo pr validation yaml

* Use windows image for docfx test

* Fix build script name

* disable incremental builds for DocFx

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Removed internal copy of Nito.AsyncEx.AsyncContext, used the nuget package instead

* Add asynchronous queue AsyncQueue to replace BlockingQueue

* Remove <inheritdoc> XML doc tags, its causing DocFX crash

Co-authored-by: Ebere Abanonu <eaba@users.noreply.github.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>
Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* Switch internal implementation to async (#5676)

* Switch internal implementation to `async`

* Revert changes on `ReceiveOne` methods

* replaced `TryPeekAsync` and `TryTakeAsync` with their respective `sync` methods

* Change Receive Test Methods to `Sync` over `Async` (#5678)

* Changed to sync over async

* * Change Peek methods to sync over async
* Create Peek `async` mthods

* Change FishForMessage() to sync over async that calls FishForMessageAsync()

* Inherit doc from `FishForMessage`

* Fix .Wait() returns AggregatedException instead of expected exxception

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* `AwaitAssert()` over  `AwaitAssertAsync()` (#5683)

* Converted `AwaitAssert()` to sync over async and called `AwaitAssertAsync()`

* Added CancellationToken support

* Prefer `ThrowIfCancellationRequested()` over `IsCancellationRequested`

* `AwaitCondition()` over `AwaitConditionAsync()` (#5685)

* Change `AwaitCondition()` to sync over async that calls `AwaitConditionAsync()`

* Add CancellationToken support

* Added `cancellationToken.IsCancellationRequested` check before var now with a different failure message.

* Change ReceiveWhile Test Methods to Sync over Async (#5682)

* Fix the remaining `FishForMessage` `Sync` over `Async` methods

* * Changed `ReceiveWhile` to `Sync` over `Async`
* Created `ReceiveWhileAsync()`

* Add missing TBD

* Create `ReceiveNAsync()`

* Potential fix for DocFx `StackOverflow` exception

* * Changed `FishForMessage` to directly call its `async` version
* Fix possible cause of `Stackoverflow` exception - methods inheriting docs from itself.

* Fix build error

* Added `CancellationToken` support

* Changed Receive methods to sync-over-async

* Add CancellationToken support to InternalReceiveNAsync, remove non-async private InternalReceiveN

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* Changed Expect methods to call async version

* Changed all `ExpectNoMsg()` methods to `sync-over-async` that calls their respective `async` methods

* Return `InternalReceiveN` to its former state.

* `.WaitAndUnwrapException()` is same as `.Result` - use `.WaitAndUnwrapException()` instead

* `.WaitAndUnwrapException` is same with `.Result` - use `.WaitAndUnwrapException` to avoid deadlocks

* Return `ReceiveN()` to being `sync-over-async`

* Replaced `.Result` with `.WaitAndUnwrapException` to avoid blocking

* Use `TryTake`

* Cleanup code

* Code cleanup

* Code cleanup, fix Akka.Remote.Test ThrottleTransportAdapterSpec

* Cherrypick codes

* Rollback ConfigureAwait() removal

* Fix ThrottlerTransportAdapterSpec, make the spec async

* Update API Approval list

* Update build system, use dll name instead of calling generic "dotnet test" on project file

* Skip .Tests.Performance projects

* Exclude *.Tests.Performance in CI/CD tests

* Revert "Update build system, use dll name instead of calling generic "dotnet test" on project file"

This reverts commit 6757de1.

* Revert "Skip .Tests.Performance projects"

This reverts commit 57a0eac.

* Revert "Exclude *.Tests.Performance in CI/CD tests"

This reverts commit 72926f4.

* Turn off incremental build (need to turn this back on after merging to dev)

* Change EventFilterApplier to async (#5698)

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* [TEST] Change Within methods to async (#5701)

* Change Within methods to async

* Fix async Within

* Fix documentation

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* [TEST] Fix and cleanup TestKit codes (#5704)

* Fix and cleanup codes

* Add missing `base.AfterAll()` in SerializationTransportInformationSpec

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>

* Implement ExpectMsgFrom as async (#5703)

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Turn incremental back on, use targetBranch to target feature/async_testkit branch for now (#5716)

* Convert AwaitCondition in TestKitBase initializer, can not use `.Wait()` in ctor (#5721)

* Convert Akka.Persistence.TestKit.Tests to async (#5718)

* Convert Akka.Persistence.TestKit.Tests to async

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Fix spelling (#5745) (#5755)

Co-authored-by: Ebere Abanonu <eaba@users.noreply.github.com>

* Port `Akka.Tests.Actor.Stash` tests to `async/await` (#5754)

* Port `Akka.Tests.Actor.Scheduler` tests to async/await (#5753)

* Chnaged tests under Akka.Tests.Actor.Dispatch to async/await (#5752)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port `Akka.Tests.Actor.Scheduler` tests to `async/await` - 2 (#5756)

* Port `Akka.Tests.Actor.Scheduler` tests to async/await

* Port `Akka.Tests.Actor.Scheduler` tests to `async/await` - 2

* Make code neater

* Port `Akka.Tests.Actor` tests to `async/await` (#5757)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port `Akka.Tests.Actor` tests to `async/await` - ActorCell (#5758)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `ActorDsl` (#5759)

* Port `Akka.Tests.Actor` tests to `async/await` - `ActorLookup` (#5761)

* Port `Akka.Tests.Actor` tests to `async/await` - `ProducerPipeline` (#5762)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - ActorLifeCycle (#5760)

* Port `Akka.Tests.Actor` tests to `async/await` - ActorLifeCycle

* Fix OnReceive method

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `ActorRefSpec` (#5764)

* Port `Akka.Tests.Actor` tests to `async/await` - `ActorRefSpec`

* Fix test intent

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `CoordinatedShutdownSpec` (#5770)

* Port `Akka.Tests.Actor` tests to `async/await` - `CoordinatedShutdownSpec`

* Fix CoordinatedShutdown_must_abort_if_recover_is_off

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `ActorSelectionSpec` (#5765)

* Port `Akka.Tests.Actor` tests to `async/await` - ActorSelectionSpec

* Fix test implementation

* Revert changes to Akka.Util.Internal.Extensions to make CI/CD run faster

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - AskSpec (#5767)

* Port `Akka.Tests.Actor` tests to `async/await` - AskSpec

* Fix timeout code

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - RefIgnoreSpec (#5763)

* Port `Akka.Tests.Actor` tests to `async/await` - RefIgnoreSpec

* Fix missing cancellationToken default value

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `BugFix4376Spec` (#5768)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to async/await - `ActorSystemSpec` (#5766)

* Port `Akka.Tests.Actor` tests to async/await - `ActorSystemSpec`

* Replaced `Wait` with `AwaitWithTimeout`

* Fix unit tests

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `DeadLetter*Spec` (#5771)

* Port `Akka.Tests.Actor` tests to `async/await` - `DeathWatchSpec` (#5772)

* Port `Akka.Tests.Actor` tests to `async/await` - `DeathWatchSpec`

* Fix test intention

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `BugFix4823Spec` (#5769)

* Port `Akka.Tests.Actor` tests to `async/await` - `BugFix4823Spec`

* Removed ask-timeout code to make CI/CD work faster, will add this later

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* General API and global ask timeout setting fix (#5773)

* Port `Akka.Tests.Actor` tests to `async/await` - `FSMActorSpec` (#5774)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `FSMTimingSpec` (#5775)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `FSMTransitionSpec` (#5776)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `FunctionRefSpecs` (#5777)

* Port `Akka.Tests.Actor` tests to `async/await` - `FunctionRefSpecs`

* Make use of `Task` instead of `ValueTask`

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `HotSwapSpec` (#5778)

* Port `Akka.Tests.Actor` tests to `async/await` - `InboxSpec` (#5780)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `LocalActorRefProviderSpec` (#5781)

* Port `Akka.Tests.Actor` tests to `async/await` - `LocalActorRefProviderSpec`

* Fix missing async test

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `PipeToSupportSpec` (#5782)

* Port `Akka.Tests.Actor` tests to `async/await` - `PipeToSupportSpec`

* Fix async tests

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Convert Akka.Streams.TestKit to async (#5793)

* Port `Akka.Tests.Actor` tests to `async/await` - `ReceiveActorTests` (#5783)

* Port `Akka.Tests.Actor` tests to `async/await` - `ReceiveTimeoutSpec` (#5784)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Actor` tests to `async/await` - `SupervisorHierarchySpec` (#5785)

* Port `Akka.Tests.Actor` tests to `async/await` - `SystemGuardianTests` (#5786)

* Port `Akka.Tests.Actor` tests to `async/await` - `TimerSpec` (#5787)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Dispatch` tests to `async/await` - `ActorAsyncAwaitSpec` (#5788)

* Port `Akka.Tests.Dispatch` tests to `async/await` - `ActorAsyncAwaitSpec`

* Add missing async test

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Dispatch` tests to `async/await` - `DispatchersSpec` (#5789)

* Port `Akka.Tests.Event` tests to `async/await` - `EventBusSpec` (#5791)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Event` tests to `async/await` - `LoggerSpec` (#5795)

* Port `Akka.Tests.Dispatch` tests to `async/await` - `MailboxesSpec` (#5790)

* Port `Akka.Tests.Dispatch` tests to `async/await` - `MailboxesSpec`

* await `AwaitConditionAsync`

* Resolves #5790 (comment)

* Port `Akka.Tests.Event` tests to `async/await` - `EventStreamSpec` (#5794)

* Port `Akka.Tests.Event` tests to `async/await` - `EventStreamSpec`

* Revert `ForEach` await

* Changed the last `XAssert` to `Assert`

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.IO` tests to `async/await` - `TcpListenerSpec` (#5797)

* Port `Akka.Tests.IO` tests to `async/await` - `TcpListenerSpec`

* Resolve #5797 (comment)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.IO` tests to `async/await` - `TcpIntegrationSpec` (#5796)

* Port `Akka.Tests.IO` tests to `async/await` - `TcpIntegrationSpec`

* * Don't use async/await inside `ForEach`
* Revert base.CreateTestProbe();

* Resolve #5796 (comment)

* Resolve #5796 (comment)

* Fix API Approval

* Resolves #5796 (comment)

* Reverse changes to Akka.Util.Internal.Extensions

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Loggers` tests to `async/await` - `LoggerSpec` (#5798)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.IO` tests to `async/await` - `UdpConnectedIntegrationSpec` (#5799)

* Port `Akka.Tests.IO` tests to `async/await` - `UdpIntegrationSpec` (#5800)

* Port `Akka.Tests.IO` tests to `async/await` - `UdpListenerSpec` (#5801)

* Port `Akka.Tests.IO` tests to `async/await` - `UdpListenerSpec`

* Created `RunAsync`

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Pattern` tests to `async/await` - `BackoffOnRestartSupervisorSpec` (#5803)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Pattern` tests to `async/await` - `BackoffSupervisorSpec` (#5804)

* Port `Akka.Tests.Pattern` tests to `async/await` - `BackoffSupervisorSpec`

* Mark possible racy source

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Routing` tests to `async/await` - `ConsistentHashingRouterSpec` (#5807)

* Port `Akka.Tests.Routing` tests to `async/await` - `ConfiguredLocalRoutingSpec` (#5806)

* Port `Akka.Tests.Pattern` tests to `async/await` - `ConfiguredLocalRoutingSpec`

* Let `.ToListAsync()` be called after `.Cast<Udp.Received>()`

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Routing` tests to `async/await` - `RandomSpec` (#5809)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Routing` tests to `async/await` - `ResizerSpec` (#5810)

* Port `Akka.Tests.Routing` tests to `async/await` - `ResizerSpec`

* Fix missing async ports

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Routing` tests to `async/await` - `RoundRobinSpec` (#5811)

Co-authored-by: Gregorius Soedharmo <arkatufus@yahoo.com>

* Port `Akka.Tests.Routing` tests to `async/await` - `RouteeCreationSpec` (#5812)

* Port `Akka.Tests.Routing` tests to `async/await` - `RoutingSpec` (#5813)

* Port `Akka.Tests.Routing` tests to `async/await` - `ScatterGatherFirstCompletedSpec` (#5814)

* Port `Akka.Tests.Routing` tests to `async/await` - `TailChoppingSpec` (#5815)

* Port Akka.Tests.Actor.Stash.ActorWithStashSpec (#5825)

* Port `Akka.Tests.Actor` tests to async/await - BugFix2176Spec (#5826)

* Port Akka.Tests.Actor tests to async/await - ContextWatchWithSpec, ConfigurationSpec (#5827)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port Akka.Tests.Dispatch tests to async/await - ActorMailboxSpec (#5828)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port Akka.Tests.IO tests to async/await - SimpleDnsCacheSpec (#5829)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Port Akka.Tests.Pattern tests to async/await - CircuitBreakerSpec (#5830)

* Port Akka.Tests.Pattern tests to async/await - RetrySpec (#5831)

* Port Akka.Tests.Util tests to async/await - Indexspec (#5832)

* Port Akka.Tests.Util.Internal tests to async/await - InterlockedSpinTests (#5833)

* Convert racy unit tests to async (#5713)

* Convert racy unit tests to async

* Code fixes

* Convert Akka.Persistence.TestKit.Tests to async

* Revert "Convert Akka.Persistence.TestKit.Tests to async"

This reverts commit 91bf88c.

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Move Akka.Tests.Util.TaskHelper to Akka.TestKit.Extensions.TaskExtensions (#5851)

* Convert Akka.TestKit.Tests to async - NoImplicitSenderSpec TestSchedulerSpec (#5853)

* Convert TestKitBase and TestProbe to async (#5852)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Add PrintTree method to ExtendedActorSystem (#5858)

* Add PrintTree method to ExtendedActorSystem

* Update approval list

* Fix Akka.DistributedData.Tests.MultiNode ReplicatorPruningSpec (#5864)

* Convert Xunit2.TestKit and AkkaSpec from IDisposable to IAsyncLifetime (#5865)

* Convert Akka.TestKit,Tests.TestKitBaseTests.ReceiveTests to async (#5868)

* Convert Akka.TestKit.Tests.TestKitBaseTests.DilatedTests to async (#5869)

* Convert Akka.TestKit.Tests.TestKitBaseTests.AwaitAssertTests to async (#5870)

* Convert Akka.TestKit.Tests.TestFSMRefTests.TestFSMRefSpec to async (#5871)

* Convert Akka.TestKit.Tests.TestEventListenerTests to async (#5872)

* Convert Akka.TestKit.Tests.TestEventListenerTests to async

* Fix namespace and exception message pattern matching

* Convert Akka.TestKit.Tests.TestKitBaseTests ExpectTests and IgnoreMessagesTests to async (#5876)

* Convert Akka.Remote.Tests to async - UntrustedSpec (#5877)

* Convert Akka.Remote.Tests to async - TransientSerializationErrorSpec (#5879)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Convert Akka.Remote.Tests to async - Transport.AkkaProtocolSpec (#5880)

* [Async TestKit] Convert Akka.Remote.Tests to async - RemotingTerminatorSpecs (#5884)

* Convert Akka.Remote.Tests to async - RemotingTerminatorSpecs

* change variable naming to meet naming convention

* Convert Akka.Remote.Tests to async - RemotingSpec (#5885)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Convert Akka.Remote.Tests to async - ActorsLeakSpec (#5892)

* Convert Akka.Remote.Tests to async - Assorted small changes (#5891)

* Convert Akka.Remote.Tests to async - AddressUidExtensionSpecs

* Convert Akka.Remote.Tests to async - RemoteDaemonSpec

* Convert Akka.Remote.Tests to async - Remove AkkaSpec dependency (#5900)

* Convert Akka.Remote.Tests to async - Remove AkkaSpec dependency

* Attempt to fix AkkaProtocolSpec racy spec

- Make sure that volatile is accessed correctly
- Make sure that Heartbeat() is called before value check

* Fix racy condition

* Convert Akka.Remote.Tests to async - RemoteWatcherSpec (#5886)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* [Async TestKit] Convert Akka.Remote.Tests to async - RemoteRouterSpec (#5887)

* Convert Akka.Remote.Tests to async - RemoteRouterSpec

* Remove net471 from target platform, IAsyncEnumerator is not compatible in linux builds

* Convert Akka.Remote.Tests to async - RemoteMetricsSpec (#5888)

* Convert Akka.Remote.Tests to async - AkkaProtocolStressTest (#5893)

* Convert Akka.Remote.Tests to async - RemoteMessageLocalDeliverySpec (#5889)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Convert Akka.Remote.Tests to async - BugFixes.BugFix4384Spec (#5905)

* Convert Akka.Remote.Tests to async - RemoteDeathWatchSpec (#5890)

* Convert Akka.Remote.Tests to async - Serialization.SerializationTransportInformationSpec (#5904)

* Convert Akka.Remote.Tests to async - Transport.GenericTransportSpec (#5898)

* Convert Akka.Remote.Tests to async - Transport.TestTransportSpec (#5899)

* Convert Akka.Remote.Tests to async - DotNettySslSupportSpec (#5894)

* Convert Akka.Remote.Tests to async - Transport.DotNettyTransportShutdownSpec (#5896)

* [Async TestKit] Convert Akka.Remote.Tests to async - Transport.ThrottlerTransportAdapterSpec (#5901)

* Convert Akka.Remote.Tests to async - Transport.ThrottlerTransportAdapterSpec

* Refactor FluentAssertion to TestKit

* [Async TestKit] Convert Akka.Stream.TestKit to async - Refactor TestKit.Tests (#5906)

* Convert Akka.Stream.TestKit to async - Refactor TestKit.Tests

* Remove hard coded magic string configuration loading via embedded resource

* Skip problematic racy unit tests (for now)

* Skip racy tests

* Skip racy tests

* [Async TestKit] Convert Akka.Stream.TestKit to async - BaseTwoStreamsSetup (#5907)

* Convert Akka.Stream.TestKit to async - BaseTwoStreamsSetup

* Skip racy tests

* Skip racy specs

* Convert Akka.Stream.TestKit to async - ChainSetup (#5909)

* [Async TestKit] Convert Akka.Stream.TestKit to async - TestSubscriber (#5911)

* Convert Akka.Stream.TestKit to async - TestSubscriber

* Skip racy specs

* [Async TestKit] Convert Akka.Stream.TestKit to async - ScriptedTest (#5910)

* Convert Akka.Stream.TestKit to async - ScriptedTest

* Fix initialization code

* Convert Akka.Stream.TestKit to async - StreamTestKitSpec (#5912)

* Convert Akka.Stream.TestKit to async - TestPublisherSubscriberSpec (#5913)

* Convert Akka.Streams.Tests to async - BugSpec (#5915)

* [Async TestKit] Convert Akka.Streams.Tests to async - FusingSpec (#5914)

* Convert Akka.Streams.Tests to async - FusingSpec

* Skip racy specs

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Convert Akka.Streams.Tests to async - OutputStreamSinkSpec (#5919)

* Convert Akka.Streams.Tests to async - OutputStreamSourceSpec (#5918)

* Refactor TestSubscriber fluent async builder (#5923)

* Refactor TestSubscriber fluent async builder

* Fix OutputStreamSourceSpec

* Skip racy tests

* Bump timeout value

* Modify build.fsx dotnet test to target the assembly dll directly instead of targetting the .csproj file (#5924)

* Convert Akka.Streams.Tests to async - Dsl.FutureFlattenSourceSpec (#5925)

* Convert Akka.Streams.Tests to async - Dsl.FutureFlattenSourceSpec

* Skip *.Tests.Performance NBench projects from test runs

* [Async TestKit] Convert Akka.Streams.Tests to async - ActorMaterializerSpec (#5916)

* Convert Akka.Streams.Tests to async - ActorMaterializerSpec

* Skip all of RestartSpec for now, suspected deadlock

* AutoDownSpec (#5937)

* Cluste_aware_router (#5933)

* Cluster Log Spec (#5938)

* Cluster Domain Even Publisher (#5939)

* SplitBrainResolverSpec (#5936)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Cluster Heater (#5940)

* Add async fluent builder feature to TestPublisher (#5934)

* Add async fluent builder feature to TestPublisher

* Revert build.fsx changes

* [Async TestKit] Convert Akka.Streams.Tests to async - TcpSpec (#5917)

* Convert Akka.Streams.Tests to async - TcpSpec

* Increase wait delay time

* Port akka/akka#26771

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* ExpectMsgAsync (#5932)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Convert Akka.Streams.Tests to async - Dsl.HubSpec (#5935)

Co-authored-by: Aaron Stannard <aaron@petabridge.com>

* Post-merge cleanup

* Update API verify list

* Post-merge fix and update API verify list

* Fix XML doc

* Post merge fix, docs

* Fix XML Doc

* Post merge fix

* Post merge fix

* Merge pull request #5954 from Arkatufus/feature/async_testkit

Merge `dev` into `feature/async_testkit`

Co-authored-by: Gregorius Soedharmo <gregorius.soedharmo@petabridge.com>
Co-authored-by: Ebere Abanonu <eaba@users.noreply.github.com>
Co-authored-by: Aaron Stannard <aaron@petabridge.com>
Co-authored-by: Ebere Abanonu <eabanonu@yahoo.com>
Co-authored-by: Ismael Hamed <1279846+ismaelhamed@users.noreply.github.com>
Co-authored-by: Drew <laingas@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adrian Leonhard <adrianleonhard@gmail.com>
Co-authored-by: Simon Cropp <simon.cropp@gmail.com>
Co-authored-by: zbynek001 <zbynek001@gmail.com>
  • Loading branch information
11 people authored May 23, 2022
1 parent 0e948db commit f4aadaf
Show file tree
Hide file tree
Showing 387 changed files with 12,085 additions and 7,661 deletions.
6 changes: 3 additions & 3 deletions build-system/azure-pipeline.template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
vmImage: ${{ parameters.vmImage }}
steps:
- task: UseDotNet@2
displayName: 'Use .NET 6 SDK 6.0.100'
displayName: 'Use .NET 6 SDK 6.0.201'
inputs:
version: 6.0.100
version: 6.0.201
- task: UseDotNet@2
displayName: 'Use .NET Core Runtime 3.1.10'
inputs:
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
displayName: 'Copy Build Output'
inputs:
sourceFolder: ${{ parameters.outputDirectory }}
contents: '**\*'
contents: '**'
targetFolder: $(Build.ArtifactStagingDirectory)
continueOnError: boolean # 'true' if future steps should run even if this step fails; defaults to 'false'
- task: PublishBuildArtifacts@1
Expand Down
29 changes: 20 additions & 9 deletions build-system/pr-validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
displayName: Windows Build
inputs:
filename: build.cmd
arguments: "buildRelease incremental" # Run an incremental build
arguments: buildRelease incremental targetBranch=feature/async_testkit # Run an incremental build
continueOnError: true
condition: eq( variables['Agent.OS'], 'Windows_NT' )
- task: CopyFiles@2
Expand All @@ -100,7 +100,7 @@ jobs:
displayName: ".NET Framework Unit Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: build.cmd
scriptArgs: runTests incremental
scriptArgs: runTests incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "netfx_tests_windows-$(Build.BuildId)"

Expand All @@ -110,7 +110,7 @@ jobs:
displayName: ".NET Core Unit Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: build.cmd
scriptArgs: runTestsNetCore incremental
scriptArgs: runTestsNetCore incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_core_tests_windows-$(Build.BuildId)"

Expand All @@ -120,10 +120,21 @@ jobs:
displayName: ".NET Core Unit Tests (Linux)"
vmImage: "ubuntu-18.04"
scriptFileName: "./build.sh"
scriptArgs: runTestsNetCore incremental
scriptArgs: runTestsNetCore incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_core_tests_linux-$(Build.BuildId)"

# - template: azure-pipeline.template.yaml
# parameters:
# name: "docfx_test"
# displayName: "DocFX warning check"
# vmImage: "windows-2019"
# scriptFileName: build.cmd
# scriptArgs: docfx
# outputDirectory: "TestResults"
# artifactName: "docfx_test-$(Build.BuildId)"
# run_if: eq(variables['Build.Reason'], 'PullRequest')

- template: azure-pipeline.template.yaml
parameters:
name: "docfx_test"
Expand All @@ -141,7 +152,7 @@ jobs:
displayName: ".NET 5 Unit Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: build.cmd
scriptArgs: runTestsNet incremental
scriptArgs: runTestsNet incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_5_tests_windows-$(Build.BuildId)"

Expand All @@ -151,7 +162,7 @@ jobs:
displayName: ".NET 5 Unit Tests (Linux)"
vmImage: "ubuntu-18.04"
scriptFileName: "./build.sh"
scriptArgs: runTestsNet incremental
scriptArgs: runTestsNet incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_5_tests_linux-$(Build.BuildId)"

Expand All @@ -161,7 +172,7 @@ jobs:
displayName: ".NET Core Multi-Node Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: "build.cmd"
scriptArgs: MultiNodeTestsNetCore incremental
scriptArgs: MultiNodeTestsNetCore incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_core_mntr_windows-$(Build.BuildId)"
mntrFailuresDir: 'TestResults\\multinode'
Expand All @@ -173,7 +184,7 @@ jobs:
displayName: ".NET 5 Multi-Node Tests (Windows)"
vmImage: "windows-2019"
scriptFileName: "build.cmd"
scriptArgs: MultiNodeTestsNet incremental
scriptArgs: MultiNodeTestsNet incremental targetBranch=feature/async_testkit
outputDirectory: "TestResults"
artifactName: "net_5_mntr_windows-$(Build.BuildId)"
mntrFailuresDir: 'TestResults\\multinode'
Expand All @@ -185,6 +196,6 @@ jobs:
displayName: "NuGet Pack"
vmImage: "windows-2019"
scriptFileName: build.cmd
scriptArgs: CreateNuget nugetprerelease=dev incremental
scriptArgs: CreateNuget nugetprerelease=dev incremental targetBranch=feature/async_testkit
outputDirectory: "bin/nuget"
artifactName: "nuget_pack-$(Build.BuildId)"
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ public CoordinatedShutdownShardingSpec(ITestOutputHelper helper) : base(SpecConf
});
}

protected override void BeforeTermination()
protected override async Task AfterAllAsync()
{
Shutdown(_sys1);
Shutdown(_sys2);
await base.AfterAllAsync();
await ShutdownAsync(_sys1);
await ShutdownAsync(_sys2);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Tools.Singleton;
using Akka.Configuration;
Expand Down Expand Up @@ -93,9 +94,13 @@ public ShardRegionSpec(ITestOutputHelper helper) : base(SpecConfig, helper)
region2 = StartShard(sysB);
}

protected override void BeforeTermination()
protected override async Task AfterAllAsync()
{
Shutdown(sysB);
if(sysA != null)
await ShutdownAsync(sysA);
if(sysB != null)
await ShutdownAsync(sysB);
await base.AfterAllAsync();
}

private IActorRef StartShard(ActorSystem sys)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using System.Collections.Immutable;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Tools.Singleton;
using Akka.Configuration;
Expand Down Expand Up @@ -96,45 +97,46 @@ public void Join(ActorSystem from, ActorSystem to, IActorRef probe)
}

[Fact]
public void ClusterSingleton_that_is_leaving_must()
public async Task ClusterSingleton_that_is_leaving_must()
{
ClusterSingleton_that_is_leaving_must_join_cluster();
ClusterSingleton_that_is_leaving_must_quickly_hand_over_to_next_oldest();
await ClusterSingleton_that_is_leaving_must_join_cluster();
await ClusterSingleton_that_is_leaving_must_quickly_hand_over_to_next_oldest();
}

private void ClusterSingleton_that_is_leaving_must_join_cluster()
private async Task ClusterSingleton_that_is_leaving_must_join_cluster()
{
for (int i = 0; i < _systems.Length; i++)
for (var i = 0; i < _systems.Length; i++)
Join(_systems[i], _systems[0], _probes[i]);

// leader is most likely on system, lowest port
Join(Sys, _systems[0], TestActor);

_probes[0].ExpectMsg("started");
await _probes[0].ExpectMsgAsync("started");
}

private void ClusterSingleton_that_is_leaving_must_quickly_hand_over_to_next_oldest()
private async Task ClusterSingleton_that_is_leaving_must_quickly_hand_over_to_next_oldest()
{
var durations = new List<(TimeSpan stoppedDuration, TimeSpan startDuration)>();
var sw = new Stopwatch();
sw.Start();
for (var i = 0; i < _systems.Length; i++)
{
var leaveAddress = Cluster.Get(_systems[i]).SelfAddress;
CoordinatedShutdown.Get(_systems[i]).Run(CoordinatedShutdown.ClusterLeavingReason.Instance);
_probes[i].ExpectMsg("stopped", TimeSpan.FromSeconds(10));
await CoordinatedShutdown.Get(_systems[i]).Run(CoordinatedShutdown.ClusterLeavingReason.Instance);

await _probes[i].ExpectMsgAsync("stopped", TimeSpan.FromSeconds(10));
var stoppedDuration = sw.Elapsed;

if (i != _systems.Length - 1)
_probes[i + 1].ExpectMsg("started", TimeSpan.FromSeconds(30));
await _probes[i + 1].ExpectMsgAsync("started", TimeSpan.FromSeconds(30));
else
ExpectMsg("started", TimeSpan.FromSeconds(30));
await ExpectMsgAsync("started", TimeSpan.FromSeconds(30));

var startedDuration = sw.Elapsed;

Within(TimeSpan.FromSeconds(15), () =>
await WithinAsync(TimeSpan.FromSeconds(15), async () =>
{
AwaitAssert(() =>
await AwaitAssertAsync(() =>
{
Cluster.Get(_systems[i]).IsTerminated.Should().BeTrue();
Cluster.Get(Sys).State.Members.Select(m => m.Address).Should().NotContain(leaveAddress);
Expand All @@ -158,10 +160,11 @@ private void ClusterSingleton_that_is_leaving_must_quickly_hand_over_to_next_old
}
}

protected override void AfterTermination()
protected override async Task AfterAllAsync()
{
await base.AfterAllAsync();
foreach (var s in _systems)
Shutdown(s);
await ShutdownAsync(s);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,14 @@ public void Restarting_cluster_node_during_hand_over_must_restart_singletons_in_
});
}

protected override void AfterTermination()
protected override async Task AfterAllAsync()
{
Shutdown(_sys1);
Shutdown(_sys2);
Shutdown(_sys3);
await base.AfterAllAsync();
await ShutdownAsync(_sys1);
await ShutdownAsync(_sys2);
await ShutdownAsync(_sys3);
if (_sys4 != null)
Shutdown(_sys4);
await ShutdownAsync(_sys4);
}

public class Singleton : ReceiveActor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System;
using System.Collections.Immutable;
using System.Linq;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Cluster.Tools.Singleton;
using Akka.Configuration;
Expand Down Expand Up @@ -128,12 +129,13 @@ public void Restarting_cluster_node_with_same_hostname_and_port_must_handover_to
});
}

protected override void AfterTermination()
protected override async Task AfterAllAsync()
{
Shutdown(_sys1);
Shutdown(_sys2);
await base.AfterAllAsync();
await ShutdownAsync(_sys1);
await ShutdownAsync(_sys2);
if(_sys3 != null)
Shutdown(_sys3);
await ShutdownAsync(_sys3);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,11 @@ public void Pruning_of_CRDT_should_move_data_from_removed_node()
void UpdateAfterPruning(ulong expectedValue)
{
// inject data from removed node to simulate bad data
_replicator.Tell(Dsl.Update(_keyA, GCounter.Empty, new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster, 1)));
ExpectMsg<UpdateSuccess>(msg =>
_replicator.Tell(Dsl.Update(_keyA, GCounter.Empty,
new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster, 1)));
ExpectMsg<UpdateSuccess>();

AwaitAssert(() =>
{
_replicator.Tell(Dsl.Get(_keyA, ReadLocal.Instance));
var retrieved = ExpectMsg<GetSuccess>().Get(_keyA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,11 +645,12 @@ await _replicator1.Ask<UpdateSuccess>(Dsl.Update(
node3EntriesBCA["A"].Should().BeEquivalentTo(entryA1);
}

protected override void BeforeTermination()
protected override async Task AfterAllAsync()
{
Shutdown(_sys1);
Shutdown(_sys2);
Shutdown(_sys3);
await base.AfterAllAsync();
await ShutdownAsync(_sys1);
await ShutdownAsync(_sys2);
await ShutdownAsync(_sys3);
GC.Collect();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ public class Bugfix4360Spec : Akka.TestKit.Xunit2.TestKit
{
public static Config TestConf = @"
akka.persistence {
journal {
plugin = ""akka.persistence.journal.sqlite""
sqlite {
class = ""Akka.Persistence.Sqlite.Journal.SqliteJournal, Akka.Persistence.Sqlite""
plugin-dispatcher = ""akka.actor.default-dispatcher""
connection-string = ""DataSource=AkkaJournalfxR16.db""
connection-timeout = 25s
table-name = event_journal
auto-initialize = on
}
}
snapshot-store {
plugin = ""akka.persistence.snapshot-store.sqlite""
sqlite {
class = ""Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence.Sqlite""
plugin-dispatcher = ""akka.actor.default-dispatcher""
connection-string = ""DataSource=AkkaSnapShotfxR16.db""
connection-timeout = 25s
table-name = snapshot_store
auto-initialize = on
}
}
#end persistence
}}";
journal {
plugin = ""akka.persistence.journal.sqlite""
sqlite {
class = ""Akka.Persistence.Sqlite.Journal.SqliteJournal, Akka.Persistence.Sqlite""
plugin-dispatcher = ""akka.actor.default-dispatcher""
connection-string = ""DataSource=AkkaJournalfxR16.db""
connection-timeout = 25s
table-name = event_journal
auto-initialize = on
}
}
snapshot-store {
plugin = ""akka.persistence.snapshot-store.sqlite""
sqlite {
class = ""Akka.Persistence.Sqlite.Snapshot.SqliteSnapshotStore, Akka.Persistence.Sqlite""
plugin-dispatcher = ""akka.actor.default-dispatcher""
connection-string = ""DataSource=AkkaSnapShotfxR16.db""
connection-timeout = 25s
table-name = snapshot_store
auto-initialize = on
}
}
#end persistence
}";

private class RecoverActor : UntypedPersistentActor
{
Expand Down Expand Up @@ -129,7 +129,7 @@ public void Should_recover_persistentactor_sqlite()
recoveryActor.Tell("foo");
recoveryActor.Tell("bar");
recoveryActor.Tell(RecoverActor.DoSnapshot.Instance);
ExpectMsgAllOf("foo", "bar");
ExpectMsgAllOf(new []{ "foo", "bar" });
ExpectMsg<SaveSnapshotSuccess>();

Watch(recoveryActor);
Expand Down
4 changes: 2 additions & 2 deletions src/contrib/testkits/Akka.TestKit.Xunit/TestKit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ public TestKit(string config, ITestOutputHelper output = null)
/// This method is called when a test ends.
///
/// <remarks>
/// If you override this, then make sure you either call base.AfterTest() or
/// <see cref="TestKitBase.Shutdown(TimeSpan?,bool)">TestKitBase.Shutdown</see>
/// If you override this, then make sure you either call <c>base.AfterTest()</c> or
/// <c>TestKitBase.Shutdown</c>
/// to shut down the system. Otherwise a memory leak will occur.
/// </remarks>
/// </summary>
Expand Down
Loading

0 comments on commit f4aadaf

Please sign in to comment.