[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 2.6.5-303-gfcfa26a
Max Martin
max at puppetlabs.com
Thu Mar 17 10:49:07 UTC 2011
The following commit has been merged in the upstream branch:
commit 7764412aacb4132d40561e2ba47d52f5e333c16e
Author: Max Martin <max at puppetlabs.com>
Date: Tue Mar 8 16:20:53 2011 -0800
maint:Refactor of mount provider integration tests
When adding a test for #6309, decided to refactor mount provider
integration tests by adding return value to check_fstab method.
Paired-with:Paul Berry <paul at puppetlabs.com>
diff --git a/spec/integration/provider/mount_spec.rb b/spec/integration/provider/mount_spec.rb
index a62505d..d6f25fe 100644
--- a/spec/integration/provider/mount_spec.rb
+++ b/spec/integration/provider/mount_spec.rb
@@ -16,6 +16,7 @@ describe "mount provider (integration)" do
before :each do
@fake_fstab = tmpfile('fstab')
@current_options = "local"
+ @current_device = "/dev/disk1s1"
Puppet::Type.type(:mount).defaultprovider.stubs(:default_target).returns(@fake_fstab)
Facter.stubs(:value).with(:operatingsystem).returns('Darwin')
Puppet::Util::ExecutionStub.set do |command, options|
@@ -23,7 +24,7 @@ describe "mount provider (integration)" do
when %r{/s?bin/mount}
if command.length == 1
if @mounted
- "/dev/disk1s1 on /Volumes/foo_disk (msdos, #{@current_options})\n"
+ "#{@current_device} on /Volumes/foo_disk (msdos, #{@current_options})\n"
else
''
end
@@ -33,7 +34,7 @@ describe "mount provider (integration)" do
command[3].should == '/Volumes/foo_disk'
@mounted.should == false # verify that we don't try to call "mount" redundantly
@current_options = command[2]
- check_fstab(true)
+ @current_device = check_fstab(true)
@mounted = true
''
end
@@ -55,8 +56,16 @@ describe "mount provider (integration)" do
def check_fstab(expected_to_be_present)
# Verify that the fake fstab has the expected data in it
- expected_data = expected_to_be_present ? ["/dev/disk1s1\t/Volumes/foo_disk\tmsdos\t#{@desired_options}\t0\t0"] : []
- File.read(@fake_fstab).lines.map(&:chomp).reject { |x| x =~ /^#|^$/ }.should == expected_data
+ fstab_contents = File.read(@fake_fstab).lines.map(&:chomp).reject { |x| x =~ /^#|^$/ }
+ if expected_to_be_present
+ fstab_contents.length().should == 1
+ device, rest_of_line = fstab_contents[0].split(/\t/,2)
+ rest_of_line.should == "/Volumes/foo_disk\tmsdos\t#{@desired_options}\t0\t0"
+ device
+ else
+ fstab_contents.length().should == 0
+ nil
+ end
end
def run_in_catalog(settings)
@@ -101,7 +110,11 @@ describe "mount provider (integration)" do
@desired_options = options_setting
run_in_catalog(:ensure=>ensure_setting, :options => options_setting)
@mounted.should == expected_final_state
- check_fstab(expected_fstab_data)
+ if expected_fstab_data
+ check_fstab(expected_fstab_data).should == "/dev/disk1s1"
+ else
+ check_fstab(expected_fstab_data).should == nil
+ end
if @mounted
if ![:defined, :present].include?(ensure_setting)
@current_options.should == @desired_options
@@ -120,4 +133,19 @@ describe "mount provider (integration)" do
end
end
end
+
+ describe "When the wrong device is mounted" do
+ it "should remount the correct device" do
+ pending "Due to bug 6309"
+ @mounted = true
+ @current_device = "/dev/disk2s2"
+ create_fake_fstab(true)
+ @desired_options = "local"
+ run_in_catalog(:ensure=>:mounted, :options=>'local')
+ @current_device.should=="/dev/disk1s1"
+ @mounted.should==true
+ @current_options.should=='local'
+ check_fstab(true).should == "/dev/disk1s1"
+ end
+ end
end
--
Puppet packaging for Debian
More information about the Pkg-puppet-devel
mailing list