예제 #1
0
            public void Should_Throw_If_Octo_Executable_Was_Not_Found()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture(defaultToolExist: false);

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsCakeException(result, "Octo: Could not locate executable.");
            }
예제 #2
0
            public void Should_Throw_If_Settings_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings = null;

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsArgumentNullException(result, "settings");
            }
예제 #3
0
            public void Should_Throw_If_Project_Name_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.ProjectName = null;

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsArgumentNullException(result, "projectName");
            }
예제 #4
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.GivenProcessReturnError();

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsCakeException(result, "Octo: Process returned an error.");
            }
예제 #5
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsCakeException(result, "Octo: Process was not started.");
            }
예제 #6
0
            public void Should_Find_Octo_Executable_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "/Working/tools/Octo.exe"),
                    Arg.Any <ProcessSettings>());
            }
예제 #7
0
            public void Should_Throw_If_Api_Key_Is_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.ApiKey = null;

                // When
                var result = Record.Exception(() => fixture.CreateRelease());

                // Then
                Assert.IsArgumentException(result, "settings", "No API key specified.");
            }
예제 #8
0
            public void Should_Use_Octo_Executable_From_Tool_Path_If_Provided(string toolPath, string expected)
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture(expected);

                fixture.Settings.ToolPath = toolPath;

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == expected),
                    Arg.Any <ProcessSettings>());
            }
예제 #9
0
            public void Should_Add_Enable_Service_Messages_Flag_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.EnableServiceMessages = true;

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --enableServiceMessages"));
            }
예제 #10
0
            public void Should_Add_Username_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.Username = "******";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --username \"mike123\""));
            }
예제 #11
0
            public void Should_Add_Release_Notes_File_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.ReleaseNotesFile = @"some\folder\releaseNotes.txt";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --releasenotesfile \"/Working/some/folder/releaseNotes.txt\""));
            }
예제 #12
0
            public void Should_Add_Ignore_Existing_Flag_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.IgnoreExisting = true;

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --ignoreexisting"));
            }
예제 #13
0
            public void Should_Add_Default_Package_Version_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.DefaultPackageVersion = "1.5.2-beta";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --defaultpackageversion \"1.5.2-beta\""));
            }
예제 #14
0
            public void Should_Add_Release_Notes_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.ReleaseNotes = @"No significant changes in this version...";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --releasenotes \"No significant changes in this version...\""));
            }
예제 #15
0
            public void Should_Add_Release_Number_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.ReleaseNumber = "3.0.0";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --releaseNumber \"3.0.0\""));
            }
예제 #16
0
            public void Should_Add_Password_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.Password = "******";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --password \"secret\""));
            }
예제 #17
0
            public void Should_Add_Configuration_File_To_Arguments_If_Not_Null()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.ConfigurationFile = "configFile.txt";

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --configFile \"/Working/configFile.txt\""));
            }
예제 #18
0
            public void Should_Add_Package_And_Step_To_Arguments_If_Specified()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.Settings.Packages = new Dictionary <string, string>
                {
                    { "StepA", "1.0.1" }
                };

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() ==
                                             fixture.GetDefaultArguments() + " --package \"StepA:1.0.1\""));
            }
예제 #19
0
            public void Should_Add_Project_Name_Server_And_Api_Key_To_Arguments()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.ProjectName = "myProject";
                fixture.Settings    = new CreateReleaseSettings
                {
                    Server = "http://myoctopusserver/",
                    ApiKey = "API-ABCDEF123456"
                };

                // When
                fixture.CreateRelease();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.Render() == "create-release --project \"myProject\" --server http://myoctopusserver/ --apiKey API-ABCDEF123456"));
            }
예제 #20
0
            public void Should_Redact_Api_Key_And_Password_Arguments()
            {
                // Given
                var fixture = new OctopusDeployReleaseCreatorFixture();

                fixture.ProjectName = "myProject";
                fixture.Settings    = new CreateReleaseSettings
                {
                    Server   = "http://myoctopusserver/",
                    ApiKey   = "API-ABCDEF123456",
                    Password = "******"
                };

                // When
                fixture.CreateRelease();
                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(p =>
                                             p.Arguments.RenderSafe() ==
                                             "create-release --project \"myProject\" --server http://myoctopusserver/ --apiKey [REDACTED] --password \"[REDACTED]\""));
            }