示例#1
0
        public virtual void TestReconnect()
        {
            RMNodeImpl     node                  = GetRunningNode();
            ClusterMetrics cm                    = ClusterMetrics.GetMetrics();
            int            initialActive         = cm.GetNumActiveNMs();
            int            initialLost           = cm.GetNumLostNMs();
            int            initialUnhealthy      = cm.GetUnhealthyNMs();
            int            initialDecommissioned = cm.GetNumDecommisionedNMs();
            int            initialRebooted       = cm.GetNumRebootedNMs();

            node.Handle(new RMNodeReconnectEvent(node.GetNodeID(), node, null, null));
            NUnit.Framework.Assert.AreEqual("Active Nodes", initialActive, cm.GetNumActiveNMs
                                                ());
            NUnit.Framework.Assert.AreEqual("Lost Nodes", initialLost, cm.GetNumLostNMs());
            NUnit.Framework.Assert.AreEqual("Unhealthy Nodes", initialUnhealthy, cm.GetUnhealthyNMs
                                                ());
            NUnit.Framework.Assert.AreEqual("Decommissioned Nodes", initialDecommissioned, cm
                                            .GetNumDecommisionedNMs());
            NUnit.Framework.Assert.AreEqual("Rebooted Nodes", initialRebooted, cm.GetNumRebootedNMs
                                                ());
            NUnit.Framework.Assert.AreEqual(NodeState.Running, node.GetState());
            NUnit.Framework.Assert.IsNotNull(nodesListManagerEvent);
            NUnit.Framework.Assert.AreEqual(NodesListManagerEventType.NodeUsable, nodesListManagerEvent
                                            .GetType());
        }
示例#2
0
        /// <exception cref="System.Exception"/>
        private void VerifyClusterMetrics(int activeNodes, int appsSubmitted, int appsPending
                                          , int containersPending, int availableMB, int activeApplications)
        {
            int            timeoutSecs              = 0;
            QueueMetrics   metrics                  = rm.GetResourceScheduler().GetRootQueueMetrics();
            ClusterMetrics clusterMetrics           = ClusterMetrics.GetMetrics();
            bool           isAllMetricAssertionDone = false;
            string         message                  = null;

            while (timeoutSecs++ < 5)
            {
                try
                {
                    // verify queue metrics
                    AssertMetric("appsSubmitted", appsSubmitted, metrics.GetAppsSubmitted());
                    AssertMetric("appsPending", appsPending, metrics.GetAppsPending());
                    AssertMetric("containersPending", containersPending, metrics.GetPendingContainers
                                     ());
                    AssertMetric("availableMB", availableMB, metrics.GetAvailableMB());
                    AssertMetric("activeApplications", activeApplications, metrics.GetActiveApps());
                    // verify node metric
                    AssertMetric("activeNodes", activeNodes, clusterMetrics.GetNumActiveNMs());
                    isAllMetricAssertionDone = true;
                    break;
                }
                catch (Exception e)
                {
                    message = e.Message;
                    System.Console.Out.WriteLine("Waiting for metrics assertion to complete");
                    Sharpen.Thread.Sleep(1000);
                }
            }
            NUnit.Framework.Assert.IsTrue(message, isAllMetricAssertionDone);
        }
示例#3
0
        public virtual void TestUnhealthyRebooting()
        {
            RMNodeImpl     node                  = GetUnhealthyNode();
            ClusterMetrics cm                    = ClusterMetrics.GetMetrics();
            int            initialActive         = cm.GetNumActiveNMs();
            int            initialLost           = cm.GetNumLostNMs();
            int            initialUnhealthy      = cm.GetUnhealthyNMs();
            int            initialDecommissioned = cm.GetNumDecommisionedNMs();
            int            initialRebooted       = cm.GetNumRebootedNMs();

            node.Handle(new RMNodeEvent(node.GetNodeID(), RMNodeEventType.Rebooting));
            NUnit.Framework.Assert.AreEqual("Active Nodes", initialActive, cm.GetNumActiveNMs
                                                ());
            NUnit.Framework.Assert.AreEqual("Lost Nodes", initialLost, cm.GetNumLostNMs());
            NUnit.Framework.Assert.AreEqual("Unhealthy Nodes", initialUnhealthy - 1, cm.GetUnhealthyNMs
                                                ());
            NUnit.Framework.Assert.AreEqual("Decommissioned Nodes", initialDecommissioned, cm
                                            .GetNumDecommisionedNMs());
            NUnit.Framework.Assert.AreEqual("Rebooted Nodes", initialRebooted + 1, cm.GetNumRebootedNMs
                                                ());
            NUnit.Framework.Assert.AreEqual(NodeState.Rebooted, node.GetState());
        }