spec/unit/util/virtual_spec.rb in facter-1.6.4 vs spec/unit/util/virtual_spec.rb in facter-1.6.5

- old
+ new

@@ -1,7 +1,8 @@ -require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') +#!/usr/bin/env rspec +require 'spec_helper' require 'facter/util/virtual' describe Facter::Util::Virtual do after do @@ -77,11 +78,11 @@ FileTest.stubs(:exists?).with("/proc/self/status").returns(true) File.stubs(:read).with("/proc/self/status").returns("wibble: 42\n") Facter::Util::Virtual.should_not be_vserver end - fixture_path = File.join(SPECDIR, 'fixtures', 'virtual', 'proc_self_status') + fixture_path = fixtures('virtual', 'proc_self_status') test_cases = [ [File.join(fixture_path, 'vserver_2_1', 'guest'), true, 'vserver 2.1 guest'], [File.join(fixture_path, 'vserver_2_1', 'host'), true, 'vserver 2.1 host'], [File.join(fixture_path, 'vserver_2_3', 'guest'), true, 'vserver 2.3 guest'], @@ -144,9 +145,16 @@ it "should detect kvm on FreeBSD" do FileTest.stubs(:exists?).with("/proc/cpuinfo").returns(false) Facter.fact(:kernel).stubs(:value).returns("FreeBSD") Facter::Util::Resolution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns("QEMU Virtual CPU version 0.12.4") + Facter::Util::Virtual.should be_kvm + end + + it "should detect kvm on OpenBSD" do + FileTest.stubs(:exists?).with("/proc/cpuinfo").returns(false) + Facter.fact(:kernel).stubs(:value).returns("OpenBSD") + Facter::Util::Resolution.stubs(:exec).with("/sbin/sysctl -n hw.model").returns('QEMU Virtual CPU version (cpu64-rhel6) ("AuthenticAMD" 686-class, 512KB L2 cache)') Facter::Util::Virtual.should be_kvm end it "should identify FreeBSD jail when in jail" do Facter.fact(:kernel).stubs(:value).returns("FreeBSD")