geode-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kirk Lund <kl...@apache.org>
Subject Fixing Awaitility await().untilAsserted(new WaitCriterion
Date Thu, 11 Apr 2019 19:02:04 GMT
Just a quick heads up... I'm seeing an Awaitility usage pattern that is
broken and does nothing. Specifically, it's any uses of dunit WaitCriterion
with untilAsserted:

      GeodeAwaitility.*await().untilAsserted(new WaitCriterion*() {

        @Override
        public boolean done() {
          return region.isDestroyed();
        }

        @Override
        public String description() {
          return "Region was not destroyed : " + region.isDestroyed();
        }
      });

The above is broken. It will not await anything. Invoking "new
WaitCriterion()" will not throw anything so untilAsserted returns
immediately. This may cause some flaky tests to be flakier because we're no
longer waiting for the WaitCriterion done to be true.

To fix this, just change it to use await().until with a lambda containing
the contents of done():

      GeodeAwaitility.*await().until(() -> *region.isDestroyed());

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message