Fly-Style commented on code in PR #18786: URL: https://github.com/apache/druid/pull/18786#discussion_r2577820872
########## embedded-tests/src/test/java/org/apache/druid/testing/embedded/query/QueryErrorTest.java: ########## @@ -0,0 +1,282 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.druid.testing.embedded.query; + +import com.google.common.util.concurrent.ListenableFuture; +import org.apache.druid.client.broker.BrokerClient; +import org.apache.druid.error.ExceptionMatcher; +import org.apache.druid.query.Druids; +import org.apache.druid.query.QueryContexts; +import org.apache.druid.query.http.ClientSqlQuery; +import org.apache.druid.rpc.HttpResponseException; +import org.apache.druid.testing.embedded.EmbeddedDruidCluster; +import org.hamcrest.MatcherAssert; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.FieldSource; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static org.apache.druid.testing.embedded.query.ServerManagerForQueryErrorTest.QUERY_CAPACITY_EXCEEDED_TEST_CONTEXT_KEY; +import static org.apache.druid.testing.embedded.query.ServerManagerForQueryErrorTest.QUERY_FAILURE_TEST_CONTEXT_KEY; +import static org.apache.druid.testing.embedded.query.ServerManagerForQueryErrorTest.QUERY_TIMEOUT_TEST_CONTEXT_KEY; +import static org.apache.druid.testing.embedded.query.ServerManagerForQueryErrorTest.QUERY_UNSUPPORTED_TEST_CONTEXT_KEY; +import static org.apache.druid.testing.embedded.query.ServerManagerForQueryErrorTest.RESOURCE_LIMIT_EXCEEDED_TEST_CONTEXT_KEY; + +/** + * This class tests various query failures. + * <p> + * - SQL planning failures. Both {@link org.apache.calcite.sql.parser.SqlParseException} + * and {@link org.apache.calcite.tools.ValidationException} are tested using SQLs that must fail. + * - Various query errors from historicals. These tests use {@link ServerManagerForQueryErrorTest} to make + * the query to always throw an exception. + */ +public class QueryErrorTest extends QueryTestBase +{ + // TODO: introduce onAnyRouter(...) and use it; add TLS tests in the follow-up patches + protected static List<Boolean> SHOULD_USE_SQL_ENGINE = List.of(true, false); + + @Override + protected EmbeddedDruidCluster createCluster() + { + overlord.addProperty("druid.manager.segments.pollDuration", "PT0.1s"); + indexer.setServerMemory(600_000_000) + .addProperty("druid.worker.capacity", "4") + .addProperty("druid.processing.numThreads", "2") + .addProperty("druid.segment.handoff.pollDuration", "PT0.1s"); + + return EmbeddedDruidCluster.withEmbeddedDerbyAndZookeeper() + .useLatchableEmitter() + .addServer(overlord) + .addServer(coordinator) + .addServer(broker) + .addServer(router) + .addServer(indexer) + .addServer(historical) + .addExtension(ServerManagerForQueryErrorTestModule.class); + } + + @Override + protected void beforeAll() + { + var ingestionStatus = cluster.callApi().onAnyBroker( + b -> b.submitSqlTask( + new ClientSqlQuery( + "REPLACE INTO t\n" Review Comment: https://github.com/apache/druid/pull/18786/commits/0d5cde4236e9d85cd6f4fb52e505a5698bcae531 ########## integration-tests/src/test/java/org/apache/druid/tests/query/ITQueryRetryTestOnMissingSegments.java: ########## @@ -52,12 +51,11 @@ * This class tests the query retry on missing segments. A segment can be missing in a historical during a query if * the historical drops the segment after the broker issues the query to the historical. To mimic this case, this * test spawns a historical modified for testing. This historical announces all segments assigned, but doesn't serve - * all of them always. Instead, it can report missing segments for some - * segments. See {@link ServerManagerForQueryErrorTest} for more details. + * all of them always. Instead, it can report missing segments for some segments. * <p> * To run this test properly, the test group must be specified as {@link TestNGGroup#QUERY_RETRY}. */ -@Test(groups = TestNGGroup.QUERY_RETRY) +@Test(groups = TestNGGroup.QUERY_RETRY, enabled = false) // TODO: Temporarily disabled due to migration to embedded suite. @Guice(moduleFactory = DruidTestModuleFactory.class) public class ITQueryRetryTestOnMissingSegments Review Comment: https://github.com/apache/druid/pull/18786/commits/0d5cde4236e9d85cd6f4fb52e505a5698bcae531 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
