Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@
*/
package org.elasticsearch.smoketest;

import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
import org.elasticsearch.xpack.watcher.WatcherYamlSuiteTestCase;

/**
* Runs the YAML rest tests against an external cluster
*/
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53177")
public class WatcherYamlRestIT extends WatcherYamlSuiteTestCase {
public WatcherYamlRestIT(ClientYamlTestCandidate testCandidate) {
super(testCandidate);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
import org.junit.After;
import org.junit.Before;

import java.io.IOException;
import java.util.concurrent.TimeUnit;

import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

/**
Expand Down Expand Up @@ -54,7 +54,10 @@ public final void startWatcher() throws Exception {
throw new AssertionError("waiting until starting state reached started state");
case "started":
int watcherCount = (int) response.evaluate("stats.0.watch_count");
assertThat(watcherCount, equalTo(0));
if (watcherCount > 0) {
logger.info("expected 0 active watches, but got [{}], deleting watcher indices again", watcherCount);
deleteWatcherIndices();
}
// all good here, we are done
break;
default:
Expand Down Expand Up @@ -88,7 +91,10 @@ public final void stopWatcher() throws Exception {
throw new AssertionError("unknown state[" + state + "]");
}
}, 60, TimeUnit.SECONDS);
deleteWatcherIndices();
}

private static void deleteWatcherIndices() throws IOException {
Request deleteWatchesIndexRequest = new Request("DELETE", ".watches");
deleteWatchesIndexRequest.addParameter("ignore_unavailable", "true");
adminClient().performRequest(deleteWatchesIndexRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.carrotsearch.randomizedtesting.annotations.Name;
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
import org.apache.lucene.util.LuceneTestCase;
import org.elasticsearch.client.Request;
import org.elasticsearch.common.settings.SecureString;
import org.elasticsearch.common.settings.Settings;
Expand All @@ -19,7 +18,6 @@

import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;

@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53177")
public class SmokeTestWatcherWithSecurityClientYamlTestSuiteIT extends WatcherYamlSuiteTestCase {

private static final String TEST_ADMIN_USERNAME = "test_admin";
Expand Down