mirror of https://github.com/apache/druid.git
New error message for task deletion (#14008)
* New error message * Add unit test
This commit is contained in:
parent
217b0f6832
commit
4560b9d8aa
|
@ -133,7 +133,7 @@ public class DruidKubernetesPeonClient implements KubernetesPeonClient
|
|||
if (result) {
|
||||
log.info("Cleaned up k8s task: %s", taskId);
|
||||
} else {
|
||||
log.info("Failed to cleanup task: %s", taskId);
|
||||
log.info("K8s task does not exist: %s", taskId);
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
|
|
|
@ -140,6 +140,26 @@ public class DruidKubernetesPeonClientTest
|
|||
Assertions.assertEquals(killThisOne, Iterables.getOnlyElement(toDelete)); // should only cleanup one job
|
||||
}
|
||||
|
||||
@Test
|
||||
void testCleanupReturnValue() throws KubernetesResourceNotFoundException
|
||||
{
|
||||
DruidKubernetesPeonClient peonClient = new DruidKubernetesPeonClient(new TestKubernetesClient(this.client), "test",
|
||||
false
|
||||
);
|
||||
Assertions.assertFalse(peonClient.cleanUpJob(new K8sTaskId("sometask")));
|
||||
|
||||
Job job = new JobBuilder()
|
||||
.withNewMetadata()
|
||||
.withName("sometask")
|
||||
.addToLabels(DruidK8sConstants.LABEL_KEY, "true")
|
||||
.endMetadata()
|
||||
.withNewSpec()
|
||||
.withTemplate(new PodTemplateSpec(new ObjectMeta(), K8sTestUtils.getDummyPodSpec()))
|
||||
.endSpec().build();
|
||||
client.batch().v1().jobs().inNamespace("test").create(job);
|
||||
Assertions.assertTrue(peonClient.cleanUpJob(new K8sTaskId("sometask")));
|
||||
}
|
||||
|
||||
@Test
|
||||
void watchingALogThatDoesntExist()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue