Ejemplo n.º 1
0
        public virtual void TestAllocResponseId()
        {
            ApplicationMasterProtocol scheduler = new TestLocalContainerAllocator.MockScheduler
                                                      ();
            Configuration           conf = new Configuration();
            LocalContainerAllocator lca  = new TestLocalContainerAllocator.StubbedLocalContainerAllocator
                                               (scheduler);

            lca.Init(conf);
            lca.Start();
            // do two heartbeats to verify the response ID is being tracked
            lca.Heartbeat();
            lca.Heartbeat();
            lca.Close();
        }
Ejemplo n.º 2
0
        public virtual void TestRMConnectionRetry()
        {
            // verify the connection exception is thrown
            // if we haven't exhausted the retry interval
            ApplicationMasterProtocol mockScheduler = Org.Mockito.Mockito.Mock <ApplicationMasterProtocol
                                                                                >();

            Org.Mockito.Mockito.When(mockScheduler.Allocate(Matchers.IsA <AllocateRequest>()))
            .ThenThrow(RPCUtil.GetRemoteException(new IOException("forcefail")));
            Configuration           conf = new Configuration();
            LocalContainerAllocator lca  = new TestLocalContainerAllocator.StubbedLocalContainerAllocator
                                               (mockScheduler);

            lca.Init(conf);
            lca.Start();
            try
            {
                lca.Heartbeat();
                NUnit.Framework.Assert.Fail("heartbeat was supposed to throw");
            }
            catch (YarnException)
            {
            }
            finally
            {
                // YarnException is expected
                lca.Stop();
            }
            // verify YarnRuntimeException is thrown when the retry interval has expired
            conf.SetLong(MRJobConfig.MrAmToRmWaitIntervalMs, 0);
            lca = new TestLocalContainerAllocator.StubbedLocalContainerAllocator(mockScheduler
                                                                                 );
            lca.Init(conf);
            lca.Start();
            try
            {
                lca.Heartbeat();
                NUnit.Framework.Assert.Fail("heartbeat was supposed to throw");
            }
            catch (YarnRuntimeException)
            {
            }
            finally
            {
                // YarnRuntimeException is expected
                lca.Stop();
            }
        }