Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI] Failure in monitoring/bulk/* #30101

Closed
elasticmachine opened this issue Sep 21, 2017 · 14 comments
Closed

[CI] Failure in monitoring/bulk/* #30101

elasticmachine opened this issue Sep 21, 2017 · 14 comments
Labels
:Data Management/Monitoring Team:Data Management Meta label for data/management team >test-failure Triaged test failures from CI

Comments

@elasticmachine
Copy link
Collaborator

Original comment by @droberts195:

This test failed in LINK REDACTED

The error was:

06:19:45 FAILURE 6.05s | XPackRestIT.test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data} <<< FAILURES!
06:19:45    > Throwable LINK REDACTED: java.lang.AssertionError: Failure at [monitoring/bulk/10_basic:37]: hits.total didn't match expected value:
06:19:45    >                     hits.total: expected [2] but was [0]
06:19:45    > 	at __randomizedtesting.SeedInfo.seed([3D072CE274957D04:B5531338DA6910FC]:0)
06:19:45    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:349)
06:19:45    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.test(ESClientYamlSuiteTestCase.java:329)
06:19:45    > 	at java.lang.Thread.run(Thread.java:748)
06:19:45    > Caused by: java.lang.AssertionError: hits.total didn't match expected value:
06:19:45    >                     hits.total: expected [2] but was [0]
06:19:45    > 	at org.elasticsearch.test.rest.yaml.section.MatchAssertion.doAssert(MatchAssertion.java:87)
06:19:45    > 	at org.elasticsearch.test.rest.yaml.section.Assertion.execute(Assertion.java:76)
06:19:45    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:345)
06:19:45    > 	... 37 more

The REPRO command was:

gradle :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=3D072CE274957D04 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data}" \
  -Dtests.security.manager=true \
  -Dtests.locale=ga \
  -Dtests.timezone=America/Santarem \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

This did not reproduce locally for me on the 6.x branch.

@elasticmachine
Copy link
Collaborator Author

Original comment by @droberts195:

There's also a similar failure in a slightly different test in the same suite, namely "Bulk indexing of monitoring data on closed indices should throw an export exception".

It failed in this build: LINK REDACTED

The error was:

13:44:28 FAILURE 5.70s | XPackRestIT.test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data on closed indices should throw an export exception} <<< FAILURES!
13:44:28    > Throwable LINK REDACTED: java.lang.AssertionError: Failure at [monitoring/bulk/10_basic:187]: hits.total didn't match expected value:
13:44:28    >                     hits.total: expected [2] but was [0]
13:44:28    > 	at __randomizedtesting.SeedInfo.seed([E4AFE1225904AF07:6CFBDEF8F7F8C2FF]:0)
13:44:28    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:349)
13:44:28    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.test(ESClientYamlSuiteTestCase.java:329)
13:44:28    > 	at java.lang.Thread.run(Thread.java:748)
13:44:28    > Caused by: java.lang.AssertionError: hits.total didn't match expected value:
13:44:28    >                     hits.total: expected [2] but was [0]
13:44:28    > 	at org.elasticsearch.test.rest.yaml.section.MatchAssertion.doAssert(MatchAssertion.java:87)
13:44:28    > 	at org.elasticsearch.test.rest.yaml.section.Assertion.execute(Assertion.java:76)
13:44:28    > 	at org.elasticsearch.test.rest.yaml.ESClientYamlSuiteTestCase.executeSection(ESClientYamlSuiteTestCase.java:345)
13:44:28    > 	... 38 more

The REPRO command was:

gradle :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=E4AFE1225904AF07 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data on closed indices should throw an export exception}" \
  -Dtests.security.manager=true \
  -Dtests.locale=da \
  -Dtests.timezone=America/Chicago \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

As with the original one, this doesn't reproduce locally for me.

@elasticmachine
Copy link
Collaborator Author

Original comment by @jkakavas:

Another one today
LINK REDACTED
The REPRO command was

REPRODUCE WITH: ./gradlew :x-pack-elasticsearch:plugin:integTestRunner \
  -Dtests.seed=982602EA131BBD66 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data on closed indices should throw an export exception}" \
  -Dtests.security.manager=true \
  -Dtests.locale=ro-RO \
  -Dtests.timezone=Asia/Tel_Aviv \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

As both of the original ones, this doesn't reproduce locally

@elasticmachine
Copy link
Collaborator Author

Original comment by @markharwood:

I gave this a quick look and it failed to reproduce locally.
A note for others investigating - I initially thought the failing query was written incorrectly:

    body: { "query": { "term" : { "type": "test_type" } } }

I assumed there was a mismatch because test docs are presented with an _type but the test query was looking for a no-underscore type field. The reason for this is that the monitoring bulk endpoint performs a translation - accepting docs with the _type param but indexing into a single-type index with a new type field.

@vladimirdolzhenko
Copy link
Contributor

another one today

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.x+multijob-unix-compatibility/os=sles/1161/console

REPRODUCE WITH: ./gradlew :x-pack:plugin:integTestRunner -Dtests.seed=FEC2E84D40ADAFA6 -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data on closed indices should throw an export exception}" -Dtests.security.manager=true -Dtests.locale=sr-CS -Dtests.timezone=America/Indiana/Winamac -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

this doesn't reproduce locally

@danielmitterdorfer
Copy link
Member

Note that there is a duplicate issue #30935 as well with further information from more test failures.

@hub-cap
Copy link
Contributor

hub-cap commented Oct 4, 2018

and another today

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.x+intake/127/consoleText

  2> REPRODUCE WITH: ./gradlew :x-pack:plugin:integTestRunner -Dtests.seed=94E968D3F9EE828A -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data}" -Dtests.security.manager=true -Dtests.locale=de-DE -Dtests.timezone=America/Indiana/Petersburg -Dcompiler.java=11 -Druntime.java=8 -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

also not repro'ing locally

@iverase
Copy link
Contributor

iverase commented Nov 26, 2018

Another case:

https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+6.5+matrix-java-periodic/ES_BUILD_JAVA=java11,ES_RUNTIME_JAVA=java8fips,nodes=virtual&&linux/63/console

REPRODUCE WITH: ./gradlew :x-pack:plugin:integTestRunner \
  -Dtests.seed=E36F16A49658C123 \
  -Dtests.class=org.elasticsearch.xpack.test.rest.XPackRestIT \
  -Dtests.method="test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data}" \
  -Dtests.security.manager=true \
  -Dtests.locale=fr-CA \
  -Dtests.timezone=SystemV/CST6CDT \
  -Dcompiler.java=11 \
  -Druntime.java=8FIPS \
  -Djavax.net.ssl.keyStorePassword=password \
  -Djavax.net.ssl.trustStorePassword=password \
  -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

@markharwood
Copy link
Contributor

Tried again on 6.7 and would not reproduce. Tried random seeds too

@jkakavas
Copy link
Member

This failed again in a PR today and has failed 3 times in the last month

Given the latest changes in our muting strategy since we have an issue for this, I'm going to mute the test

@pugnascotia
Copy link
Contributor

I have experienced a lot of failures in monitoring/bulk/20_privileges and monitoring/bulk/10_basic. In my branch, with repro command:

./gradlew ':x-pack:plugin:integTestRunner' --tests "org.elasticsearch.xpack.test.rest.XPackRestIT.test {p0=monitoring/bulk/20_privileges/Monitoring Bulk API}" -Dtests.seed=495BFABF351C00BD -Dtests.security.manager=true -Dtests.locale=pa-Arab-PK -Dtests.timezone=Pacific/Wallis -Dcompiler.java=12 -Druntime.java=11 -Dtests.rest.blacklist=getting_started/10_monitor_cluster_health/*

...I found that the test is searching against .monitoring-logstash-*, but that index doesn't exist.

Here's a patch that I used when looking into this.
diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java
index dd2da0d928b..dd71ad654c5 100644
--- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java
+++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/DoSection.java
@@ -49,13 +49,16 @@ import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.stream.Collectors;
 
 import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyMap;
 import static java.util.Collections.unmodifiableList;
 import static org.elasticsearch.common.collect.Tuple.tuple;
 import static org.elasticsearch.common.logging.DeprecationLogger.WARNING_HEADER_PATTERN;
+import static org.elasticsearch.test.ESTestCase.assertBusy;
 import static org.elasticsearch.test.hamcrest.RegexMatcher.matches;
 import static org.hamcrest.Matchers.allOf;
 import static org.hamcrest.Matchers.equalTo;
@@ -231,7 +234,7 @@ public class DoSection implements ExecutableSection {
     }
 
     @Override
-    public void execute(ClientYamlTestExecutionContext executionContext) throws IOException {
+    public void execute(ClientYamlTestExecutionContext executionContext) throws Exception {
 
         if ("param".equals(catchParam)) {
             //client should throw validation error before sending request
@@ -240,8 +243,15 @@ public class DoSection implements ExecutableSection {
             return;
         }
 
+        final String api = apiCallSection.getApi();
+        final Map<String, String> params = apiCallSection.getParams();
+
+        if (api.equals("search") && params.containsKey("index")) {
+            waitForIndex(executionContext, params.get("index"));
+        }
+
         try {
-            ClientYamlTestResponse response = executionContext.callApi(apiCallSection.getApi(), apiCallSection.getParams(),
+            ClientYamlTestResponse response = executionContext.callApi(api, params,
                     apiCallSection.getBodies(), apiCallSection.getHeaders(), apiCallSection.getNodeSelector());
             if (Strings.hasLength(catchParam)) {
                 String catchStatusCode;
@@ -493,4 +503,24 @@ public class DoSection implements ExecutableSection {
             return lhs + "." + rhs;
         }
     }
+
+    private void waitForIndex(ClientYamlTestExecutionContext executionContext, String index) throws Exception {
+        assertBusy(() -> {
+            final Map<String, String> params = new HashMap<>();
+            params.put("h", "index");
+            params.put("s", "index");
+
+            final List<String> actualIndices = executionContext
+                .callApi("cat.indices", params, emptyList(), emptyMap())
+                .getBodyAsString()
+                .lines()
+                .collect(Collectors.toList());
+
+            final String indexAsRegex = "^" + index.replaceAll("\\*", ".*") + "$";
+
+            if (actualIndices.stream().noneMatch(each -> each.matches(indexAsRegex))) {
+                fail("Index [" + index + "] not found in " + actualIndices);
+            }
+        }, 20, TimeUnit.SECONDS);
+    }
 }
diff --git a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ExecutableSection.java b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ExecutableSection.java
index 19690b23528..c4a1992fba1 100644
--- a/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ExecutableSection.java
+++ b/test/framework/src/main/java/org/elasticsearch/test/rest/yaml/section/ExecutableSection.java
@@ -75,5 +75,5 @@ public interface ExecutableSection {
     /**
      * Executes the section passing in the execution context
      */
-    void execute(ClientYamlTestExecutionContext executionContext) throws IOException;
+    void execute(ClientYamlTestExecutionContext executionContext) throws Exception;
 }

@pugnascotia
Copy link
Contributor

Ha, turns out that all you need to enforce the existence of the indices is allow_no_indices: false in the YAML 🤷‍♂, which shows the same result - sometimes the index isn't there, sometimes it is.

ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
@ywelsch
Copy link
Contributor

ywelsch commented Sep 25, 2019

As monitoring/bulk/20_privileges is failing for a similar reason (as @pugnascotia already mentioned), I have muted that test as well on all branches from 7.3 to master.

@ywelsch ywelsch changed the title [CI] Failure in test {p0=monitoring/bulk/10_basic/Bulk indexing of monitoring data} [CI] Failure in monitoring/bulk/* Sep 25, 2019
@ywelsch
Copy link
Contributor

ywelsch commented Sep 25, 2019

The other test in monitoring/bulk/10_basic, namely "Bulk indexing of monitoring data on closed indices should throw an export exception", is failing for the same reason. I'm muting that one as well on all branches from 7.3 to master. I've also updated the title of this issue to better reflect the scope of these issues

ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
ywelsch added a commit that referenced this issue Sep 25, 2019
@rjernst rjernst added the Team:Data Management Meta label for data/management team label May 4, 2020
@dakrone dakrone assigned dakrone and unassigned markharwood Mar 10, 2021
dakrone added a commit to dakrone/elasticsearch that referenced this issue Mar 10, 2021
These tests have been muted and an issue open for them for almost two years.

This commit unmutes these tests to see if they still fail (beacuse they did not reproduce for me).

If they still fail, we can either investigate the failures or rewrite the tests as Java integration
tests if the failure is timing-based. If they do not fail, then all the better and the issue will
remain closed.

Resolves elastic#30101
@dakrone dakrone removed their assignment May 3, 2022
@masseyke
Copy link
Member

masseyke commented Feb 1, 2023

I believe that this is closed by #93397, but this one is so old that it's hard to tell. I've run the tests dozens of times now and haven't seen any failures.

@masseyke masseyke closed this as completed Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Data Management/Monitoring Team:Data Management Meta label for data/management team >test-failure Triaged test failures from CI
Projects
None yet
Development

Successfully merging a pull request may close this issue.