summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2017-01-08 15:58:43 -0800
committerTim Smith <tsmith@chef.io>2017-01-08 16:02:59 -0800
commit2f0f7aa20bc4d0e439ea5ac14f96051763f5ebbb (patch)
tree2f0f98d4b411e9c7c0f94c72f6fa5a1019c440e2
parent3bdc1e2f3d0591eba391eb61a1f11798318ff47e (diff)
downloadohai-2f0f7aa20bc4d0e439ea5ac14f96051763f5ebbb.tar.gz
Remove testing of old config logicdeprecate_old_config
Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--spec/functional/application_spec.rb39
-rw-r--r--spec/unit/config_spec.rb110
-rw-r--r--spec/unit/system_spec.rb34
3 files changed, 0 insertions, 183 deletions
diff --git a/spec/functional/application_spec.rb b/spec/functional/application_spec.rb
index 79e8c3ed..c6e0c98c 100644
--- a/spec/functional/application_spec.rb
+++ b/spec/functional/application_spec.rb
@@ -86,45 +86,6 @@ RSpec.describe "Ohai::Application" do
end
end
- context "when the configuration file contains deprecated config options" do
- # For the purpose of these tests it doesn't matter if the configuration
- # file was specified via command line or discovered on the local
- # workstation. It's easier if we pass the configuration file as a cli
- # argument (there's less to stub).
-
- let(:argv) { [ "-c", config_location ] }
-
- let(:config_content) do
- <<-CONFIG
-log_location "#{log_location}"
-log_level :#{log_level}
-Ohai::Config[:disabled_plugins] = #{disabled_plugins}
-Ohai::Config[:plugin_path] << "#{plugin_path}"
-CONFIG
- end
-
- # config settings
- let(:disabled_plugins) { [ :Foo, :Baz ] }
-
- let(:log_level) { :debug }
-
- let(:log_location) { "path/to/log" }
-
- let(:plugin_path) { "/path/to/plugins" }
-
- it "logs warnings for deprecated top-level options" do
- # deprecation warnings for options need to be stubbed in the order
- # they are received, in this case it's the order they appear in the
- # configuration file.
- options = [ :log_location, :log_level, :disabled_plugins ]
- options.each do |option|
- expect(Ohai::Log).to receive(:warn).
- with(/Ohai::Config\[:#{option}\] is deprecated/)
- end
- app.configure_ohai
- end
- end
-
context "when the configuration file has a syntax error" do
# For the purpose of these tests it doesn't matter if the configuration
# file was specified via command line or discovered on the local
diff --git a/spec/unit/config_spec.rb b/spec/unit/config_spec.rb
index 4be23ce8..ab67a932 100644
--- a/spec/unit/config_spec.rb
+++ b/spec/unit/config_spec.rb
@@ -22,74 +22,6 @@ require "ohai/config"
RSpec.describe Ohai::Config do
- describe "top-level configuration options" do
- shared_examples_for "option" do
- it "logs a deprecation warning and sets the value" do
- expect(Ohai::Log).to receive(:warn).
- with(/Ohai::Config\[:#{option}\] is deprecated/)
- Ohai::Config[option] = value
- expect(Ohai::Config[option]).to eq(value)
- end
- end
-
- shared_examples_for "appendable option" do
- it "sets the value" do
- expect(Ohai::Log).to_not receive(:warn)
- Ohai::Config[option] << value
- expect(Ohai::Config[option]).to include(value)
- end
- end
-
- describe ":directory" do
- include_examples "option" do
- let(:option) { :directory }
- let(:value) { "/some/fantastic/plugins" }
- end
- end
-
- describe ":disabled_plugins" do
- include_examples "option" do
- let(:option) { :disabled_plugins }
- let(:value) { [ :Foo, :Baz ] }
- end
- end
-
- describe ":hints_path" do
- include_examples "appendable option" do
- let(:option) { :hints_path }
- let(:value) { "/some/helpful/hints" }
- end
- end
-
- describe ":log_level" do
- include_examples "option" do
- let(:option) { :log_level }
- let(:value) { :cheese }
- end
- end
-
- describe ":log_location" do
- include_examples "option" do
- let(:option) { :log_location }
- let(:value) { "/etc/chef/cache/loooogs" }
- end
- end
-
- describe ":plugin_path" do
- include_examples "appendable option" do
- let(:option) { :plugin_path }
- let(:value) { "/some/fantastic/plugins" }
- end
- end
-
- describe ":version" do
- include_examples "option" do
- let(:option) { :version }
- let(:value) { "8.2.0" }
- end
- end
- end
-
describe "config_context :ohai" do
describe "option :plugin" do
it "gets configured with a value" do
@@ -118,48 +50,6 @@ RSpec.describe Ohai::Config do
end
end
- describe "::merge_deprecated_config" do
- before(:each) do
- allow(Ohai::Log).to receive(:warn)
- configure_ohai
- end
-
- def configure_ohai
- Ohai::Config[:directory] = "/some/fantastic/plugins"
- Ohai::Config[:disabled_plugins] = [ :Foo, :Baz ]
- Ohai::Config[:log_level] = :debug
- end
-
- it "merges top-level config values into the ohai config context" do
- Ohai::Config.merge_deprecated_config
- expect(Ohai::Config.ohai.configuration).to eq (Ohai::Config.configuration)
- end
-
- shared_examples_for "delayed warn" do
- it "logs a deprecation warning and merges the value" do
- expect(Ohai::Log).to receive(:warn).
- with(/Ohai::Config\[:#{option}\] is deprecated/)
- Ohai::Config[option] << value
- Ohai::Config.merge_deprecated_config
- expect(Ohai::Config.ohai[option]).to include(value)
- end
- end
-
- context "when :hints_path is set" do
- include_examples "delayed warn" do
- let(:option) { :hints_path }
- let(:value) { "/some/helpful/hints" }
- end
- end
-
- context "when :plugin_path is set" do
- include_examples "delayed warn" do
- let(:option) { :plugin_path }
- let(:value) { "/some/fantastic/plugins" }
- end
- end
- end
-
describe "Ohai.config" do
it "returns the ohai config context" do
expect(Ohai.config).to eq(Ohai::Config.ohai)
diff --git a/spec/unit/system_spec.rb b/spec/unit/system_spec.rb
index 0144ff61..2a549c43 100644
--- a/spec/unit/system_spec.rb
+++ b/spec/unit/system_spec.rb
@@ -38,16 +38,6 @@ describe "Ohai::System" do
expect(ohai.v6_dependency_solver).to be_a_kind_of(Hash)
end
- it "merges deprecated config settings into the ohai config context" do
- expect(Ohai::Log).to receive(:warn).
- with(/Ohai::Config\[:disabled_plugins\] is deprecated/)
- Ohai::Config[:disabled_plugins] = [ :Foo, :Baz ]
- expect(Ohai::Config).to receive(:merge_deprecated_config).
- and_call_original
- Ohai::System.new
- expect(Ohai.config[:disabled_plugins]).to eq([ :Foo, :Baz ])
- end
-
it "merges provided configuration options into the ohai config context" do
config = {
disabled_plugins: [ :Foo, :Baz ],
@@ -71,30 +61,6 @@ describe "Ohai::System" do
end
end
- shared_examples_for "appendable deprecated configuration option" do
- it "logs a warning and configures the option on the ohai config context" do
- Ohai::Config[option] << value
- expect(Ohai::Log).to receive(:warn).
- with(/Ohai::Config\[:#{option}\] is deprecated/)
- Ohai::System.new
- expect(Ohai.config[option]).to include(value)
- end
- end
-
- context "when a top-level hints_path is configured" do
- include_examples "appendable deprecated configuration option" do
- let(:option) { :hints_path }
- let(:value) { "/path/to/hints" }
- end
- end
-
- context "when a top-level plugin_path is configured" do
- include_examples "appendable deprecated configuration option" do
- let(:option) { :plugin_path }
- let(:value) { "/path/to/plugins" }
- end
- end
-
context "first time configuration" do
before { allow(Ohai::Log).to receive(:configured?).and_return(false) }