diff --git a/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java b/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java index 62f49e25e55..4532f31f0c2 100644 --- a/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java +++ b/qa/full-cluster-restart/src/test/java/org/elasticsearch/xpack/restart/FullClusterRestartIT.java @@ -248,6 +248,21 @@ public class FullClusterRestartIT extends ESRestTestCase { } } + public void testSqlFailsOnIndexWithTwoTypes() throws IOException { + // TODO this isn't going to trigger until we backport to 6.1 + assumeTrue("It is only possible to build an index that sql doesn't like before 6.0.0", + oldClusterVersion.onOrAfter(Version.V_6_0_0_alpha1)); + if (runningAgainstOldCluster) { + client().performRequest("POST", "/testsqlfailsonindexwithtwotypes/type1", emptyMap(), new StringEntity("{}")); + client().performRequest("POST", "/testsqlfailsonindexwithtwotypes/type2", emptyMap(), new StringEntity("{}")); + return; + } + ResponseException e = expectThrows(ResponseException.class, () -> client().performRequest("POST", "/_sql", emptyMap(), + new StringEntity("{\"query\":\"SELECT * FROM testsqlfailsonindexwithtwotypes\"}"))); + assertEquals(400, e.getResponse().getStatusLine().getStatusCode()); + assertThat(e.getMessage(), containsString("Invalid index testsqlfailsonindexwithtwotypes; contains more than one type")); + } + private String loadWatch(String watch) throws IOException { return StreamsUtils.copyToStringFromClasspath("/org/elasticsearch/xpack/restart/" + watch); } diff --git a/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/ErrorsIT.java b/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/ErrorsIT.java index d74dcdd031b..9a10fa51f16 100644 --- a/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/ErrorsIT.java +++ b/sql/jdbc/src/test/java/org/elasticsearch/xpack/sql/jdbc/ErrorsIT.java @@ -20,12 +20,4 @@ public class ErrorsIT extends JdbcIntegrationTestCase { assertEquals("line 1:15: Cannot resolve index [test]", e.getMessage()); } } - -// public void testMultiTypeIndex() throws Exception { -// NOCOMMIT bwc tests -// try (Connection c = esJdbc()) { -// SQLException e = expectThrows(SQLException.class, () -> c.prepareStatement("SELECT * from multi_type").executeQuery()); -// assertEquals(message("multi_type"), e.getMessage()); -// } -// } }