コード例 #1
0
        public void ShouldRaiseErrorWhenDeploymentsTakeLongerThanExpected()
        {
            var log     = Substitute.For <ILog>();
            var session = Substitute.For <IOctopusSession>();

            session.Get <Task>(Arg.Any <String>()).Returns(new Task {
                State = "Executing"
            });

            var watcher = new DeploymentWatcher(log);

            watcher.WaitForDeploymentsToFinish(session, new[] { "link" }, TimeSpan.FromSeconds(0.5), TimeSpan.FromSeconds(0.5));
        }
コード例 #2
0
        public void ShouldRaiseErrorWhenOneOfTheDeploymentTasksFailed()
        {
            var log     = Substitute.For <ILog>();
            var session = Substitute.For <IOctopusSession>();

            session.Get <Task>(Arg.Any <String>()).Returns(new Task {
                State = "Failed", Links = new Dictionary <string, string> {
                    { "Web", "Foo" }
                }
            });

            var watcher = new DeploymentWatcher(log);

            watcher.WaitForDeploymentsToFinish(session, new[] { "link" }, TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(0.5));
        }
コード例 #3
0
        public void ShouldWaitForDeploymentsToFinish()
        {
            var log     = Substitute.For <ILog>();
            var session = Substitute.For <IOctopusSession>();

            session.Get <Task>(Arg.Any <String>()).Returns(CreateTask("Executing"), CreateTask("Executing"), CreateTask("Success"));

            var watcher = new DeploymentWatcher(log);

            var stopwatch = Stopwatch.StartNew();

            watcher.WaitForDeploymentsToFinish(session, new[] { "link" }, TimeSpan.FromSeconds(10), TimeSpan.FromSeconds(0.5));
            stopwatch.Stop();

            Assert.IsTrue(stopwatch.Elapsed >= TimeSpan.FromSeconds(1));
        }