/// <exception cref="System.Exception"/>
        public virtual void TestCheckVersion(RMStateStoreTestBase.RMStateStoreHelper stateStoreHelper
                                             )
        {
            RMStateStore store = stateStoreHelper.GetRMStateStore();

            store.SetRMDispatcher(new RMStateStoreTestBase.TestDispatcher());
            // default version
            Version defaultVersion = stateStoreHelper.GetCurrentVersion();

            store.CheckVersion();
            NUnit.Framework.Assert.AreEqual(defaultVersion, store.LoadVersion());
            // compatible version
            Version compatibleVersion = Version.NewInstance(defaultVersion.GetMajorVersion(),
                                                            defaultVersion.GetMinorVersion() + 2);

            stateStoreHelper.WriteVersion(compatibleVersion);
            NUnit.Framework.Assert.AreEqual(compatibleVersion, store.LoadVersion());
            store.CheckVersion();
            // overwrite the compatible version
            NUnit.Framework.Assert.AreEqual(defaultVersion, store.LoadVersion());
            // incompatible version
            Version incompatibleVersion = Version.NewInstance(defaultVersion.GetMajorVersion(
                                                                  ) + 2, defaultVersion.GetMinorVersion());

            stateStoreHelper.WriteVersion(incompatibleVersion);
            try
            {
                store.CheckVersion();
                NUnit.Framework.Assert.Fail("Invalid version, should fail.");
            }
            catch (Exception t)
            {
                NUnit.Framework.Assert.IsTrue(t is RMStateVersionIncompatibleException);
            }
        }
Example #2
0
        /// <exception cref="System.Exception"/>
        public virtual void TestCheckMajorVersionChange()
        {
            TestZKRMStateStore.TestZKRMStateStoreTester zkTester = new _TestZKRMStateStoreTester_176
                                                                       (this);
            // default version
            RMStateStore store          = zkTester.GetRMStateStore();
            Version      defaultVersion = zkTester.GetCurrentVersion();

            store.CheckVersion();
            NUnit.Framework.Assert.AreEqual(defaultVersion, store.LoadVersion());
        }
Example #3
0
        /// <exception cref="System.Exception"/>
        public virtual void TestCheckMajorVersionChange()
        {
            HdfsConfiguration conf    = new HdfsConfiguration();
            MiniDFSCluster    cluster = new MiniDFSCluster.Builder(conf).NumDataNodes(1).Build();

            try
            {
                fsTester = new _TestFSRMStateStoreTester_291(this, cluster, false);
                // default version
                RMStateStore store          = fsTester.GetRMStateStore();
                Version      defaultVersion = fsTester.GetCurrentVersion();
                store.CheckVersion();
                NUnit.Framework.Assert.AreEqual(defaultVersion, store.LoadVersion());
            }
            finally
            {
                cluster.Shutdown();
            }
        }