Sha256: 72acbb58da86c925e72d5d7cbd7fea85c0ec6073555d9f0fc0a6afe36d9340a8

Contents?: true

Size: 1.54 KB

Versions: 39

Compression:

Stored size: 1.54 KB

Contents

require 'spec_helper'

describe Specinfra::HostInventory::Virtualization do
  before :all do
    set :os, { :family => 'linux' }
  end

  virt = Specinfra::HostInventory::Virtualization.new(host_inventory) 
  let(:host_inventory) { nil }
  it 'Docker Image should return :system => "docker"' do
    allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do 
      CommandResult.new(:stdout => '/.dockerinit', :exit_status => 0)
    end  
    expect(virt.get).to include(:system => 'docker')
  end

  let(:host_inventory) { nil }
  it 'Debian Wheezy on OpenVZ should return :system => "openvz"' do
    allow(virt.backend).to receive(:run_command).with('ls /.dockerinit') do
      CommandResult.new(:stdout => '', :exit_status => 2)
    end 
    allow(virt.backend).to receive(:run_command).with('test -d /proc/vz -a ! -d /proc/bc') do
      CommandResult.new(:stdout => '', :exit_status => 0)
    end 
    expect(virt.get).to include(:system => 'openvz')
  end

  let(:host_inventory) { nil }
  it 'Debian Jessie on KVM should return :system => "kvm"' do
    ret = virt.parse_system_product_name("KVM\n")
    expect(ret).to include('kvm')
  end

  let(:host_inventory) { nil }
  it 'CentOS 6.7 on VMware should return :system => "vmware"' do
    ret = virt.parse_system_product_name("VMware Virtual Platform\n")
    expect(ret).to include('vmware')
  end

  let(:host_inventory) { nil }
  it 'Ubuntu 14.04 on VirtualBox should return :system => "vbox"' do
    ret = virt.parse_system_product_name("VirtualBox\n")
    expect(ret).to include('vbox')
  end

end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
specinfra-2.67.7 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.6 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.5 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.3 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.2 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.1 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.67.0 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.9 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.8 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.7 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.6 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.5 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.4 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.3 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.2 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.1 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.66.0 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.65.0 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.64.0 spec/host_inventory/linux/virtualization_spec.rb
specinfra-2.63.3 spec/host_inventory/linux/virtualization_spec.rb