Merge r1600644 from trunk: YARN-1977. Add tests on getApplicationRequest with filtering start time range. (Contributed by Junping Du)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1600648 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa57c0f5b8
commit
3438bf531d
|
@ -122,6 +122,8 @@ Release 2.5.0 - UNRELEASED
|
|||
|
||||
YARN-2061. Revisit logging levels in ZKRMStateStore. (Ray Chiang via kasha)
|
||||
|
||||
YARN-1977. Add tests on getApplicationRequest with filtering start time range. (junping_du)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
||||
BUG FIXES
|
||||
|
|
|
@ -647,6 +647,7 @@ public class TestClientRMService {
|
|||
{getApplicationId(101), getApplicationId(102), getApplicationId(103)};
|
||||
List<String> tags = Arrays.asList("Tag1", "Tag2", "Tag3");
|
||||
|
||||
long[] submitTimeMillis = new long[3];
|
||||
// Submit applications
|
||||
for (int i = 0; i < appIds.length; i++) {
|
||||
ApplicationId appId = appIds[i];
|
||||
|
@ -656,6 +657,7 @@ public class TestClientRMService {
|
|||
appId, appNames[i], queues[i % queues.length],
|
||||
new HashSet<String>(tags.subList(0, i + 1)));
|
||||
rmService.submitApplication(submitRequest);
|
||||
submitTimeMillis[i] = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
// Test different cases of ClientRMService#getApplications()
|
||||
|
@ -668,6 +670,24 @@ public class TestClientRMService {
|
|||
assertEquals("Failed to limit applications", 1,
|
||||
rmService.getApplications(request).getApplicationList().size());
|
||||
|
||||
// Check start range
|
||||
request = GetApplicationsRequest.newInstance();
|
||||
request.setStartRange(submitTimeMillis[0], System.currentTimeMillis());
|
||||
|
||||
// 2 applications are submitted after first timeMills
|
||||
assertEquals("Incorrect number of matching start range",
|
||||
2, rmService.getApplications(request).getApplicationList().size());
|
||||
|
||||
// 1 application is submitted after the second timeMills
|
||||
request.setStartRange(submitTimeMillis[1], System.currentTimeMillis());
|
||||
assertEquals("Incorrect number of matching start range",
|
||||
1, rmService.getApplications(request).getApplicationList().size());
|
||||
|
||||
// no application is submitted after the third timeMills
|
||||
request.setStartRange(submitTimeMillis[2], System.currentTimeMillis());
|
||||
assertEquals("Incorrect number of matching start range",
|
||||
0, rmService.getApplications(request).getApplicationList().size());
|
||||
|
||||
// Check queue
|
||||
request = GetApplicationsRequest.newInstance();
|
||||
Set<String> queueSet = new HashSet<String>();
|
||||
|
|
Loading…
Reference in New Issue