Reenable watcher rest tests (#53532)
Also log a message instead of failing if there are active watches at a beginning of a test. Relates to #53177
This commit is contained in:
parent
7e82a4f78c
commit
3b9545848f
|
@ -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);
|
||||
|
|
|
@ -14,11 +14,11 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
|||
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;
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,10 @@ public abstract class WatcherYamlSuiteTestCase extends ESClientYamlSuiteTestCase
|
|||
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:
|
||||
|
@ -88,7 +91,10 @@ public abstract class WatcherYamlSuiteTestCase extends ESClientYamlSuiteTestCase
|
|||
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);
|
||||
|
|
|
@ -7,7 +7,6 @@ package org.elasticsearch.smoketest;
|
|||
|
||||
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;
|
||||
|
@ -19,7 +18,6 @@ import org.junit.Before;
|
|||
|
||||
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";
|
||||
|
|
Loading…
Reference in New Issue