|
@@ -28,6 +28,7 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration;
|
|
|
import org.apache.hadoop.yarn.exceptions.YarnException;
|
|
|
import org.apache.hadoop.yarn.server.federation.store.FederationStateStore;
|
|
|
import org.apache.hadoop.yarn.server.federation.store.impl.MemoryFederationStateStore;
|
|
|
+import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
|
|
|
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
|
|
|
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterInfo;
|
|
|
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterPolicyConfiguration;
|
|
@@ -145,4 +146,33 @@ public class TestFederationStateStoreFacade {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testAddApplicationHomeSubCluster() throws YarnException {
|
|
|
+
|
|
|
+ // Inserting <AppId, Home1> into FederationStateStore
|
|
|
+ ApplicationId appId = ApplicationId.newInstance(clusterTs, numApps + 1);
|
|
|
+ SubClusterId subClusterId1 = SubClusterId.newInstance("Home1");
|
|
|
+
|
|
|
+ ApplicationHomeSubCluster appHomeSubCluster =
|
|
|
+ ApplicationHomeSubCluster.newInstance(appId, subClusterId1);
|
|
|
+
|
|
|
+ SubClusterId result =
|
|
|
+ facade.addApplicationHomeSubCluster(appHomeSubCluster);
|
|
|
+
|
|
|
+ Assert.assertEquals(facade.getApplicationHomeSubCluster(appId), result);
|
|
|
+ Assert.assertEquals(subClusterId1, result);
|
|
|
+
|
|
|
+ // Inserting <AppId, Home2> into FederationStateStore.
|
|
|
+ // The application is already present.
|
|
|
+ // FederationFacade will return Home1 as SubClusterId.
|
|
|
+ SubClusterId subClusterId2 = SubClusterId.newInstance("Home2");
|
|
|
+ appHomeSubCluster =
|
|
|
+ ApplicationHomeSubCluster.newInstance(appId, subClusterId2);
|
|
|
+
|
|
|
+ result = facade.addApplicationHomeSubCluster(appHomeSubCluster);
|
|
|
+
|
|
|
+ Assert.assertEquals(facade.getApplicationHomeSubCluster(appId), result);
|
|
|
+ Assert.assertEquals(subClusterId1, result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|