Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Fix/44 ActorSystem lifecycle #56

Merged
merged 3 commits into from
Jul 22, 2022

Conversation

Aaronontheweb
Copy link
Member

@Aaronontheweb Aaronontheweb commented Jul 21, 2022

Fixes #44

Changes

Removed all of the old hacks we needed to do in order to make the NUnit testkit behave like the xUnit test kit (to provide isolated ActorSystems on each test.)

Checklist

For significant changes, please ensure that the following have been completed (delete if not relevant):

cc @mchandschuh

Copy link
Member Author

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed my own changes

namespace Akka.TestKit.NUnit.Tests;

[TestFixture]
public class Bugfix44Spec : TestKit
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repro spec for #44

@@ -23,7 +23,6 @@ public class TestKit : TestKitBase, IDisposable
private static readonly NUnitAssertions _assertions = new NUnitAssertions();
private readonly Config _config;
private readonly string _actorSystemName;
private bool _isFirstRun = true;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer needed

@@ -35,8 +34,6 @@ public class TestKit : TestKitBase, IDisposable
public TestKit(ActorSystem system = null)
: base(_assertions, system)
{
if(system != null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove code bomb

/// creating and setting up the ActorSystem.
/// </summary>
[SetUp]
public void InitializeActorSystemOnSetUp()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setup no longer needed now that this can be done from ActorSystem constructor.

@mchandschuh
Copy link

@Aaronontheweb -- any estimate on this being merged/released?

@Aaronontheweb
Copy link
Member Author

@mchandschuh I was just waiting for your approval. Now that it's done I can push it any time.

@Aaronontheweb Aaronontheweb enabled auto-merge (squash) July 22, 2022 21:41
@Aaronontheweb Aaronontheweb merged commit 1320e27 into akkadotnet:dev Jul 22, 2022
@mchandschuh
Copy link

mchandschuh commented Jul 26, 2022

@Aaronontheweb -- I was expecting a new Akka.TestKit.NUnit3 version but only see the new version of Akka.TestKit.Nunit -- do I need to switch dependencies? I never really understood the difference between the two.

@mchandschuh
Copy link

mchandschuh commented Jul 27, 2022

@Aaronontheweb @eaba -- thanks guys! This was successfully integrated!

As a note -- any [OneTimeSetUp] and [OneTimeTearDown] methods must now be defined as static -- enforced by nunit.

@Aaronontheweb Aaronontheweb deleted the fix/44-lifecycle branch July 27, 2022 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support specifying an ActorSystem when [FixtureLifeCycle(LifeCycle.InstancePerTestCase)] is specified
2 participants