assertResponse(INVALID_REQUEST, thrift.getPendingReason(query.get()));
}
@Test
public void testGetConfigSummary() throws Exception {
IJobKey key = JobKeys.from("test", "test", "test");
TaskConfig firstGroupTask = defaultTask(true);
TaskConfig secondGroupTask = defaultTask(true).setNumCpus(2);
IScheduledTask first1 = IScheduledTask.build(new ScheduledTask()
.setAssignedTask(new AssignedTask().setTask(firstGroupTask).setInstanceId(0)));
IScheduledTask first2 = IScheduledTask.build(new ScheduledTask()
.setAssignedTask(new AssignedTask().setTask(firstGroupTask).setInstanceId(1)));
IScheduledTask second = IScheduledTask.build(new ScheduledTask()
.setAssignedTask(new AssignedTask().setTask(secondGroupTask).setInstanceId(2)));
storageUtil.expectTaskFetch(Query.jobScoped(key).active(), first1, first2, second);
ConfigGroup group1 = new ConfigGroup()
.setConfig(firstGroupTask)
.setInstanceIds(Sets.newHashSet(0, 1));
ConfigGroup group2 = new ConfigGroup()
.setConfig(secondGroupTask)
.setInstanceIds(Sets.newHashSet(2));
ConfigSummary summary = new ConfigSummary()
.setKey(key.newBuilder())
.setGroups(Sets.newHashSet(group1, group2));
ConfigSummaryResult expected = new ConfigSummaryResult().setSummary(summary);
control.replay();
Response response = assertOkResponse(thrift.getConfigSummary(key.newBuilder()));
assertEquals(expected, response.getResult().getConfigSummaryResult());
}