Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(maint) - Fix failing tests exiting 0 #558

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions spec/lib/puppet_litmus/rake_tasks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
expect($stdout).to receive(:puts).with('redhat-5-x86_64')
expect($stdout).to receive(:puts).with('ubuntu-1404-x86_64')
expect($stdout).to receive(:puts).with('ubuntu-1804-x86_64')
allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:metadata'].invoke
end
end
Expand All @@ -44,7 +45,7 @@

expect_any_instance_of(Object).to receive(:install_module).with(inventory_hash, target_nodes, dummy_tar, args[:module_repository])
expect($stdout).to receive(:puts).with("Installed '#{dummy_tar}' on #{target_nodes.join(', ')}")

allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:install_module'].invoke(*args.values)
end

Expand Down Expand Up @@ -93,6 +94,7 @@
expect($stdout).to receive(:puts).with(start_with('Installing \'spec/data/doot.tar.gz\''))
expect_any_instance_of(Object).to receive(:run_command).twice.and_return([])
expect($stdout).to receive(:puts).with(start_with('Installed \'spec/data/doot.tar.gz\''))
allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:install_modules_from_directory'].invoke('./spec/fixtures/modules')
end
end
Expand All @@ -103,6 +105,7 @@
expect(Rake::Task['litmus:provision_list']).to receive(:invoke).with('default')
expect(Rake::Task['litmus:install_agent']).to receive(:invoke).with('puppet6')
expect(Rake::Task['litmus:install_module']).to receive(:invoke)
allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:provision_install'].invoke('default', 'puppet6')
end
end
Expand All @@ -126,7 +129,7 @@
allow_any_instance_of(BoltSpec::Run).to receive(:run_task).with(any_args).and_return(results)
allow_any_instance_of(PuppetLitmus::InventoryManipulation).to receive(:inventory_hash_from_inventory_file).with(any_args).and_return({})
allow_any_instance_of(PuppetLitmus::RakeHelper).to receive(:check_connectivity?).with(any_args).and_return(true)

allow_any_instance_of(Object).to receive(:exit)
expect { Rake::Task['litmus:provision'].invoke('docker', 'centos:7') }.to output(/#{expected_output}/).to_stdout
end
end
Expand All @@ -138,6 +141,7 @@
it 'no key in provision file' do
allow(File).to receive(:file?).with(any_args).and_return(true)
expect(YAML).to receive(:load_file).with(provision_file).and_return(provision_hash)
allow_any_instance_of(Object).to receive(:exit)
expect { Rake::Task['litmus:provision_list'].invoke('deet') }.to raise_error(/deet/)
end
end
Expand All @@ -149,6 +153,7 @@
stub_const('ENV', ENV.to_hash.merge('TARGET_HOST' => 'some.host'))
expect_any_instance_of(PuppetLitmus::InventoryManipulation).to receive(:inventory_hash_from_inventory_file).and_return(inventory_hash)
expect_any_instance_of(PuppetLitmus::RakeHelper).to receive(:check_connectivity?).with(inventory_hash, nil).and_return(true)
allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:check_connectivity'].invoke
end
end
Expand All @@ -157,6 +162,7 @@
it 'calls spec_prep' do
expect(Rake::Task['spec_prep']).to receive(:invoke).and_return('')
expect_any_instance_of(RSpec::Core::RakeTask).to receive(:run_task)
allow_any_instance_of(Object).to receive(:exit)
Rake::Task['litmus:acceptance:localhost'].invoke
end
end
Expand Down
Loading