Skip to content

Commit

Permalink
un-mute ActivateWatchTests, bump up logging, and remove explicit slee…
Browse files Browse the repository at this point in the history
…ps (#42396)
  • Loading branch information
jakelandis authored May 29, 2019
1 parent 5e0a162 commit 590c7d1
Showing 1 changed file with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;

@TestLogging("org.elasticsearch.xpack.watcher:DEBUG,org.elasticsearch.xpack.watcher.WatcherIndexingListener:TRACE")
@TestLogging("org.elasticsearch.xpack.watcher:DEBUG,org.elasticsearch.xpack.core.watcher:DEBUG," +
"org.elasticsearch.xpack.watcher.WatcherIndexingListener:TRACE")
public class ActivateWatchTests extends AbstractWatcherIntegrationTestCase {

@Override
protected boolean timeWarped() {
return false;
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/30699")
public void testDeactivateAndActivate() throws Exception {
PutWatchResponse putWatchResponse = watcherClient().preparePutWatch()
.setId("_id")
Expand Down Expand Up @@ -88,13 +88,9 @@ public void testDeactivateAndActivate() throws Exception {
refresh();
long count1 = docCount(".watcher-history*", matchAllQuery());

logger.info("Sleeping for 5 seconds, watch history count [{}]", count1);
Thread.sleep(5000);

refresh();
long count2 = docCount(".watcher-history*", matchAllQuery());

assertThat(count2, is(count1));
//ensure no new watch history
awaitBusy(() -> count1 != docCount(".watcher-history*", matchAllQuery()), 5, TimeUnit.SECONDS);

// lets activate it again
logger.info("Activating watch again");
Expand All @@ -107,11 +103,11 @@ public void testDeactivateAndActivate() throws Exception {
assertThat(getWatchResponse, notNullValue());
assertThat(getWatchResponse.getStatus().state().isActive(), is(true));

logger.info("Sleeping for another five seconds, ensuring that watch is executed");
Thread.sleep(5000);
refresh();
long count3 = docCount(".watcher-history*", matchAllQuery());
assertThat(count3, greaterThan(count1));
assertBusy(() -> {
long count2 = docCount(".watcher-history*", matchAllQuery());
assertThat(count2, greaterThan(count1));
});
}

public void testLoadWatchWithoutAState() throws Exception {
Expand Down

0 comments on commit 590c7d1

Please sign in to comment.