Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

control-service: delete unused method #2038

Merged
merged 2 commits into from
May 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -820,42 +820,6 @@ public Set<String> listCronJobs() throws ApiException {
.collect(Collectors.toSet());
}

public void createCronJob(
String name,
String image,
String schedule,
boolean enable,
V1Container jobContainer,
V1Container initContainer,
List<V1Volume> volumes)
throws ApiException {
if (getK8sSupportsV1CronJob()) {
createV1CronJob(
name,
image,
schedule,
enable,
jobContainer,
initContainer,
volumes,
Collections.emptyMap(),
Collections.emptyMap(),
List.of(""));
} else {
createV1beta1CronJob(
name,
image,
schedule,
enable,
jobContainer,
initContainer,
volumes,
Collections.emptyMap(),
Collections.emptyMap(),
List.of(""));
}
}

public void createCronJob(
String name,
String image,
Expand Down Expand Up @@ -970,42 +934,6 @@ public void createV1CronJob(
nsJob.getMetadata().getSelfLink());
}

public void updateCronJob(
String name,
String image,
String schedule,
boolean enable,
V1Container jobContainer,
V1Container initContainer,
List<V1Volume> volumes)
throws ApiException {
if (getK8sSupportsV1CronJob()) {
updateV1CronJob(
name,
image,
schedule,
enable,
jobContainer,
initContainer,
volumes,
Collections.emptyMap(),
Collections.emptyMap(),
List.of(""));
} else {
updateV1beta1CronJob(
name,
image,
schedule,
enable,
jobContainer,
initContainer,
volumes,
Collections.emptyMap(),
Collections.emptyMap(),
List.of(""));
}
}

public void updateCronJob(
String name,
String image,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,17 @@ private void mockKubernetesService(KubernetesService mock)

doAnswer(inv -> crons.put(inv.getArgument(0), inv))
.when(mock)
.createCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.createCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
doAnswer(inv -> crons.put(inv.getArgument(0), inv))
.when(mock)
.createCronJob(
Expand All @@ -102,7 +112,17 @@ private void mockKubernetesService(KubernetesService mock)
anyList());
doAnswer(inv -> crons.put(inv.getArgument(0), inv))
.when(mock)
.updateCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.updateCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
doAnswer(inv -> crons.keySet()).when(mock).listCronJobs();
doAnswer(inv -> crons.remove(inv.getArgument(0))).when(mock).deleteCronJob(anyString());
doAnswer(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,29 @@ public void updateDeployment_failedToBuildImage_deploymentSkipped()
verify(dockerRegistryService).dataJobImage(TEST_JOB_NAME, "test-commit");
verify(jobImageBuilder).buildImage(TEST_JOB_IMAGE_NAME, testDataJob, jobDeployment, true);
verify(kubernetesService, never())
.updateCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.updateCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
verify(kubernetesService, never())
.createCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.createCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
verify(dataJobNotification, never()).notifyJobDeploySuccess(testDataJob.getJobConfig());
// The builder class is responsible for sending metrics and notifications on failed build.
verify(deploymentMonitor, never()).recordDeploymentStatus(any(), any());
Expand All @@ -264,9 +284,29 @@ public void updateDeployment_exceptionOccurred_errorNotificationSent() throws Ap
testDataJob, jobDeployment, true, TEST_PRINCIPAL_NAME, OP_ID);

verify(kubernetesService, never())
.updateCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.updateCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
verify(kubernetesService, never())
.createCronJob(anyString(), anyString(), anyString(), anyBoolean(), any(), any(), any());
.createCronJob(
anyString(),
anyString(),
anyString(),
anyBoolean(),
any(),
any(),
any(),
any(),
any(),
any());
verify(deploymentMonitor)
.recordDeploymentStatus(jobDeployment.getDataJobName(), DeploymentStatus.PLATFORM_ERROR);
verify(dataJobNotification).notifyJobDeployError(eq(testDataJob.getJobConfig()), any(), any());
Expand Down