Sha256: fe52dc7e2c233e6599eb73c01a3a0f5241631d5cc61df564ac60283b6c9a1af0

Contents?: true

Size: 1.26 KB

Versions: 41

Compression:

Stored size: 1.26 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

  it "can make a Vagranfile for a set of hosts" 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")))
    expect( vagrantfile ).to include( %Q{    v.vm.provider :libvirt})
  end
end

Version data entries

41 entries across 41 versions & 1 rubygems

Version Path
beaker-2.0.0 spec/beaker/hypervisor/vagrant_libvirt_spec.rb