Skip to content

Commit 06763fa

Browse files
Adding retries (#135554)
1 parent ed80dba commit 06763fa

File tree

4 files changed

+19
-15
lines changed

4 files changed

+19
-15
lines changed

muted-tests.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,6 @@ tests:
7373
- class: org.elasticsearch.xpack.apmdata.APMYamlTestSuiteIT
7474
method: test {yaml=/10_apm/Test template reinstallation}
7575
issue: https://github.com/elastic/elasticsearch/issues/116445
76-
- class: org.elasticsearch.xpack.inference.InferenceRestIT
77-
method: test {p0=inference/40_semantic_text_query/Query a field that uses the default ELSER 2 endpoint}
78-
issue: https://github.com/elastic/elasticsearch/issues/117027
79-
- class: org.elasticsearch.xpack.inference.InferenceRestIT
80-
method: test {p0=inference/30_semantic_text_inference/Calculates embeddings using the default ELSER 2 endpoint}
81-
issue: https://github.com/elastic/elasticsearch/issues/117349
82-
- class: org.elasticsearch.xpack.inference.InferenceRestIT
83-
method: test {p0=inference/30_semantic_text_inference_bwc/Calculates embeddings using the default ELSER 2 endpoint}
84-
issue: https://github.com/elastic/elasticsearch/issues/117349
8576
- class: org.elasticsearch.xpack.test.rest.XPackRestIT
8677
method: test {p0=transform/transforms_reset/Test reset running transform}
8778
issue: https://github.com/elastic/elasticsearch/issues/117473
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/*
22
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3-
* or more contributor license agreements. Licensed under the Elastic License
4-
* 2.0; you may not use this file except in compliance with the Elastic License
5-
* 2.0.
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
68
*/
79

8-
package org.elasticsearch.xpack.inference;
10+
package org.elasticsearch.test;
911

1012
import org.apache.logging.log4j.LogManager;
1113
import org.apache.logging.log4j.Logger;
@@ -25,7 +27,6 @@
2527
* <br/>
2628
* <code>public RetryRule retry = new RetryRule(3, TimeValue.timeValueSeconds(1));</code>
2729
* <br/>
28-
* See {@link InferenceGetServicesIT#retry} for an example.
2930
*/
3031
public class RetryRule implements TestRule {
3132
private static final Logger logger = LogManager.getLogger(RetryRule.class);

x-pack/plugin/inference/qa/inference-service-tests/src/javaRestTest/java/org/elasticsearch/xpack/inference/BaseMockEISAuthServerTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import org.elasticsearch.common.settings.Settings;
1414
import org.elasticsearch.common.util.concurrent.ThreadContext;
1515
import org.elasticsearch.core.TimeValue;
16+
import org.elasticsearch.test.RetryRule;
1617
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1718
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
1819
import org.elasticsearch.test.rest.ESRestTestCase;
@@ -54,7 +55,7 @@ public class BaseMockEISAuthServerTest extends ESRestTestCase {
5455

5556
// The reason we're retrying is there's a race condition between the node retrieving the
5657
// authorization response and running the test. Retrieving the authorization should be very fast since
57-
// we're hosting a local mock server but it's possible it could respond slower. So in the even of a test failure
58+
// we're hosting a local mock server but it's possible it could respond slower. So in the event of a test failure
5859
// we'll automatically retry after waiting a second.
5960
// Note: @Rule is executed for each test
6061
@Rule

x-pack/plugin/inference/src/yamlRestTest/java/org/elasticsearch/xpack/inference/InferenceRestIT.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@
1212
import org.elasticsearch.client.Request;
1313
import org.elasticsearch.common.Strings;
1414
import org.elasticsearch.common.settings.Settings;
15+
import org.elasticsearch.core.TimeValue;
16+
import org.elasticsearch.test.RetryRule;
1517
import org.elasticsearch.test.cluster.ElasticsearchCluster;
1618
import org.elasticsearch.test.cluster.FeatureFlag;
1719
import org.elasticsearch.test.cluster.local.distribution.DistributionType;
1820
import org.elasticsearch.test.rest.yaml.ClientYamlTestCandidate;
1921
import org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase;
2022
import org.junit.After;
2123
import org.junit.ClassRule;
24+
import org.junit.Rule;
2225

2326
import java.io.IOException;
2427
import java.util.List;
@@ -37,6 +40,14 @@ public class InferenceRestIT extends ESClientYamlSuiteTestCase {
3740
.distribution(DistributionType.DEFAULT)
3841
.build();
3942

43+
/**
44+
* This will retry a failed test up to 3 times with a 1 second wait between retries. We've observed transient network
45+
* failures when trying to download the elser model during the test. These network failure cause the tests to fail intermittently.
46+
* The proper way to fix this would be to add retry logic to the download code but that is a larger fix.
47+
*/
48+
@Rule
49+
public RetryRule retryRule = new RetryRule(3, TimeValue.timeValueSeconds(1));
50+
4051
public InferenceRestIT(final ClientYamlTestCandidate testCandidate) {
4152
super(testCandidate);
4253
}

0 commit comments

Comments
 (0)