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

Skip attribute on MultiNodeFact does not work #1088

Closed
Aaronontheweb opened this issue Jun 23, 2015 · 12 comments
Closed

Skip attribute on MultiNodeFact does not work #1088

Aaronontheweb opened this issue Jun 23, 2015 · 12 comments

Comments

@Aaronontheweb
Copy link
Member

Still ran the tests I wanted to skip :\

image

@schatekar
Copy link
Contributor

@Aaronontheweb looking at the source for MultiNodeFact below.

This is returning null from skip if the test is run using MultiNodeTestRunner or NodeTestRunner. I am not sure if XUnit treats a null Skip value as test not to be skipped or not but if I assume that then clearly any test run using MultiNodeTestRunner would never be skipped, isn't it?

    public class MultiNodeFactAttribute : FactAttribute
    {
        public static Lazy<bool> ExecutedByMultiNodeRunner =
            new Lazy<bool>(() =>
            {
                var args = Environment.GetCommandLineArgs();
                if (args.Length == 0) return false;
                var firstArg = args[0];
                return firstArg.Contains("Akka.MultiNodeTestRunner") 
                    || firstArg.Contains("Akka.NodeTestRunner");
            });

        public override string Skip
        {
            get
            {
                return ExecutedByMultiNodeRunner.Value
                    ? null
                    : "Must be executed by multi-node test runner";
            }
            set { base.Skip = value; }
        }
    }

@cpx86
Copy link
Contributor

cpx86 commented Aug 6, 2015

Just started looking at this as well :) @schatekar, a null value means test should be run, and non-null means it should be skipped.

@schatekar
Copy link
Contributor

I think I know how to fix this. If you are not fixing it I can take a crack
at it in few hours.
On 6 Aug 2015 18:54, "Christian Palmstierna" notifications@github.com
wrote:

Just started looking at this as well :) @schatekar
https://github.com/schatekar, a null value means test should be run,
and non-null means it should be skipped.


Reply to this email directly or view it on GitHub
#1088 (comment)
.

@cpx86
Copy link
Contributor

cpx86 commented Aug 6, 2015

It's all yours :)

@Aaronontheweb
Copy link
Member Author

You guys are awesome :)

@schatekar
Copy link
Contributor

This is more involved than I had imagined. I would give it another try over the weekend.

@Aaronontheweb
Copy link
Member Author

This is more involved than I had imagined. I would give it another try over the weekend.

I know that feeling well, my friend.

@barambani
Copy link

I gave a try to this as well, I guess because is less intimidating than the others :), it looks like that removing the null is not enough. I could get the runner to skip the multinode facts checking the attribute in the OnMessage of the Akka.MultiNodeTestRunner.Discovery. It looks like that the discovery process completely ignores the Skip (overridden or not).
I'm not sure though if this is the best solution so I would like to discuss it with you guys. I will create a pull request and will be very happy to get any suggestions from you.

@schatekar
Copy link
Contributor

@barambani I did not get a message that you have worked on the issue as well. I just went ahead and submitted my fix without knowing that you too have submitted a fix.

@barambani
Copy link

@schatekar no problem, I will close mine.

@schatekar
Copy link
Contributor

@barambani Don't close yours just yet. I would leave it to the project leads to accept the best PR

@barambani
Copy link

@schatekar I looked at your solution and passes all the tests, also brings the skip reason up to the top level to log it. I like it more than mine as well. Mine was a late night hack.

rogeralsing added a commit that referenced this issue Aug 8, 2015
#1088 MultiNode tests can now be skipped by specifying a SkipReason
MAOliver pushed a commit to MAOliver/akka.net that referenced this issue Aug 9, 2015
@Aaronontheweb Aaronontheweb removed this from the Akka.NET v1.1 milestone Jun 7, 2016
@Aaronontheweb Aaronontheweb removed this from the Akka.NET v1.1 milestone Jun 7, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants