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-2061. Revisit logging levels in ZKRMStateStore. (Ray Chiang via kasha)
|
||||||
|
|
||||||
|
YARN-1977. Add tests on getApplicationRequest with filtering start time range. (junping_du)
|
||||||
|
|
||||||
OPTIMIZATIONS
|
OPTIMIZATIONS
|
||||||
|
|
||||||
BUG FIXES
|
BUG FIXES
|
||||||
|
|
|
@ -646,7 +646,8 @@ public class TestClientRMService {
|
||||||
ApplicationId[] appIds =
|
ApplicationId[] appIds =
|
||||||
{getApplicationId(101), getApplicationId(102), getApplicationId(103)};
|
{getApplicationId(101), getApplicationId(102), getApplicationId(103)};
|
||||||
List<String> tags = Arrays.asList("Tag1", "Tag2", "Tag3");
|
List<String> tags = Arrays.asList("Tag1", "Tag2", "Tag3");
|
||||||
|
|
||||||
|
long[] submitTimeMillis = new long[3];
|
||||||
// Submit applications
|
// Submit applications
|
||||||
for (int i = 0; i < appIds.length; i++) {
|
for (int i = 0; i < appIds.length; i++) {
|
||||||
ApplicationId appId = appIds[i];
|
ApplicationId appId = appIds[i];
|
||||||
|
@ -656,6 +657,7 @@ public class TestClientRMService {
|
||||||
appId, appNames[i], queues[i % queues.length],
|
appId, appNames[i], queues[i % queues.length],
|
||||||
new HashSet<String>(tags.subList(0, i + 1)));
|
new HashSet<String>(tags.subList(0, i + 1)));
|
||||||
rmService.submitApplication(submitRequest);
|
rmService.submitApplication(submitRequest);
|
||||||
|
submitTimeMillis[i] = System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test different cases of ClientRMService#getApplications()
|
// Test different cases of ClientRMService#getApplications()
|
||||||
|
@ -667,6 +669,24 @@ public class TestClientRMService {
|
||||||
request.setLimit(1L);
|
request.setLimit(1L);
|
||||||
assertEquals("Failed to limit applications", 1,
|
assertEquals("Failed to limit applications", 1,
|
||||||
rmService.getApplications(request).getApplicationList().size());
|
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
|
// Check queue
|
||||||
request = GetApplicationsRequest.newInstance();
|
request = GetApplicationsRequest.newInstance();
|
||||||
|
|
Loading…
Reference in New Issue