place empty iso in tmp directory

This commit is contained in:
Christoph Hartmann 2016-02-01 17:00:44 +01:00
parent 914a4bf424
commit ea085ef7c0
3 changed files with 6 additions and 5 deletions

View file

@ -9,7 +9,7 @@ when 'ubuntu', 'rhel', 'centos', 'fedora'
# copy iso file for mount tests # copy iso file for mount tests
# NB created using `mkdir empty; mkisofs -o empty.iso empty/` # NB created using `mkdir empty; mkisofs -o empty.iso empty/`
cookbook_file '/root/empty.iso' do cookbook_file '/tmp/empty.iso' do
owner 'root' owner 'root'
group 'root' group 'root'
mode '0755' mode '0755'
@ -26,7 +26,7 @@ when 'ubuntu', 'rhel', 'centos', 'fedora'
# mount -o loop /root/empty.iso /mnt/iso-disk # mount -o loop /root/empty.iso /mnt/iso-disk
mount '/mnt/iso-disk' do mount '/mnt/iso-disk' do
device '/root/empty.iso' device '/tmp/empty.iso'
options 'loop' options 'loop'
action [:mount, :enable] action [:mount, :enable]
end end

View file

@ -125,6 +125,7 @@ if os.unix?
end end
end end
# check file mount on linux
if os.linux? if os.linux?
# for server spec compatibility # for server spec compatibility
# Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed # Do not use `.with` or `.only_with`, this syntax is deprecated and will be removed
@ -133,7 +134,7 @@ if os.linux?
it { should be_mounted } it { should be_mounted }
it { should be_mounted.with( :type => 'iso9660' ) } it { should be_mounted.with( :type => 'iso9660' ) }
it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) } it { should be_mounted.with( :type => 'iso9660', :options => { :ro => true } ) }
it { should be_mounted.with( :type => 'iso9660', :device => '/root/empty.iso' ) } it { should be_mounted.with( :type => 'iso9660', :device => '/tmp/empty.iso' ) }
it { should_not be_mounted.with( :type => 'ext4' ) } it { should_not be_mounted.with( :type => 'ext4' ) }
it { should_not be_mounted.with( :type => 'xfs' ) } it { should_not be_mounted.with( :type => 'xfs' ) }
end end
@ -142,7 +143,7 @@ if os.linux?
# also see mount_spec.rb # also see mount_spec.rb
describe file('/mnt/iso-disk') do describe file('/mnt/iso-disk') do
it { should be_mounted.only_with( { it { should be_mounted.only_with( {
:device=>"/root/empty.iso", :device=>"/tmp/empty.iso",
:type=>"iso9660", :type=>"iso9660",
:options=>{ :options=>{
:ro=>true} :ro=>true}

View file

@ -5,7 +5,7 @@ if os.linux?
describe mount '/mnt/iso-disk' do describe mount '/mnt/iso-disk' do
it { should be_mounted } it { should be_mounted }
its('count') { should eq 1 } its('count') { should eq 1 }
its('device') { should eq '/root/empty.iso' } its('device') { should eq '/tmp/empty.iso' }
its('type') { should eq 'iso9660' } its('type') { should eq 'iso9660' }
its('options') { should eq ['ro'] } its('options') { should eq ['ro'] }
end end