Skip to content

Commit

Permalink
test: fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Krelix committed Oct 1, 2020
1 parent f4d2686 commit e258eac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ public void setUp() {
public void testAddVersionStepToJob() throws Exception {
FreeStyleProject project = getProjectWithDefaultAddVersion();
project = jenkins.configRoundtrip(project);
jenkins.assertEqualDataBoundBeans(new AddVersionBuilder(TEST_APP_NAME, TEST_ARCHIVE_NAME), project.getBuildersList().get(0));
AddVersionBuilder job = new AddVersionBuilder(TEST_APP_NAME, TEST_ARCHIVE_NAME);
job.setDomainName("");
jenkins.assertEqualDataBoundBeans(job, project.getBuildersList().get(0));
}

@Test
Expand Down Expand Up @@ -305,6 +307,7 @@ public void testBuildCreateAppOnNodeWithNameSuccess() throws Exception {
addVersionBuilder.setFilePath(createTempFileAndGetPath(TEST_ARCHIVE_NAME));
addVersionBuilder.setAutoCreate(true);
addVersionBuilder.setNodeName(TEST_NODE_NAME);
addVersionBuilder.setDomainName(null);
FreeStyleProject project = getProjectWithBuilder(addVersionBuilder);

doNothing().
Expand All @@ -314,7 +317,7 @@ public void testBuildCreateAppOnNodeWithNameSuccess() throws Exception {
doReturn(Collections.singletonList(new NodeDto(TEST_NODE_NAME, TEST_NODE_NAME, "http", "localhost", 8082)))
.when(restApiService).getForEntity(eq("/api/nodes"), isA(TypeReference.class));
doReturn("createAppGuid")
.when(jobsService).startCreateApplication(TEST_APP_NAME, TEST_NODE_NAME);
.when(jobsService).startCreateApplication(TEST_APP_NAME, TEST_NODE_NAME, null);
doReturn(TEST_APP_NAME)
.when(jobsService).pollAndWaitForJobFinished(eq("createAppGuid"), any(), any(), any());
doReturn(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public void testGetOrCreateApplicationApplicationFound() throws Exception {
public void testGetOrCreateApplicationCreateJobFailure() throws Exception {
when(restApiService.getForEntity(API_APP_ENDPOINT, Applications.class))
.thenReturn(new Applications());
when(jobsService.startCreateApplication(TEST_APP_NAME, null))
when(jobsService.startCreateApplication(TEST_APP_NAME, null, null))
.thenThrow(new JobServiceException());

applicationService.getOrCreateApplicationFromName(TEST_APP_NAME, true);
Expand All @@ -110,7 +110,7 @@ public void testGetOrCreateApplicationCreateJobFailure() throws Exception {
public void testGetOrCreateApplicationJobFailed() throws Exception {
when(restApiService.getForEntity(API_APP_ENDPOINT, Applications.class))
.thenReturn(new Applications());
when(jobsService.startCreateApplication(TEST_APP_NAME, null))
when(jobsService.startCreateApplication(TEST_APP_NAME, null, null))
.thenReturn(TEST_JOB_GUID);
when(jobsService.pollAndWaitForJobFinished(eq(TEST_JOB_GUID), any()))
.thenReturn(null);
Expand All @@ -123,7 +123,7 @@ public void testGetOrCreateApplicationJobFailed() throws Exception {
public void testGetOrCreateApplicationOk() throws Exception {
when(restApiService.getForEntity(API_APP_ENDPOINT, Applications.class))
.thenReturn(new Applications());
when(jobsService.startCreateApplication(TEST_APP_NAME, null))
when(jobsService.startCreateApplication(TEST_APP_NAME, null, null))
.thenReturn(TEST_JOB_GUID);
when(jobsService.pollAndWaitForJobFinished(eq(TEST_JOB_GUID), any()))
.thenReturn(TEST_APP_GUID);
Expand Down

0 comments on commit e258eac

Please sign in to comment.