From dffa3310185627d3379c5f97f3111005e9405b59 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Tue, 18 Jun 2024 16:33:22 +0000 Subject: [PATCH] updates/etc --- quidem-it/README.md | 25 ++++++++----------- .../druid/quidem/QuidemCaptureResource.java | 14 ----------- .../druid/sql/calcite/run/DruidHook.java | 4 +-- .../quidem/DruidQuidemCommandHandler.java | 4 ++- .../calcite/SqlTestFrameworkConfigTest.java | 1 + .../sql/calcite/util/SqlTestFramework.java | 12 ++++----- 6 files changed, 23 insertions(+), 37 deletions(-) diff --git a/quidem-it/README.md b/quidem-it/README.md index 4d78bbe532f..c800815599d 100644 --- a/quidem-it/README.md +++ b/quidem-it/README.md @@ -6,12 +6,12 @@ Can be used to write tests against existing test backends (ComponentSupplier) - ## Usage -### Running these checks +### Running these tests * CI execution happens by a standard JUnit test `QTest` in this module * the `dev/quidem` script can be used to run these tests (after the project is built) -### Launching a test generating Broker +### Launching a test generating broker * make sure to build the project first; one way to do that is: ``` @@ -19,17 +19,14 @@ Can be used to write tests against existing test backends (ComponentSupplier) - ``` * launch the broker instance with: ``` - mvn exec:exec -pl quidem-it -Dquidem.url= + mvn exec:exec -pl quidem-it ``` - - - - - - - - -### usage: - - * + * the broker will be running at http://localhost:12345 + * the used test configuration backend can configured by supplying `quidem.uri` + ``` + mvn exec:exec -pl quidem-it -Dquidem.uri=druidtest:///?componentSupplier=ThetaSketchComponentSupplier + ``` + * new record files can be started by calling http://localhost:12345/quidem/start +* after finished with the usage of the broker ; a new `record-123.iq` file will be in the project's worktree - it will contain all the executed statements + * running `dev/quidem -Dquidem.overwrite` adds the resultsets to the `iq` file diff --git a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java index 2808f81a224..5d0ad1d5284 100644 --- a/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java +++ b/quidem-it/src/main/java/org/apache/druid/quidem/QuidemCaptureResource.java @@ -22,8 +22,6 @@ package org.apache.druid.quidem; import com.google.inject.Inject; import org.apache.druid.guice.LazySingleton; import org.apache.druid.java.util.common.StringUtils; -import org.apache.druid.java.util.common.lifecycle.LifecycleStart; - import javax.inject.Named; import javax.ws.rs.GET; import javax.ws.rs.Path; @@ -48,18 +46,6 @@ public class QuidemCaptureResource this.quidemURI = quidemURI; } - @LifecycleStart - public void autostart() { - if (withAutoStart()) { - start(); - } - } - - private boolean withAutoStart() - { - return Boolean.valueOf(System.getProperty("quidem.record.autostart", "false")); - } - @GET @Path("/start") @Produces(MediaType.TEXT_PLAIN) diff --git a/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java b/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java index 077c803829f..8802ccdec97 100644 --- a/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java +++ b/sql/src/main/java/org/apache/druid/sql/calcite/run/DruidHook.java @@ -84,7 +84,7 @@ public interface DruidHook GLOBAL.get(key).remove(hook); } - public static Closeable withHook(HookKey key, DruidHook hook) + static Closeable withHook(HookKey key, DruidHook hook) { register(key, hook); return new Closeable() @@ -97,7 +97,7 @@ public interface DruidHook }; } - public static void dispatch(HookKey key, T object) + static void dispatch(HookKey key, T object) { List> hooks = GLOBAL.get(key); if (hooks != null) { diff --git a/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java b/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java index dbcd1a9dcaf..86876cb90ee 100644 --- a/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java +++ b/sql/src/test/java/org/apache/druid/quidem/DruidQuidemCommandHandler.java @@ -170,7 +170,9 @@ public class DruidQuidemCommandHandler implements CommandHandler protected final void executeExplain(Context x) throws IOException { List logged = new ArrayList<>(); - try (Closeable unhook = DruidHook.withHook(hook, (key, relNode) -> { logged.add(relNode);})) { + try (Closeable unhook = DruidHook.withHook(hook, (key, relNode) -> { + logged.add(relNode); + })) { executeQuery(x); } diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java index b41db68edde..844251e8ac3 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/SqlTestFrameworkConfigTest.java @@ -32,6 +32,7 @@ import org.junit.jupiter.api.Test; import java.lang.annotation.Annotation; import java.net.URI; import java.util.List; + import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; diff --git a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java index ed6b680567d..6c4cf31fa94 100644 --- a/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java +++ b/sql/src/test/java/org/apache/druid/sql/calcite/util/SqlTestFramework.java @@ -187,7 +187,8 @@ public class SqlTestFramework { } - default void configureGuice(CoreInjectorBuilder injectorBuilder, List overrideModules) { + default void configureGuice(CoreInjectorBuilder injectorBuilder, List overrideModules) + { configureGuice(injectorBuilder); } } @@ -615,9 +616,9 @@ public class SqlTestFramework final AuthConfig authConfig, final ViewManager viewManager, QueryRunnerFactoryConglomerate conglomerate, - QuerySegmentWalker walker - - ) { + QuerySegmentWalker walker + ) + { final DruidSchemaCatalog rootSchema = QueryFrameworkUtils.createMockRootSchema( injector, conglomerate, @@ -667,8 +668,7 @@ public class SqlTestFramework // Ignore load scopes. This is a unit test, not a Druid node. If a // test pulls in a module, then pull in that module, even though we are // not the Druid node to which the module is scoped. - .ignoreLoadScopes() - ; + .ignoreLoadScopes(); List overrideModules = new ArrayList<>(builder.overrideModules); overrideModules.add(new LookylooModule());