@Test(timeout=10000)
public void testClusterChange() throws Exception {
final HiveConf conf = createConf();
MockQam qam = new MockQam();
WMFullResourcePlan plan = new WMFullResourcePlan(plan(), Lists.newArrayList(pool("A", 2, 1f)));
plan.getPlan().setDefaultPoolPath("A");
final WorkloadManager wm = new WorkloadManagerForTest("test", conf, qam, plan);
wm.start();
WmTezSession session1 = (WmTezSession) wm.getSession(null, mappingInput("A"), conf),
session2 = (WmTezSession) wm.getSession(null, mappingInput("A"), conf);
assertEquals(0.5, session1.getClusterFraction(), EPSILON);
assertEquals(0.5, session2.getClusterFraction(), EPSILON);
qam.assertWasCalledAndReset();
wm.notifyOfClusterStateChange();
assertEquals(0.5, session1.getClusterFraction(), EPSILON);
assertEquals(0.5, session2.getClusterFraction(), EPSILON);
qam.assertWasCalledAndReset();
session1.returnToSessionManager();
session2.returnToSessionManager();
}