Пример #1
0
        public void ShouldReportUnhealthyTest()
        {
            FaultInjectionConfig config;
            StandAloneCluster    cluster = Utility.PopulateStandAloneClusterWithBaselineJson("myClusterConfig.UnSecure.DevCluster.json");

            cluster.TargetNodeConfig = new ClusterNodeConfig(null, 0);

            config = new FaultInjectionConfig(UpgradeFlow.RollingForward, 0);

            StandAloneSimpleClusterUpgradeState upgradeState1 = new StandAloneSimpleClusterUpgradeState(cluster.TargetCsmConfig, cluster.TargetWrpConfig, cluster.TargetNodeConfig, cluster, new StandAloneTraceLogger("StandAloneDeploymentManager"));

            Assert.IsTrue(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState1, UpgradeFlow.RollingForward, config));
            Assert.IsFalse(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState1, UpgradeFlow.RollingBack, config));

            MockUpMultiphaseClusterUpgradeState upgradeState2 = new MockUpMultiphaseClusterUpgradeState(2, cluster);

            upgradeState2.CurrentListIndex = 0;
            Assert.IsTrue(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState2, UpgradeFlow.RollingForward, config));
            Assert.IsFalse(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState2, UpgradeFlow.RollingBack, config));
            upgradeState2.CurrentListIndex = 1;
            Assert.IsFalse(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState2, UpgradeFlow.RollingForward, config));

            config = new FaultInjectionConfig(UpgradeFlow.RollingForward, 1);
            Assert.IsFalse(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState1, UpgradeFlow.RollingForward, config));
            Assert.IsTrue(FaultInjectionHelper.ShouldReportUnhealthy(upgradeState2, UpgradeFlow.RollingForward, config));
        }
Пример #2
0
        public void GetUpgradeFlowTest()
        {
            StandAloneCluster cluster = Utility.PopulateStandAloneClusterWithBaselineJson("myClusterConfig.UnSecure.DevCluster.json");

            cluster.TargetNodeConfig = new ClusterNodeConfig(null, 0);

            StandAloneSimpleClusterUpgradeState upgradeState1 = new StandAloneSimpleClusterUpgradeState(cluster.TargetCsmConfig, cluster.TargetWrpConfig, cluster.TargetNodeConfig, cluster, new StandAloneTraceLogger("StandAloneDeploymentManager"));

            Assert.AreEqual(UpgradeFlow.RollingForward, FaultInjectionHelper.GetUpgradeFlow(upgradeState1));

            MockUpMultiphaseClusterUpgradeState upgradeState2 = new MockUpMultiphaseClusterUpgradeState(2, cluster);

            upgradeState2.UpgradeUnsuccessful = false;
            Assert.AreEqual(UpgradeFlow.RollingForward, FaultInjectionHelper.GetUpgradeFlow(upgradeState2));

            upgradeState2.UpgradeUnsuccessful = true;
            Assert.AreEqual(UpgradeFlow.RollingBack, FaultInjectionHelper.GetUpgradeFlow(upgradeState2));
        }