Quite a few Geode tests already use Rules including TemporaryFolder.

I do like the idea of repackaging some of our re-used testing components as
Rules. Some of our testing utilities would make ideal candidates for
repackaging as Rules include:

* IgnoredException
* AvailablePortHelper
* DistributedTestUtils.deleteLocatorStateFile

We already have a few custom Rules in the Geode codebase that have been
tweaked specially for use in dunit tests:

* DistributedRestoreSystemProperties (restores System properties across
every dunit VM)
* DistributedDisconnectRule (similar to disconnectAllFromDS but repackaged
as a Rule)
* DistributedExternalResource (similar to ExternalResource but applies to
every dunit VM)
* SerializableRuleList
* SerializableTemporaryFolder (extends a TemporaryFolder Rule to work
across every dunit VM)
* SerializableTestName (serializable so that all dunit VMs see the TestName)
* SerializableTimeout (serializable version of our own Timeout Rule)

-Kirk


On Fri, Jul 29, 2016 at 2:35 PM, William Markito <wmark...@pivotal.io>
wrote:

> Why not create a JUnit rule that returns available ports and keep track of
> ports being used ?
>
> I've cloned this gist from somewhere (don't remember now) but I've planning
> to send it for discussion...
>
> https://gist.github.com/markito/b5be3fc570c7c7c84e6d09e064a6e898
>
> Still talking about rules, I've played a bit with the TemporaryFolder rule
> and that's very useful as well, specially to clean up after test runs and
> to avoid conflicts.
>
> http://junit.org/junit4/javadoc/4.12/org/junit/rules/TemporaryFolder.html
>
> Just my 2c
>
> On Fri, Jul 29, 2016 at 1:54 PM, Hitesh Khamesra <
> hitesh...@yahoo.com.invalid> wrote:
>
> > Is there any possibility of running multiple test same time on that
> > machine?
> >
> > -Hitesh
> >
> >
> >       From: Kirk Lund <kl...@pivotal.io>
> >  To: geode <dev@geode.incubator.apache.org>
> >  Sent: Friday, July 29, 2016 1:21 PM
> >  Subject: Flaky tests failing with BindException
> >
> > Many of our flaky tests are flaky because they use AvailablePort or
> > AvailablePortHelper to find randomly available ports. They then later
> fail
> > with a BindException because the port is already in use by the time the
> > test uses it.
> >
> > Here's a proposal for a temporary fix:
> >
> > The module geode-junit contains a JUnit 4 rule called RetryRule. We could
> > modify RetryRule to only retry if a BindException (or configurable
> > exception/s) is detected. This rule would then be dropped into every test
> > that uses AvailablePort or AvailablePortHelper. Then if the test fails
> with
> > a BindException, it would automatically retry (once or twice or whatever
> we
> > decide to configure RetryRule with). If the test fails without any
> detected
> > BindException, then it would just fail without retrying.
> >
> > Opinions on this?
> >
> > Thanks,
> > Kirk
> >
> >
> >
> >
>
>
>
> --
>
> ~/William
>

Reply via email to