Sha256: f446fab18d7811b593d696a9768ae798b5b5e32d1dba227258b3b9fe3b275fb9
Contents?: true
Size: 1.88 KB
Versions: 15
Compression:
Stored size: 1.88 KB
Contents
require 'spec_helper' require 'spec/support/shared/context/client' # requires platform and platform_version be defined shared_examples "a completed run" do include_context "run completed" it "runs ohai, sets up authentication, loads node state, synchronizes policy, converges, and runs audits" do # This is what we're testing. expect(client.run).to be true # fork is stubbed, so we can see the outcome of the run expect(node.automatic_attrs[:platform]).to eq(platform) expect(node.automatic_attrs[:platform_version]).to eq(platform_version) end end shared_examples "a completed run with audit failure" do include_context "run completed" before do expect(Chef::Application).to receive(:debug_stacktrace).with an_instance_of(Chef::Exceptions::RunFailedWrappingError) end it "converges, runs audits, saves the node and raises the error in a wrapping error" do expect{ client.run }.to raise_error(Chef::Exceptions::RunFailedWrappingError) do |error| expect(error.wrapped_errors.size).to eq(run_errors.size) run_errors.each do |run_error| expect(error.wrapped_errors).to include(run_error) expect(error.backtrace).to include(*run_error.backtrace) end end # fork is stubbed, so we can see the outcome of the run expect(node.automatic_attrs[:platform]).to eq(platform) expect(node.automatic_attrs[:platform_version]).to eq(platform_version) end end shared_examples "a failed run" do include_context "run failed" it "skips node save and raises the error in a wrapping error" do expect{ client.run }.to raise_error(Chef::Exceptions::RunFailedWrappingError) do |error| expect(error.wrapped_errors.size).to eq(run_errors.size) run_errors.each do |run_error| expect(error.wrapped_errors).to include(run_error) expect(error.backtrace).to include(*run_error.backtrace) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems