Exemplo n.º 1
0
        public void Should_Use_OutputPath_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.OutputToFile("test/vagrant")));
            var result  = fixture.Run();

            result.Args.Should().Be("init --output \"test/vagrant\" hashicorp/precise64");
        }
Exemplo n.º 2
0
        public void Should_Use_Minimal_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.CreateMinimal()));
            var result  = fixture.Run();

            result.Args.Should().Be("init --minimal hashicorp/precise64");
        }
Exemplo n.º 3
0
        public void Should_Use_Version_Constraint_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.ConstrainVersion("> 0.1.5")));
            var result  = fixture.Run();

            result.Args.Should().Be("init --box-version \"> 0.1.5\" hashicorp/precise64");
        }
Exemplo n.º 4
0
        public void Should_Use_Force_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Init("hashicorp/precise64", s => s.Force()));
            var result  = fixture.Run();

            result.Args.Should().Be($"init --force hashicorp/precise64");
        }
Exemplo n.º 5
0
        public void Should_Include_Output_Path_When_Set(string path)
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.OutputToFile(path)));
            var result  = fixture.Run();

            result.Args.Should().Be("package --output sample.box");
        }
Exemplo n.º 6
0
        public void Should_Fail_When_Command_Not_Provided()
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.WithArguments("arg1")));
            var result  = Record.Exception(() => fixture.Run());

            result.Should().BeOfType <ArgumentOutOfRangeException>();
        }
Exemplo n.º 7
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Resume());
            var result  = fixture.Run();

            result.Args.Should().Be("resume");
        }
Exemplo n.º 8
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Destroy());
            var result  = fixture.Run();

            result.Args.Should().Be("destroy --force");
        }
Exemplo n.º 9
0
        public void Should_Include_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Destroy("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("destroy web --force");
        }
Exemplo n.º 10
0
        public void Should_Load_Vagrantfile()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.IncludeVagrantFile("./src/Vagrantfile")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --vagrantfile src/Vagrantfile");
        }
Exemplo n.º 11
0
        public void Should_Run_With_Defaults()
        {
            var fixture = new VagrantFixture(r => r.Up());
            var result  = fixture.Run();

            result.Process.WorkingDirectory.FullPath.Should().Be("/Working");
        }
Exemplo n.º 12
0
        public void Should_Include_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Resume("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("resume web");
        }
Exemplo n.º 13
0
        public void Should_Include_Single_File()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.IncludeInPackage("./file")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --include file");
        }
Exemplo n.º 14
0
        public void Should_Use_Name_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Up("web"));
            var result  = fixture.Run();

            result.Args.Should().Be("up web");
        }
Exemplo n.º 15
0
        public void Should_Use_Parallel_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.EnableParallel()));
            var result  = fixture.Run();

            result.Args.Should().Be("up --parallel");
        }
Exemplo n.º 16
0
        public void Should_Use_Destroy_When_Set(bool enableDestroy, string flagValue)
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.DestroyOnError(enableDestroy)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {flagValue}");
        }
Exemplo n.º 17
0
        public void Should_Install_Provider_When_Set(bool enable, string flagValue)
        {
            var fixture = new VagrantFixture(r => r.Up(s => s.InstallProvider(enable)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {flagValue}");
        }
Exemplo n.º 18
0
        public void Should_Use_Provider_When_Set(string imageName, string providerName)
        {
            var fixture = new VagrantFixture(r => r.Up(imageName, s => s.UseProvider(providerName)));
            var result  = fixture.Run();

            result.Args.Should().Be($"up {imageName} --provider {providerName}");
        }
Exemplo n.º 19
0
        public void Should_Include_Force_When_Set()
        {
            var fixture = new VagrantFixture(r => r.Halt(force: true));
            var result  = fixture.Run();

            result.Args.Should().Be("halt --force");
        }
Exemplo n.º 20
0
        public void Should_Throw_On_NonExistent_Directory()
        {
            var fixture = new VagrantFixture(r => r.FromPath("./fake").Up());
            var action  = new Action(() => fixture.Run());

            action.ShouldThrow <DirectoryNotFoundException>().Where(e => e.Message.Contains("fake"));
        }
Exemplo n.º 21
0
        public void Should_Use_Provision_When_Explicitly_Set()
        {
            var fixture = new VagrantFixture(r => r.Resume(s => s.RunProvisioners()));
            var result  = fixture.Run();

            result.Args.Should().Be("resume --provision");
        }
Exemplo n.º 22
0
        public void Should_Run_With_Defaults(string imageName)
        {
            var fixture = new VagrantFixture(r => r.Init(imageName));
            var result  = fixture.Run();

            result.Args.Should().Be($"init {imageName}");
        }
Exemplo n.º 23
0
        public void Should_Use_Provisioners()
        {
            var fixture = new VagrantFixture(r => r.Resume(s => s.WithProvisioners("chef", "shell")));
            var result  = fixture.Run();

            result.Args.Should().Be("resume --provision --provision-with chef,shell");
        }
Exemplo n.º 24
0
        public void Should_Use_BaseName()
        {
            var fixture = new VagrantFixture(r => r.Package(s => s.UseBaseImage("vbox-vm")));
            var result  = fixture.Run();

            result.Args.Should().Be("package --base vbox-vm");
        }
Exemplo n.º 25
0
        public void Should_Fail_When_Command_Not_Provided()
        {
            var fixture = new VagrantFixture(r => r.PowerShell(s => s.RunCommand(null)));
            var result  = Record.Exception(() => fixture.Run());

            result.Should().BeOfType <ArgumentOutOfRangeException>();
        }
Exemplo n.º 26
0
        public void Should_Include_Extra_Args_When_Set(string args)
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.RunCommand("echo").WithArguments(args)));
            var result  = fixture.Run();

            result.Args.Should().Be($"ssh --command \"echo\" -- {args}");
        }
Exemplo n.º 27
0
        public void Should_Set_Command_When_Provided(string command)
        {
            var fixture = new VagrantFixture(r => r.SSH(s => s.RunCommand(command)));
            var result  = fixture.Run();

            result.Args.Should().Be($"ssh --command \"{command}\"");
        }
Exemplo n.º 28
0
        public void Should_Find_Executable_If_Tool_Path_Not_Provided()
        {
            // Given
            var fixture = new VagrantFixture(r => r.Up());
            var result  = fixture.Run();

            result.Path.FullPath.Should().Be("/Working/tools/vagrant.exe");
        }
Exemplo n.º 29
0
        public void Should_Set_Valid_DirectoryPath()
        {
            var fixture = new VagrantFixture(r => r.FromPath("./vm").Up());

            fixture.FileSystem.CreateDirectory("./vm");

            var result = fixture.Run();

            result.Process.WorkingDirectory.FullPath.Should().Be("/Working/vm");
        }
Exemplo n.º 30
0
        public void Should_Throw_If_Process_Was_Not_Started()
        {
            // Given
            var fixture = new VagrantFixture(r => r.Up());

            fixture.GivenProcessCannotStart();
            var action = new Action(() => fixture.Run());

            action.ShouldThrow <CakeException>().WithMessage("Vagrant by Hashicorp: Process was not started.");
        }