updates/etc

This commit is contained in:
Zoltan Haindrich 2024-06-18 16:33:22 +00:00
parent 64a971f893
commit dffa331018
6 changed files with 23 additions and 37 deletions

View File

@ -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

View File

@ -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)

View File

@ -84,7 +84,7 @@ public interface DruidHook<T>
GLOBAL.get(key).remove(hook);
}
public static <T> Closeable withHook(HookKey<T> key, DruidHook<T> hook)
static <T> Closeable withHook(HookKey<T> key, DruidHook<T> hook)
{
register(key, hook);
return new Closeable()
@ -97,7 +97,7 @@ public interface DruidHook<T>
};
}
public static <T> void dispatch(HookKey<T> key, T object)
static <T> void dispatch(HookKey<T> key, T object)
{
List<DruidHook<?>> hooks = GLOBAL.get(key);
if (hooks != null) {

View File

@ -170,7 +170,9 @@ public class DruidQuidemCommandHandler implements CommandHandler
protected final void executeExplain(Context x) throws IOException
{
List<RelNode> 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);
}

View File

@ -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;

View File

@ -187,7 +187,8 @@ public class SqlTestFramework
{
}
default void configureGuice(CoreInjectorBuilder injectorBuilder, List<Module> overrideModules) {
default void configureGuice(CoreInjectorBuilder injectorBuilder, List<Module> 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<Module> overrideModules = new ArrayList<>(builder.overrideModules);
overrideModules.add(new LookylooModule());