Re: Create JUnit Rules instead of extending other test classes

2017-02-16 Thread Kirk Lund
It's possible this might be caused by a bug in Gradle's JUnit task which is
how Jenkins is running this test. The test method is skipped as expected
when run in IntelliJ.

On Thu, Feb 16, 2017 at 2:17 PM, Kirk Lund  wrote:

> LocatorUDPSecurityDUnitTest extends LocatorDUnitTest.
>
> LocatorDUnitTest has a test named 
> testSSLEnabledLocatorDiesWhenConnectingToNonSSLLocator
> which is currently annotated with @Ignore.
>
> Despite the test being marked with @Ignore, apparently the test still gets
> executed by LocatorUDPSecurityDUnitTest. See last night's Geode Nightly
> Build in which this test failed:
>
> https://builds.apache.org/job/Geode-nightly/750/testReport/
> junit/org.apache.geode.distributed/LocatorUDPSecurityDUnitTest/
> testNonSSLLocatorDiesWhenConnectingToSSLLocator/
>
> I recommend we avoid extending other tests. If you have some
> setup/teardown that you really want to reuse in multiple tests then create
> a custom JUnit rule. Or very carefully put the body of the test in a
> non-test class that is not annotated with JUnit annotations and then have
> two different tests both invoke code in the non-test class -- I would
> recommend avoiding this approach in general to avoid creating spaghetti or
> having multiple tests repeating the same end-to-end code with slight
> variations to config which redundantly extends the run time of precheckin.
>
> I think the only way to get LocatorUDPSecurityDUnitTest to not run the
> @Ignored test is to @Override the test method AND add its own @Ignore
> annotation.
>
> This could be a bug in JUnit, but we're already using JUnit 4.12 which is
> the latest release.
>
> -Kirk
>
>


Create JUnit Rules instead of extending other test classes

2017-02-16 Thread Kirk Lund
LocatorUDPSecurityDUnitTest extends LocatorDUnitTest.

LocatorDUnitTest has a test named
testSSLEnabledLocatorDiesWhenConnectingToNonSSLLocator which is currently
annotated with @Ignore.

Despite the test being marked with @Ignore, apparently the test still gets
executed by LocatorUDPSecurityDUnitTest. See last night's Geode Nightly
Build in which this test failed:

https://builds.apache.org/job/Geode-nightly/750/testReport/junit/org.apache.geode.distributed/LocatorUDPSecurityDUnitTest/testNonSSLLocatorDiesWhenConnectingToSSLLocator/

I recommend we avoid extending other tests. If you have some setup/teardown
that you really want to reuse in multiple tests then create a custom JUnit
rule. Or very carefully put the body of the test in a non-test class that
is not annotated with JUnit annotations and then have two different tests
both invoke code in the non-test class -- I would recommend avoiding this
approach in general to avoid creating spaghetti or having multiple tests
repeating the same end-to-end code with slight variations to config which
redundantly extends the run time of precheckin.

I think the only way to get LocatorUDPSecurityDUnitTest to not run the
@Ignored test is to @Override the test method AND add its own @Ignore
annotation.

This could be a bug in JUnit, but we're already using JUnit 4.12 which is
the latest release.

-Kirk