diff --git a/lib/puppet_litmus/rake_helper.rb b/lib/puppet_litmus/rake_helper.rb index 09c08dc..583a95f 100644 --- a/lib/puppet_litmus/rake_helper.rb +++ b/lib/puppet_litmus/rake_helper.rb @@ -68,7 +68,7 @@ def provision(provisioner, platform, inventory_vars) raise "the provision module was not found in #{DEFAULT_CONFIG_DATA['modulepath']}, please amend the .fixtures.yml file" unless File.directory?(File.join(DEFAULT_CONFIG_DATA['modulepath'], 'provision')) - params = { 'action' => 'provision', 'platform' => platform, 'inventory' => Dir.pwd } + params = { 'action' => 'provision', 'platform' => platform, 'inventory' => File.join(Dir.pwd, 'spec', 'fixtures', 'litmus_inventory.yaml') } params['vars'] = inventory_vars unless inventory_vars.nil? task_name = provisioner_task(provisioner) diff --git a/spec/lib/puppet_litmus/rake_helper_spec.rb b/spec/lib/puppet_litmus/rake_helper_spec.rb index cbe6893..38ed9ad 100644 --- a/spec/lib/puppet_litmus/rake_helper_spec.rb +++ b/spec/lib/puppet_litmus/rake_helper_spec.rb @@ -9,6 +9,7 @@ let(:provision_hash) { args[:provision_hash] } let(:results) { args[:results] } let(:params) { args[:params] } + let(:inventory_file) { File.join(Dir.pwd, 'spec', 'fixtures', 'litmus_inventory.yaml') } it 'calls function' do allow(File).to receive(:directory?).and_call_original @@ -42,7 +43,7 @@ inventory_vars: nil, provision_hash: { 'default' => { 'provisioner' => 'docker', 'images' => ['waffleimage/centos7'] } }, results: [], - params: { 'action' => 'provision', 'platform' => 'waffleimage/centos7', 'inventory' => Dir.pwd } + params: { 'action' => 'provision', 'platform' => 'waffleimage/centos7', 'inventory' => inventory_file } }, { provisioner: 'vagrant', @@ -50,7 +51,7 @@ inventory_vars: nil, provision_hash: { 'default' => { 'provisioner' => 'vagrant', 'images' => ['centos7'] } }, results: [], - params: { 'action' => 'provision', 'platform' => 'centos7', 'inventory' => Dir.pwd } + params: { 'action' => 'provision', 'platform' => 'centos7', 'inventory' => inventory_file } } ].freeze @@ -68,7 +69,7 @@ [{ 'uri' => 'some.host', 'facts' => { 'provisioner' => 'docker', 'container_name' => 'foo', 'platform' => 'some.host' } }] }] } end let(:targets) { ['some.host'] } - let(:params) { { 'action' => 'tear_down', 'node_name' => 'some.host', 'inventory' => Dir.pwd } } + let(:params) { { 'action' => 'tear_down', 'node_name' => 'some.host', 'inventory' => inventory_file } } it 'calls function' do allow(File).to receive(:directory?).with(File.join(described_class::DEFAULT_CONFIG_DATA['modulepath'], 'provision')).and_return(true) @@ -89,7 +90,7 @@ ] }] } end let(:targets) { ['one.host'] } - let(:params) { { 'action' => 'tear_down', 'node_name' => 'one.host', 'inventory' => Dir.pwd } } + let(:params) { { 'action' => 'tear_down', 'node_name' => 'one.host', 'inventory' => inventory_file } } it 'calls function' do allow(File).to receive(:directory?).with(File.join(described_class::DEFAULT_CONFIG_DATA['modulepath'], 'provision')).and_return(true)