jtuglu1 commented on code in PR #18793:
URL: https://github.com/apache/druid/pull/18793#discussion_r2586967277
##########
services/src/test/java/org/apache/druid/cli/CliPeonTest.java:
##########
@@ -97,51 +95,43 @@ public class CliPeonTest
@Test
public void testCliPeonK8sMode() throws IOException
{
- File file = temporaryFolder.newFile("task.json");
- FileUtils.write(file, "{\"type\":\"noop\"}", StandardCharsets.UTF_8);
- GuiceRunnable runnable = new FakeCliPeon(file.getParent(), "k8s");
- final Injector injector = GuiceInjectors.makeStartupInjector();
- injector.injectMembers(runnable);
- Assert.assertNotNull(runnable.makeInjector());
+ final Properties properties = new Properties();
+ properties.setProperty("druid.indexer.runner.type", "k8s");
+ final Injector peonInjector = makePeonInjector(properties,
NoopTask.create());
+ final ExecutorLifecycleConfig executorLifecycleConfig =
peonInjector.getInstance(ExecutorLifecycleConfig.class);
+ Assert.assertFalse(executorLifecycleConfig.isParentStreamDefined());
}
@Test
public void testCliPeonNonK8sMode() throws IOException
{
- File file = temporaryFolder.newFile("task.json");
- FileUtils.write(file, "{\"type\":\"noop\"}", StandardCharsets.UTF_8);
- GuiceRunnable runnable = new FakeCliPeon(file.getParent(), "httpRemote");
- final Injector injector = GuiceInjectors.makeStartupInjector();
- injector.injectMembers(runnable);
- Assert.assertNotNull(runnable.makeInjector());
+ final Properties properties = new Properties();
+ properties.setProperty("druid.indexer.runner.type", "httpRemote");
+ final Injector peonInjector = makePeonInjector(properties,
NoopTask.create());
+ final ExecutorLifecycleConfig executorLifecycleConfig =
peonInjector.getInstance(ExecutorLifecycleConfig.class);
+ Assert.assertTrue(executorLifecycleConfig.isParentStreamDefined());
}
@Test
public void testCliPeonK8sANdWorkerIsK8sMode() throws IOException
Review Comment:
while we're here `testCliPeonK8sANdWorkerIsK8sMode` ->
`testCliPeonK8sAndWorkerIsK8sMode`
##########
services/src/test/java/org/apache/druid/cli/CliPeonTest.java:
##########
@@ -270,19 +254,23 @@ public void
testTaskWithMonitorsAndMetricsSpecDoNotCauseCyclicDependency() throw
verifyTaskHolder(peonInjector.getInstance(TaskHolder.class),
compactionTask);
}
- private Injector makePeonInjector(Properties properties, Task task) throws
IOException
+ private Injector makePeonInjector(File taskFile, Properties properties)
{
- File file = temporaryFolder.newFile("task.json");
- FileUtils.write(file, mapper.writeValueAsString(task),
StandardCharsets.UTF_8);
-
final CliPeon peon = new CliPeon();
- peon.taskAndStatusFile = ImmutableList.of(file.getParent(), "1");
+ peon.taskAndStatusFile = ImmutableList.of(taskFile.getParent(), "1");
peon.configure(properties);
peon.configure(properties, GuiceInjectors.makeStartupInjector());
return peon.makeInjector(Set.of(NodeRole.PEON));
}
+ private Injector makePeonInjector(Properties properties, Task task) throws
IOException
Review Comment:
nit: to mimic
```java
private Injector makePeonInjector(File taskFile, Properties properties)
```
```java
private Injector makePeonInjector(Task task, Properties properties) throws
IOException
```
--
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]