spec/host_inventory/linux/virtualization_spec.rb in specinfra-2.67.7 vs spec/host_inventory/linux/virtualization_spec.rb in specinfra-2.67.8

- old
+ new

@@ -3,26 +3,26 @@ describe Specinfra::HostInventory::Virtualization do before :all do set :os, { :family => 'linux' } end - virt = Specinfra::HostInventory::Virtualization.new(host_inventory) + 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 + allow(virt.backend).to receive(:run_command).with('grep -Eqa \'docker(/|-[0-9a-f]+)\' /proc/1/cgroup||test -e /.dockerinit') do + CommandResult.new(:stdout => '', :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 + allow(virt.backend).to receive(:run_command).with('grep -Eqa \'docker(/|-[0-9a-f]+)\' /proc/1/cgroup||test -e /.dockerinit') do CommandResult.new(:stdout => '', :exit_status => 2) - end + 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 + end expect(virt.get).to include(:system => 'openvz') end let(:host_inventory) { nil } it 'Debian Jessie on KVM should return :system => "kvm"' do