예제 #1
0
        public void TestThatRoundRobinLoadBlancingWithOneServerAndManuelTestWorks()
        {
            var config = new ConDepConfig {
                EnvironmentName = "bogusEnv"
            };
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };

            config.Servers = new[] { server1 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence         = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer           = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();

            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, true, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #2
0
        public void TestThatRoundRobinLoadBlancingWithOneServerWorks()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };

            _settingsDefault.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("online"));
        }
예제 #3
0
        public void TestThatStickyLoadBlancingWithOneServerAndManuelTestWorks()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #4
0
        public void TestThatStickyWithContinueAfterManualTestExecutesOnCorrectServers()
        {
            var config = new ConDepConfig {
                EnvironmentName = "bogusEnv"
            };
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03"
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence         = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer           = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();

            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, true, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            var serverNumber = 2;

            for (int i = 1; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #5
0
        public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var config = new ConDepConfig { EnvironmentName = "bogusEnv" };
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();
            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(config.Servers.Count * 2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item2, Is.EqualTo("online"));
        }
예제 #6
0
        public void TestThatStickyWithContinueAfterManualTestExecutesOnCorrectServers()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03"
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.Config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            var serverNumber = 2;

            for (int i = 1; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #7
0
        public void TestThatStickyLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03"
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.Config.Servers.Count * 2));

            var serverNumber = 1;

            for (int i = 0; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #8
0
        public void TestThatRoundRobinLoadBlancingWithOneServerAndContinueWorks()
        {
            var config = new ConDepConfig { EnvironmentName = "bogusEnv" };
            var server1 = new ServerConfig { Name = "jat-web01" };

            config.Servers = new[] { server1 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();
            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, true, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));
        }
예제 #9
0
        public void TestThatRoundRobinWithContinueAfterManuelTestOnSpecificServerExecuteCorrectServers()
        {
            var config = new ConDepConfig {
                EnvironmentName = "bogusEnv"
            };
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03", StopServer = true
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence         = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer           = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();

            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, true, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #10
0
        public void TestThatRoundRobinWithContinueAfterManuelTestOnSpecificServerExecuteCorrectServers()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03", StopServer = true
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #11
0
        public void TestThatStickyWithContinueAfterManualTestExecutesOnCorrectServers()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.Config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            var serverNumber = 2;
            for (int i = 1; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #12
0
        public void TestThatStickyLoadBlancingWithOneServerWorks()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };

            _settingsDefault.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);
            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.Config.Servers.Count * 2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("online"));
        }
예제 #13
0
        public void TestThatStickyLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.Config.Servers.Count * 2));

            var serverNumber = 1;
            for (int i = 0; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #14
0
        public void TestThatRoundRobinWithManualTestStopsAfterFirstServer()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #15
0
        public void TestThatRoundRobinLoadBlancingWithOneServerAndManuelTestWorks()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };

            _settingsStopAfterMarkedServer.Config.Servers = new[] { server1 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin };

            var sequnceManager = new ExecutionSequenceManager(_settingsStopAfterMarkedServer.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsStopAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsStopAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));
        }
예제 #16
0
        public void TestThatStickyWithContinueAfterManualTestOnSpecificServerExecutesOnCorrectServers()
        {
            var config = new ConDepConfig { EnvironmentName = "bogusEnv" };
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03", StopServer = true };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();
            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, true, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));
        }
예제 #17
0
        public void TestThatStickyLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var config = new ConDepConfig { EnvironmentName = "bogusEnv" };
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();
            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(config.Servers.Count * 2));

            var serverNumber = 1;
            for (int i = 0; i < loadBalancer.OnlineOfflineSequence.Count; i += 2)
            {
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i].Item2, Is.EqualTo("offline"));

                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item1, Is.EqualTo("jat-web0" + serverNumber));
                Assert.That(loadBalancer.OnlineOfflineSequence[i + 1].Item2, Is.EqualTo("online"));
                serverNumber++;
            }
        }
예제 #18
0
        public void TestThatStickyWithContinueAfterManualTestOnSpecificServerExecutesOnCorrectServers()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03", StopServer = true };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.Sticky };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.Config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));
        }
예제 #19
0
        public void TestThatStickyWithContinueAfterManualTestOnSpecificServerExecutesOnCorrectServers()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03", StopServer = true
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            _settingsContinueAfterMarkedServer.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.Sticky
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsContinueAfterMarkedServer.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsContinueAfterMarkedServer, _token);
            sequnceManager.Execute(status, _settingsContinueAfterMarkedServer, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(((_settingsContinueAfterMarkedServer.Config.Servers.Count - 1) * 2) + 1));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));
        }
예제 #20
0
        public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03"
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);

            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();

            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);


            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.Config.Servers.Count * 2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item2, Is.EqualTo("online"));
        }
예제 #21
0
        public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var server1 = new ServerConfig { Name = "jat-web01" };
            var server2 = new ServerConfig { Name = "jat-web02" };
            var server3 = new ServerConfig { Name = "jat-web03" };
            var server4 = new ServerConfig { Name = "jat-web04" };
            var server5 = new ServerConfig { Name = "jat-web05" };

            _settingsDefault.Config.Servers = new[] { server1, server2, server3, server4, server5 };

            var loadBalancer = new MockLoadBalancer { Mode = LbMode.RoundRobin };

            var sequnceManager = new ExecutionSequenceManager(_settingsDefault.Config.Servers, loadBalancer);
            sequnceManager.NewRemoteSequence("Test");

            var status = new StatusReporter();
            //remoteSequence.Execute(status, _settingsDefault, _token);
            sequnceManager.Execute(status, _settingsDefault, _token);

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(_settingsDefault.Config.Servers.Count * 2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item2, Is.EqualTo("online"));
        }
예제 #22
0
        public void TestThatRoundRobinLoadBalancingGoesOnlineOfflineInCorrectOrder()
        {
            var config = new ConDepConfig {
                EnvironmentName = "bogusEnv"
            };
            var server1 = new ServerConfig {
                Name = "jat-web01"
            };
            var server2 = new ServerConfig {
                Name = "jat-web02"
            };
            var server3 = new ServerConfig {
                Name = "jat-web03"
            };
            var server4 = new ServerConfig {
                Name = "jat-web04"
            };
            var server5 = new ServerConfig {
                Name = "jat-web05"
            };

            config.Servers = new[] { server1, server2, server3, server4, server5 };

            var infrastructureSequence = new InfrastructureSequence();
            var preOpsSequence         = new PreOpsSequence(new WebDeployHandlerMock());
            var loadBalancer           = new MockLoadBalancer {
                Mode = LbMode.RoundRobin
            };

            var remoteSequence = new RemoteSequence(infrastructureSequence, preOpsSequence, config.Servers, loadBalancer);

            var status = new StatusReporter();

            remoteSequence.Execute(status, new ConDepOptions(false, "", false, true, false, false, null));

            Assert.That(loadBalancer.OnlineOfflineSequence.Count, Is.EqualTo(config.Servers.Count * 2));

            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[0].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[1].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[2].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item1, Is.EqualTo("jat-web01"));
            Assert.That(loadBalancer.OnlineOfflineSequence[3].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item1, Is.EqualTo("jat-web02"));
            Assert.That(loadBalancer.OnlineOfflineSequence[4].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item1, Is.EqualTo("jat-web03"));
            Assert.That(loadBalancer.OnlineOfflineSequence[5].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[6].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[7].Item2, Is.EqualTo("offline"));

            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item1, Is.EqualTo("jat-web04"));
            Assert.That(loadBalancer.OnlineOfflineSequence[8].Item2, Is.EqualTo("online"));

            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item1, Is.EqualTo("jat-web05"));
            Assert.That(loadBalancer.OnlineOfflineSequence[9].Item2, Is.EqualTo("online"));
        }