mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 10:25:15 +00:00
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;
|
package org.elasticsearch.smoketest;
|
||||||
|
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
|
||||||
import org.elasticsearch.xpack.watcher.WatcherYamlSuiteTestCase;
|
import org.elasticsearch.xpack.watcher.WatcherYamlSuiteTestCase;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the YAML rest tests against an external cluster
|
* 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 class WatcherYamlRestIT extends WatcherYamlSuiteTestCase {
|
||||||
public WatcherYamlRestIT(ClientYamlTestCandidate testCandidate) {
|
public WatcherYamlRestIT(ClientYamlTestCandidate testCandidate) {
|
||||||
super(testCandidate);
|
super(testCandidate);
|
||||||
|
@ -14,11 +14,11 @@ import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
|
|||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static java.util.Collections.emptyList;
|
import static java.util.Collections.emptyList;
|
||||||
import static java.util.Collections.emptyMap;
|
import static java.util.Collections.emptyMap;
|
||||||
import static org.hamcrest.Matchers.equalTo;
|
|
||||||
import static org.hamcrest.Matchers.is;
|
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");
|
throw new AssertionError("waiting until starting state reached started state");
|
||||||
case "started":
|
case "started":
|
||||||
int watcherCount = (int) response.evaluate("stats.0.watch_count");
|
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
|
// all good here, we are done
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -88,7 +91,10 @@ public abstract class WatcherYamlSuiteTestCase extends ESClientYamlSuiteTestCase
|
|||||||
throw new AssertionError("unknown state[" + state + "]");
|
throw new AssertionError("unknown state[" + state + "]");
|
||||||
}
|
}
|
||||||
}, 60, TimeUnit.SECONDS);
|
}, 60, TimeUnit.SECONDS);
|
||||||
|
deleteWatcherIndices();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void deleteWatcherIndices() throws IOException {
|
||||||
Request deleteWatchesIndexRequest = new Request("DELETE", ".watches");
|
Request deleteWatchesIndexRequest = new Request("DELETE", ".watches");
|
||||||
deleteWatchesIndexRequest.addParameter("ignore_unavailable", "true");
|
deleteWatchesIndexRequest.addParameter("ignore_unavailable", "true");
|
||||||
adminClient().performRequest(deleteWatchesIndexRequest);
|
adminClient().performRequest(deleteWatchesIndexRequest);
|
||||||
|
@ -7,7 +7,6 @@ package org.elasticsearch.smoketest;
|
|||||||
|
|
||||||
import com.carrotsearch.randomizedtesting.annotations.Name;
|
import com.carrotsearch.randomizedtesting.annotations.Name;
|
||||||
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
import com.carrotsearch.randomizedtesting.annotations.ParametersFactory;
|
||||||
import org.apache.lucene.util.LuceneTestCase;
|
|
||||||
import org.elasticsearch.client.Request;
|
import org.elasticsearch.client.Request;
|
||||||
import org.elasticsearch.common.settings.SecureString;
|
import org.elasticsearch.common.settings.SecureString;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
@ -19,7 +18,6 @@ import org.junit.Before;
|
|||||||
|
|
||||||
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
import static org.elasticsearch.xpack.test.SecuritySettingsSourceField.basicAuthHeaderValue;
|
||||||
|
|
||||||
@LuceneTestCase.AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53177")
|
|
||||||
public class SmokeTestWatcherWithSecurityClientYamlTestSuiteIT extends WatcherYamlSuiteTestCase {
|
public class SmokeTestWatcherWithSecurityClientYamlTestSuiteIT extends WatcherYamlSuiteTestCase {
|
||||||
|
|
||||||
private static final String TEST_ADMIN_USERNAME = "test_admin";
|
private static final String TEST_ADMIN_USERNAME = "test_admin";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user