Sha256: f5f927b715060a1492eeff777bdf56f276390d88e21e5af6d431b730d7241c9b

Contents?: true

Size: 1.51 KB

Versions: 29

Compression:

Stored size: 1.51 KB

Contents

require 'spec_helper'

describe Beaker::VagrantLibvirt do
  let( :options ) { make_opts.merge({ :hosts_file => 'sample.cfg', 'logger' => double().as_null_object }) }
  let( :vagrant ) { Beaker::VagrantLibvirt.new( @hosts, options ) }

  before :each do
    @hosts = make_hosts()
  end

  it "uses the vagrant_libvirt provider for provisioning" do
    @hosts.each do |host|
      host_prev_name = host['user']
      expect( vagrant ).to receive( :set_ssh_config ).with( host, 'vagrant' ).once
      expect( vagrant ).to receive( :copy_ssh_to_root ).with( host, options ).once
      expect( vagrant ).to receive( :set_ssh_config ).with( host, host_prev_name ).once
    end
    expect( vagrant ).to receive( :hack_etc_hosts ).with( @hosts, options ).once
    FakeFS.activate!
    expect( vagrant ).to receive( :vagrant_cmd ).with( "up --provider libvirt" ).once
    vagrant.provision
  end

  context 'Correct vagrant configuration' do
    before(:each) do
      FakeFS.activate!
      path = vagrant.instance_variable_get( :@vagrant_path )
      allow( vagrant ).to receive( :randmac ).and_return( "0123456789" )

      vagrant.make_vfile( @hosts )
      @vagrantfile = File.read( File.expand_path( File.join( path, "Vagrantfile")))
    end

    it "can make a Vagranfile for a set of hosts" do
      expect( @vagrantfile ).to include( %Q{    v.vm.provider :libvirt do |node|})
    end

    it "can specify the memory as an integer" do
      expect( @vagrantfile.split("\n").map(&:strip) )
        .to include('node.memory = 512')
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
beaker-2.52.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-3.2.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-3.1.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-3.0.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.51.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.50.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.49.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.48.1 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.48.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.47.1 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.47.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.46.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.45.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.44.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.43.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.42.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.41.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.40.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.39.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb
beaker-2.38.1 spec/beaker/hypervisor/vagrant_libvirt_spec.rb