File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
distribution/archives/integ-test-zip/src/test/java/org/elasticsearch/test/rest Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 1919
2020package org .elasticsearch .test .rest ;
2121
22+ import org .apache .http .util .EntityUtils ;
2223import org .elasticsearch .client .Request ;
2324import org .elasticsearch .client .Response ;
2425
@@ -34,8 +35,16 @@ public class DefaultShardsIT extends ESRestTestCase {
3435 public void testDefaultShards () throws IOException {
3536 final Response response = client ().performRequest (new Request ("PUT" , "/index" ));
3637 final String warning = response .getHeader ("Warning" );
38+ if (warning == null ) {
39+ StringBuilder explanation = new StringBuilder ("expected response to contain a warning but did not " );
40+ explanation .append (response );
41+ if (response .getEntity () != null ) {
42+ explanation .append (" entity:\n " ).append (EntityUtils .toString (response .getEntity ()));
43+ }
44+ fail (explanation .toString ());
45+ }
3746 final Matcher matcher = WARNING_HEADER_PATTERN .matcher (warning );
38- assertTrue (matcher .matches ());
47+ assertTrue ("warning didn't match warning header pattern but was [" + warning + "]" , matcher .matches ());
3948 final String message = matcher .group (1 );
4049 assertThat (message , equalTo ("the default number of shards will change from [5] to [1] in 7.0.0; "
4150 + "if you wish to continue using the default of [5] shards, "
You can’t perform that action at this time.
0 commit comments