/** * Constructs YarnSystemException from {@link YarnException}. * * @param e the {@link YarnException} */ public YarnSystemException(YarnException e) { super(e.getMessage(), e); }
@Override public Void run() throws Exception { try { checkTokenRenewal(owner, other); return null; } catch (YarnException ex) { Assert.assertTrue(ex.getMessage().contains(owner.getUserName() + " tries to renew a token with renewer " + other.getUserName())); throw ex; } } });
@Override public Void run() throws Exception { try { checkTokenRenewal(owner, other); return null; } catch (YarnException ex) { Assert.assertTrue(ex.getMessage().contains( owner.getUserName() + " tries to renew a token")); Assert.assertTrue(ex.getMessage().contains( "with non-matching renewer " + other.getUserName())); throw ex; } } });
@Test public void testGetSubClustersForRackNoFile() throws YarnException { setUpNonExistentFile(); try { resolver.getSubClustersForRack("rack1"); Assert.fail(); } catch (YarnException e) { Assert.assertTrue(e.getMessage().startsWith("Cannot resolve rack")); } } }
@Test public void testGetSubClusterForNodeNoFile() throws YarnException { setUpNonExistentFile(); try { resolver.getSubClusterForNode("node1"); Assert.fail(); } catch (YarnException e) { Assert.assertTrue( e.getMessage().startsWith("Cannot find subClusterId for node")); } }
@Test public void testPostEntitiesNoResponse() throws Exception { mockEntityClientResponse(spyTimelineWriter, ClientResponse.Status.INTERNAL_SERVER_ERROR, false, false); try { client.putEntities(generateEntity()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testPutDomainNoResponse() throws Exception { mockDomainClientResponse(spyTimelineWriter, ClientResponse.Status.FORBIDDEN, false); try { client.putDomain(generateDomain()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testPutDomainNoResponse() throws Exception { mockDomainClientResponse(client, ClientResponse.Status.FORBIDDEN, false); try { client.putDomain(generateDomain()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testPostEntitiesNoResponse() throws Exception { mockEntityClientResponse(spyTimelineWriter, ClientResponse.Status.INTERNAL_SERVER_ERROR, false, false); try { client.putEntities(generateEntity()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testPostEntitiesNoResponse() throws Exception { mockEntityClientResponse( client, ClientResponse.Status.INTERNAL_SERVER_ERROR, false, false); try { client.putEntities(generateEntity()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testPutDomainNoResponse() throws Exception { mockDomainClientResponse(spyTimelineWriter, ClientResponse.Status.FORBIDDEN, false); try { client.putDomain(generateDomain()); Assert.fail("Exception is expected"); } catch (YarnException e) { Assert.assertTrue(e.getMessage().contains( "Failed to get the response from the timeline server.")); } }
@Test public void testDeleteReservationNormal() { ReservationDeleteRequest request = new ReservationDeleteRequestPBImpl(); ReservationId reservationID = ReservationSystemTestUtil.getNewReservationId(); request.setReservationId(reservationID); ReservationAllocation reservation = mock(ReservationAllocation.class); when(plan.getReservationById(reservationID)).thenReturn(reservation); Plan plan = null; try { plan = rrValidator.validateReservationDeleteRequest(rSystem, request); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testUpdateReservationNormal() { ReservationUpdateRequest request = createSimpleReservationUpdateRequest(1, 1, 1, 5, 3); Plan plan = null; try { plan = rrValidator.validateReservationUpdateRequest(rSystem, request); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testUpdateReservationNormal() { ReservationUpdateRequest request = createSimpleReservationUpdateRequest(1, 1, 1, 5, 3); Plan plan = null; try { plan = rrValidator.validateReservationUpdateRequest(rSystem, request); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testUpdateReservationValidRecurrenceExpression() { ReservationUpdateRequest request = createSimpleReservationUpdateRequest(1, 1, 1, 5, 3, "600000"); plan = null; try { plan = rrValidator.validateReservationUpdateRequest(rSystem, request); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testListReservationsNormal() { ReservationListRequest request = new ReservationListRequestPBImpl(); request.setQueue(ReservationSystemTestUtil.reservationQ); request.setEndTime(1000); request.setStartTime(0); when(rSystem.getPlan(ReservationSystemTestUtil.reservationQ)).thenReturn (this.plan); Plan plan = null; try { plan = rrValidator.validateReservationListRequest(rSystem, request); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testSubmitReservationNormal() { ReservationSubmissionRequest request = createSimpleReservationSubmissionRequest(1, 1, 1, 5, 3); Plan plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testSubmitReservationNormal() { ReservationSubmissionRequest request = createSimpleReservationSubmissionRequest(1, 1, 1, 5, 3); Plan plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testSubmitReservationValidRecurrenceExpression() { ReservationSubmissionRequest request = createSimpleReservationSubmissionRequest(1, 1, 1, 5, 3, "600000"); plan = null; try { plan = rrValidator.validateReservationSubmissionRequest(rSystem, request, ReservationSystemTestUtil.getNewReservationId()); } catch (YarnException e) { Assert.fail(e.getMessage()); } Assert.assertNotNull(plan); }
@Test public void testInitialize() throws IOException { try { reservationSystem.reinitialize(scheduler.getConfig(), rmContext); } catch (YarnException e) { Assert.fail(e.getMessage()); } if (getSchedulerType().equals(SchedulerType.CAPACITY)) { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, ReservationSystemTestUtil.getReservationQueueName()); } else { ReservationSystemTestUtil.validateReservationQueue(reservationSystem, ReservationSystemTestUtil.getFullReservationQueueName()); } }