From 14efeb71a5be5bc7f285c20e64566de76342825a Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 10:43:29 +0000 Subject: [PATCH 01/10] non-retriable --- .../druid/testing/clients/AbstractQueryResourceTestClient.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java b/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java index 9b7911cc84f5..98185a5f6849 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java @@ -167,6 +167,8 @@ public List> query(String url, QueryType query) if (ce != null) { LOG.info(ce, "Encountered a channel exception. Retrying the query request"); return false; + } else { + throw new RuntimeException("non-retriable exception", t); } } return true; From 5540dceb3b8464be522c536cbe6b6d6381ce4e89 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 14:07:02 +0000 Subject: [PATCH 02/10] crap --- .../testing/guice/DruidTestModuleFactory.java | 20 ++++--- .../druid/testing/utils/SuiteListener.java | 4 +- .../java/org/apache/druid/tests/SelfTest.java | 52 +++++++++++++++++++ 3 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java diff --git a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java index d08712dea35e..bd7349ff71f0 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java @@ -35,31 +35,29 @@ public class DruidTestModuleFactory implements IModuleFactory { - private static final Module MODULE = new DruidTestModule(); - private static final Injector INJECTOR = Initialization.makeInjectorWithModules( + private final Module module = new DruidTestModule(); + private final Injector injector = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), - getModules() - ); + getModules()); - public static Injector getInjector() + public Injector getInjector() { - return INJECTOR; + return injector; } - private static List getModules() + protected static List getModules() { return ImmutableList.of( new DruidTestModule(), new IndexingServiceFirehoseModule(), new IndexingServiceInputSourceModule(), - new IndexingServiceTuningConfigModule() - ); + new IndexingServiceTuningConfigModule()); } @Override public Module createModule(ITestContext context, Class testClass) { - context.addInjector(Collections.singletonList(MODULE), INJECTOR); - return MODULE; + context.addInjector(Collections.singletonList(module), injector); + return module; } } diff --git a/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java b/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java index 6259156b03b2..fd44c4a35426 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java @@ -34,7 +34,7 @@ public class SuiteListener implements ISuiteListener @Override public void onStart(ISuite suite) { - Injector injector = DruidTestModuleFactory.getInjector(); + Injector injector = new DruidTestModuleFactory().getInjector(); IntegrationTestingConfig config = injector.getInstance(IntegrationTestingConfig.class); DruidClusterAdminClient druidClusterAdminClient = injector.getInstance(DruidClusterAdminClient.class); @@ -58,7 +58,7 @@ public void onStart(ISuite suite) @Override public void onFinish(ISuite suite) { - Injector injector = DruidTestModuleFactory.getInjector(); + Injector injector = new DruidTestModuleFactory().getInjector(); Lifecycle lifecycle = injector.getInstance(Lifecycle.class); lifecycle.stop(); } diff --git a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java new file mode 100644 index 000000000000..9c35c67f30cc --- /dev/null +++ b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java @@ -0,0 +1,52 @@ +/* + * 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.tests; + +import com.google.inject.Inject; +import org.apache.druid.java.util.http.client.HttpClient; +import org.apache.druid.testing.clients.QueryResourceTestClient; +import org.apache.druid.testing.guice.DruidTestModuleFactory; +import org.apache.druid.testing.guice.TestClient; +import org.testng.annotations.Guice; +import org.testng.annotations.Test; + +@Guice(moduleFactory = SelfTest.LocalModuleFactory.class) +public class SelfTest +{ + + static class LocalModuleFactory extends DruidTestModuleFactory + { + + } + + @TestClient + HttpClient httpClient; + + @Inject + private QueryResourceTestClient queryClient; + + @Test + public void asd() + { + queryClient.query("httpfds", null); + // que + } + +} From c6fbbde2cb785856ac985025bd422450973192bb Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 14:07:33 +0000 Subject: [PATCH 03/10] undo --- .../testing/guice/DruidTestModuleFactory.java | 20 ++++++++++--------- .../druid/testing/utils/SuiteListener.java | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java index bd7349ff71f0..d08712dea35e 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/guice/DruidTestModuleFactory.java @@ -35,29 +35,31 @@ public class DruidTestModuleFactory implements IModuleFactory { - private final Module module = new DruidTestModule(); - private final Injector injector = Initialization.makeInjectorWithModules( + private static final Module MODULE = new DruidTestModule(); + private static final Injector INJECTOR = Initialization.makeInjectorWithModules( GuiceInjectors.makeStartupInjector(), - getModules()); + getModules() + ); - public Injector getInjector() + public static Injector getInjector() { - return injector; + return INJECTOR; } - protected static List getModules() + private static List getModules() { return ImmutableList.of( new DruidTestModule(), new IndexingServiceFirehoseModule(), new IndexingServiceInputSourceModule(), - new IndexingServiceTuningConfigModule()); + new IndexingServiceTuningConfigModule() + ); } @Override public Module createModule(ITestContext context, Class testClass) { - context.addInjector(Collections.singletonList(module), injector); - return module; + context.addInjector(Collections.singletonList(MODULE), INJECTOR); + return MODULE; } } diff --git a/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java b/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java index fd44c4a35426..6259156b03b2 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/utils/SuiteListener.java @@ -34,7 +34,7 @@ public class SuiteListener implements ISuiteListener @Override public void onStart(ISuite suite) { - Injector injector = new DruidTestModuleFactory().getInjector(); + Injector injector = DruidTestModuleFactory.getInjector(); IntegrationTestingConfig config = injector.getInstance(IntegrationTestingConfig.class); DruidClusterAdminClient druidClusterAdminClient = injector.getInstance(DruidClusterAdminClient.class); @@ -58,7 +58,7 @@ public void onStart(ISuite suite) @Override public void onFinish(ISuite suite) { - Injector injector = new DruidTestModuleFactory().getInjector(); + Injector injector = DruidTestModuleFactory.getInjector(); Lifecycle lifecycle = injector.getInstance(Lifecycle.class); lifecycle.stop(); } From 09083490ba81952593599f20312b5c3ef8f4fcf5 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 14:50:48 +0000 Subject: [PATCH 04/10] fix/etc --- .../AbstractQueryResourceTestClient.java | 5 + .../java/org/apache/druid/tests/SelfTest.java | 110 ++++++++++++++++-- 2 files changed, 108 insertions(+), 7 deletions(-) diff --git a/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java b/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java index 98185a5f6849..61a480035820 100644 --- a/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java +++ b/integration-tests/src/main/java/org/apache/druid/testing/clients/AbstractQueryResourceTestClient.java @@ -161,6 +161,11 @@ public List> query(String url, QueryType query) request, new BytesFullResponseHandler() ).get()); + + if (responseRef.get().getStatus().getCode() == 500) { + LOG.info("Server returned HTTP-500. Retrying the query request"); + return false; + } } catch (Throwable t) { ChannelException ce = Throwables.getCauseOfType(t, ChannelException.class); diff --git a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java index 9c35c67f30cc..8dc849f3649b 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java @@ -19,34 +19,130 @@ package org.apache.druid.tests; +import com.google.common.collect.ImmutableList; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; +import com.google.inject.Binder; import com.google.inject.Inject; +import com.google.inject.Injector; +import com.google.inject.Module; +import com.google.inject.Provides; +import org.apache.druid.guice.GuiceInjectors; +import org.apache.druid.guice.IndexingServiceFirehoseModule; +import org.apache.druid.guice.IndexingServiceInputSourceModule; +import org.apache.druid.guice.IndexingServiceTuningConfigModule; +import org.apache.druid.initialization.Initialization; import org.apache.druid.java.util.http.client.HttpClient; +import org.apache.druid.java.util.http.client.Request; +import org.apache.druid.java.util.http.client.response.BytesFullResponseHolder; +import org.apache.druid.java.util.http.client.response.HttpResponseHandler; import org.apache.druid.testing.clients.QueryResourceTestClient; -import org.apache.druid.testing.guice.DruidTestModuleFactory; +import org.apache.druid.testing.guice.DruidTestModule; import org.apache.druid.testing.guice.TestClient; +import org.checkerframework.checker.nullness.qual.Nullable; +import org.jboss.netty.handler.codec.http.DefaultHttpResponse; +import org.jboss.netty.handler.codec.http.HttpResponse; +import org.jboss.netty.handler.codec.http.HttpResponseStatus; +import org.jboss.netty.handler.codec.http.HttpVersion; +import org.joda.time.Duration; +import org.testng.IModuleFactory; +import org.testng.ITestContext; import org.testng.annotations.Guice; import org.testng.annotations.Test; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.atomic.AtomicInteger; + +import static org.testng.Assert.assertEquals; + @Guice(moduleFactory = SelfTest.LocalModuleFactory.class) public class SelfTest { - static class LocalModuleFactory extends DruidTestModuleFactory + static class LocalModule implements Module { + DruidTestModule delegate = new DruidTestModule(); + + @Override + public void configure(Binder binder) + { + delegate.configure(binder); + } + + @Provides + @TestClient + public HttpClient getHttpClient() + { + return new HttpClient() + { + @Override + public ListenableFuture go(Request request, + HttpResponseHandler handler) + { + @Nullable + Final val = null; + + int counter = SelfTest.requestCounter.getAndIncrement(); + HttpResponse response = new DefaultHttpResponse( + HttpVersion.HTTP_1_1, + counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK); + + val = (@Nullable Final) new BytesFullResponseHolder(response); + return Futures. immediateFuture(val); + } + + @Override + public ListenableFuture go(Request request, + HttpResponseHandler handler, Duration readTimeout) + { + throw new RuntimeException("Unimplemented!"); + } + }; + } } - @TestClient - HttpClient httpClient; + static class LocalModuleFactory implements IModuleFactory + { + private static final Module MODULE = new DruidTestModule(); + private static final Injector INJECTOR = Initialization.makeInjectorWithModules( + GuiceInjectors.makeStartupInjector(), + getModules()); + + public static Injector getInjector() + { + return INJECTOR; + } + + private static List getModules() + { + return ImmutableList.of( + new LocalModule(), + new IndexingServiceFirehoseModule(), + new IndexingServiceInputSourceModule(), + new IndexingServiceTuningConfigModule()); + } + + @Override + public Module createModule(ITestContext context, Class testClass) + { + context.addInjector(Collections.singletonList(MODULE), INJECTOR); + return MODULE; + } + } @Inject private QueryResourceTestClient queryClient; + private static AtomicInteger requestCounter = new AtomicInteger(); + @Test - public void asd() + public void testInternalServerErrorAtFirstTry() { - queryClient.query("httpfds", null); - // que + requestCounter.set(0); + queryClient.query("http://192.168.99.99/asd", null); + assertEquals(2, requestCounter.get()); } } From 05464dcc05dd04c355a2eb44c3cfe836e728d5d3 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 16:14:37 +0000 Subject: [PATCH 05/10] working test --- .../java/org/apache/druid/tests/SelfTest.java | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java index 8dc849f3649b..9dff64aad62c 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java @@ -19,6 +19,7 @@ package org.apache.druid.tests; +import com.fasterxml.jackson.core.JsonProcessingException; import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; @@ -40,7 +41,9 @@ import org.apache.druid.testing.guice.DruidTestModule; import org.apache.druid.testing.guice.TestClient; import org.checkerframework.checker.nullness.qual.Nullable; +import org.jboss.netty.buffer.ByteBufferBackedChannelBuffer; import org.jboss.netty.handler.codec.http.DefaultHttpResponse; +import org.jboss.netty.handler.codec.http.HttpHeaders; import org.jboss.netty.handler.codec.http.HttpResponse; import org.jboss.netty.handler.codec.http.HttpResponseStatus; import org.jboss.netty.handler.codec.http.HttpVersion; @@ -50,10 +53,13 @@ import org.testng.annotations.Guice; import org.testng.annotations.Test; +import java.nio.ByteBuffer; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; +import javax.ws.rs.core.MediaType; + import static org.testng.Assert.assertEquals; @Guice(moduleFactory = SelfTest.LocalModuleFactory.class) @@ -87,9 +93,18 @@ public ListenableFuture go(Request request, int counter = SelfTest.requestCounter.getAndIncrement(); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, - counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK); - - val = (@Nullable Final) new BytesFullResponseHolder(response); + counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK) + { + public org.jboss.netty.buffer.ChannelBuffer getContent() + { + return new ByteBufferBackedChannelBuffer(ByteBuffer.wrap("[{}]".getBytes())); + } + }; + response.headers().add(HttpHeaders.Names.CONTENT_TYPE, MediaType.APPLICATION_JSON); + + BytesFullResponseHolder bytesFullResponseHolder = new BytesFullResponseHolder(response); + bytesFullResponseHolder.addChunk("[{}]".getBytes()); + val = (@Nullable Final) bytesFullResponseHolder; return Futures. immediateFuture(val); } @@ -138,8 +153,16 @@ public Module createModule(ITestContext context, Class testClass) private static AtomicInteger requestCounter = new AtomicInteger(); @Test - public void testInternalServerErrorAtFirstTry() + public void testInternalServerErrorAtFirstTry() throws JsonProcessingException { + +//List> v=new ArrayList>(); +//v.add(new HashMap()); +//String s = new ObjectMapper().writeValueAsString(v); +//if(true) { +// throw new RuntimeException(s); +//} + requestCounter.set(0); queryClient.query("http://192.168.99.99/asd", null); assertEquals(2, requestCounter.get()); From deaa1ab058dd0723b76d623a49033e8792cce634 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 16:15:12 +0000 Subject: [PATCH 06/10] updates --- .../java/org/apache/druid/tests/SelfTest.java | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java index 9dff64aad62c..8296a5eb050c 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java @@ -41,7 +41,6 @@ import org.apache.druid.testing.guice.DruidTestModule; import org.apache.druid.testing.guice.TestClient; import org.checkerframework.checker.nullness.qual.Nullable; -import org.jboss.netty.buffer.ByteBufferBackedChannelBuffer; import org.jboss.netty.handler.codec.http.DefaultHttpResponse; import org.jboss.netty.handler.codec.http.HttpHeaders; import org.jboss.netty.handler.codec.http.HttpResponse; @@ -53,7 +52,6 @@ import org.testng.annotations.Guice; import org.testng.annotations.Test; -import java.nio.ByteBuffer; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; @@ -93,13 +91,7 @@ public ListenableFuture go(Request request, int counter = SelfTest.requestCounter.getAndIncrement(); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, - counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK) - { - public org.jboss.netty.buffer.ChannelBuffer getContent() - { - return new ByteBufferBackedChannelBuffer(ByteBuffer.wrap("[{}]".getBytes())); - } - }; + counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK); response.headers().add(HttpHeaders.Names.CONTENT_TYPE, MediaType.APPLICATION_JSON); BytesFullResponseHolder bytesFullResponseHolder = new BytesFullResponseHolder(response); @@ -155,14 +147,6 @@ public Module createModule(ITestContext context, Class testClass) @Test public void testInternalServerErrorAtFirstTry() throws JsonProcessingException { - -//List> v=new ArrayList>(); -//v.add(new HashMap()); -//String s = new ObjectMapper().writeValueAsString(v); -//if(true) { -// throw new RuntimeException(s); -//} - requestCounter.set(0); queryClient.query("http://192.168.99.99/asd", null); assertEquals(2, requestCounter.get()); From 9cca6aa544cc727ed1c32ae76b30f833dacff6f4 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 16:17:18 +0000 Subject: [PATCH 07/10] rename --- ...a => AbstractQueryResourceTestClientTest.java} | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) rename integration-tests/src/test/java/org/apache/druid/tests/{SelfTest.java => AbstractQueryResourceTestClientTest.java} (92%) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java similarity index 92% rename from integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java rename to integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java index 8296a5eb050c..78a3c804c1f9 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/SelfTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java @@ -52,16 +52,18 @@ import org.testng.annotations.Guice; import org.testng.annotations.Test; +import javax.ws.rs.core.MediaType; + +import java.nio.charset.Charset; import java.util.Collections; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; -import javax.ws.rs.core.MediaType; import static org.testng.Assert.assertEquals; -@Guice(moduleFactory = SelfTest.LocalModuleFactory.class) -public class SelfTest +@Guice(moduleFactory = AbstractQueryResourceTestClientTest.LocalModuleFactory.class) +public class AbstractQueryResourceTestClientTest { static class LocalModule implements Module @@ -88,16 +90,16 @@ public ListenableFuture go(Request request, @Nullable Final val = null; - int counter = SelfTest.requestCounter.getAndIncrement(); + int counter = AbstractQueryResourceTestClientTest.requestCounter.getAndIncrement(); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK); response.headers().add(HttpHeaders.Names.CONTENT_TYPE, MediaType.APPLICATION_JSON); BytesFullResponseHolder bytesFullResponseHolder = new BytesFullResponseHolder(response); - bytesFullResponseHolder.addChunk("[{}]".getBytes()); + bytesFullResponseHolder.addChunk("[{}]".getBytes(Charset.defaultCharset())); val = (@Nullable Final) bytesFullResponseHolder; - return Futures. immediateFuture(val); + return Futures.immediateFuture(val); } @Override @@ -151,5 +153,4 @@ public void testInternalServerErrorAtFirstTry() throws JsonProcessingException queryClient.query("http://192.168.99.99/asd", null); assertEquals(2, requestCounter.get()); } - } From 0b967dc0f0d9842d1c6a0c5d964f2e13ac339704 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 19:02:39 +0000 Subject: [PATCH 08/10] trials --- .../AbstractQueryResourceTestClientTest.java | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java index 78a3c804c1f9..9eaf31d3f16c 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java @@ -23,11 +23,13 @@ import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.Binder; +import com.google.inject.AbstractModule; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.Provides; +import com.google.inject.name.Named; +import com.google.inject.name.Names; import org.apache.druid.guice.GuiceInjectors; import org.apache.druid.guice.IndexingServiceFirehoseModule; import org.apache.druid.guice.IndexingServiceInputSourceModule; @@ -66,15 +68,23 @@ public class AbstractQueryResourceTestClientTest { - static class LocalModule implements Module + static class LocalModule extends AbstractModule { DruidTestModule delegate = new DruidTestModule(); @Override - public void configure(Binder binder) + public void configure() { - delegate.configure(binder); + bindConstant().annotatedWith(Names.named("druid.test.config.dockerIp")).to("localhost"); + delegate.configure(binder()); + } + + @Provides + @Named("druid.test.config.dockerIp") + public String injectedValue() + { + return "localhost"; } @Provides From b0284532b0275a5905349b569d035a5a4b7f81cc Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 19:02:48 +0000 Subject: [PATCH 09/10] Revert "trials" This reverts commit 0b967dc0f0d9842d1c6a0c5d964f2e13ac339704. --- .../AbstractQueryResourceTestClientTest.java | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java index 9eaf31d3f16c..78a3c804c1f9 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java @@ -23,13 +23,11 @@ import com.google.common.collect.ImmutableList; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; -import com.google.inject.AbstractModule; +import com.google.inject.Binder; import com.google.inject.Inject; import com.google.inject.Injector; import com.google.inject.Module; import com.google.inject.Provides; -import com.google.inject.name.Named; -import com.google.inject.name.Names; import org.apache.druid.guice.GuiceInjectors; import org.apache.druid.guice.IndexingServiceFirehoseModule; import org.apache.druid.guice.IndexingServiceInputSourceModule; @@ -68,23 +66,15 @@ public class AbstractQueryResourceTestClientTest { - static class LocalModule extends AbstractModule + static class LocalModule implements Module { DruidTestModule delegate = new DruidTestModule(); @Override - public void configure() + public void configure(Binder binder) { - bindConstant().annotatedWith(Names.named("druid.test.config.dockerIp")).to("localhost"); - delegate.configure(binder()); - } - - @Provides - @Named("druid.test.config.dockerIp") - public String injectedValue() - { - return "localhost"; + delegate.configure(binder); } @Provides From 70ba319eec875f2f5137512d7e1aea2fb98ea349 Mon Sep 17 00:00:00 2001 From: Zoltan Haindrich Date: Wed, 20 Sep 2023 19:03:25 +0000 Subject: [PATCH 10/10] push into IT --- ...est.java => ITAbstractQueryResourceTestClientTest.java} | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) rename integration-tests/src/test/java/org/apache/druid/tests/{AbstractQueryResourceTestClientTest.java => ITAbstractQueryResourceTestClientTest.java} (95%) diff --git a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java b/integration-tests/src/test/java/org/apache/druid/tests/ITAbstractQueryResourceTestClientTest.java similarity index 95% rename from integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java rename to integration-tests/src/test/java/org/apache/druid/tests/ITAbstractQueryResourceTestClientTest.java index 78a3c804c1f9..ce4562ddee31 100644 --- a/integration-tests/src/test/java/org/apache/druid/tests/AbstractQueryResourceTestClientTest.java +++ b/integration-tests/src/test/java/org/apache/druid/tests/ITAbstractQueryResourceTestClientTest.java @@ -62,8 +62,9 @@ import static org.testng.Assert.assertEquals; -@Guice(moduleFactory = AbstractQueryResourceTestClientTest.LocalModuleFactory.class) -public class AbstractQueryResourceTestClientTest +@Test(groups = TestNGGroup.HTTP_ENDPOINT) +@Guice(moduleFactory = ITAbstractQueryResourceTestClientTest.LocalModuleFactory.class) +public class ITAbstractQueryResourceTestClientTest { static class LocalModule implements Module @@ -90,7 +91,7 @@ public ListenableFuture go(Request request, @Nullable Final val = null; - int counter = AbstractQueryResourceTestClientTest.requestCounter.getAndIncrement(); + int counter = ITAbstractQueryResourceTestClientTest.requestCounter.getAndIncrement(); HttpResponse response = new DefaultHttpResponse( HttpVersion.HTTP_1_1, counter == 0 ? HttpResponseStatus.INTERNAL_SERVER_ERROR : HttpResponseStatus.OK);