Fixing all tests that were apparently broken in the 0.24.x merge.

Signed-off-by: Luke Kanies <luke@madstop.com>
This commit is contained in:
Luke Kanies 2009-04-02 19:41:17 -05:00
Родитель e016307f00
Коммит a677e26eb1
8 изменённых файлов: 13 добавлений и 18 удалений

Просмотреть файл

@ -1,5 +1,5 @@
# A reference to a resource. Mostly just the type and title.
require 'puppet/resource_reference'
require 'puppet/resource/reference'
require 'puppet/file_collection/lookup'
# A reference to a resource. Mostly just the type and title.

Просмотреть файл

@ -153,7 +153,7 @@ module Puppet::Util::SELinux
# Internal helper function to read and parse /proc/mounts
def read_mounts
begin
mountfh = File.open("/proc/mounts", NONBLOCK)
mountfh = File.open("/proc/mounts", File::NONBLOCK)
mounts = mountfh.read
mountfh.close
rescue

Просмотреть файл

@ -50,7 +50,8 @@ describe "puppetmasterd" do
args = arguments + addl_args
output = %x{puppetmasterd #{args}}.chomp
bin = File.join(File.dirname(__FILE__), "..", "..", "..", "sbin", "puppetmasterd")
output = %x{#{bin} #{args}}.chomp
end
def stop

Просмотреть файл

@ -209,6 +209,7 @@ describe provider_class do
augeas_stub = stub("augeas", :match => ["set", "of", "values"])
augeas_stub.stubs("close")
provider = provider_class.new(resource)
provider.aug= augeas_stub
provider.stubs(:get_augeas_version).returns("0.3.5")
provider.need_to_run?.should == true
end

Просмотреть файл

@ -6,7 +6,7 @@ require 'puppet/transaction'
describe Puppet::Transaction do
it "should match resources by name, not title, when prefetching" do
@catalog = Puppet::Node::Catalog.new
@catalog = Puppet::Resource::Catalog.new
@transaction = Puppet::Transaction.new(@catalog)
# Have both a title and name

Просмотреть файл

@ -10,19 +10,12 @@ describe tidy do
end
it "should use :lstat when stating a file" do
tidy = Puppet::Type.type(:tidy).new :path => "/foo/bar", :age => "1d"
resource = tidy.new :path => "/foo/bar", :age => "1d"
stat = mock 'stat'
File.expects(:lstat).with("/foo/bar").returns stat
tidy.stat("/foo/bar").should == stat
resource.stat("/foo/bar").should == stat
end
it "should be in sync if the targeted file does not exist" do
File.expects(:lstat).with("/tmp/foonesslaters").raises Errno::ENOENT
@tidy = tidy.create :path => "/tmp/foonesslaters", :age => "100d"
@tidy.property(:ensure).must be_insync({})
end
[:age, :size, :path, :matches, :type, :recurse, :rmdirs].each do |param|
it "should have a %s parameter" % param do
Puppet::Type.type(:tidy).attrclass(param).ancestors.should be_include(Puppet::Parameter)

Просмотреть файл

@ -31,7 +31,10 @@ describe Puppet::Util::SELinux do
describe "filesystem detection" do
before :each do
File.expects(:read).with("/proc/mounts").returns "rootfs / rootfs rw 0 0\n/dev/root / ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0\n/dev /dev tmpfs rw,relatime,mode=755 0 0\n/proc /proc proc rw,relatime 0 0\n/sys /sys sysfs rw,relatime 0 0\n192.168.1.1:/var/export /mnt/nfs nfs rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,nointr,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.1,mountvers=3,mountproto=udp,addr=192.168.1.1 0 0\n"
fh = stub 'fh', :close => nil
File.stubs(:open).with("/proc/mounts", File::NONBLOCK).returns fh
fh.stubs(:read).returns "rootfs / rootfs rw 0 0\n/dev/root / ext3 rw,relatime,errors=continue,user_xattr,acl,data=ordered 0 0\n/dev /dev tmpfs rw,relatime,mode=755 0 0\n/proc /proc proc rw,relatime 0 0\n/sys /sys sysfs rw,relatime 0 0\n192.168.1.1:/var/export /mnt/nfs nfs rw,relatime,vers=3,rsize=32768,wsize=32768,namlen=255,hard,nointr,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=192.168.1.1,mountvers=3,mountproto=udp,addr=192.168.1.1 0 0\n"
fh.stubs(:close)
end
it "should parse the contents of /proc/mounts" do

Просмотреть файл

@ -42,10 +42,7 @@ class TestResourceClient < Test::Unit::TestCase
assert_instance_of(Puppet::TransObject, tresource)
resource = tresource.to_ral
assert_events([], resource)
File.unlink(file)
assert_events([:file_created], resource)
File.unlink(file)
assert_equal(File.stat(file).mode & 007777, resource[:mode], "Did not get mode")
# Now test applying
result = client.apply(tresource)