diff options
author | tyler-ball <tball@chef.io> | 2019-04-18 15:27:54 -0600 |
---|---|---|
committer | Mark Anderson <mark@chef.io> | 2019-05-03 21:40:19 -0700 |
commit | db12e959e88aae92b9414a7637007ce7263fed1a (patch) | |
tree | 08169d58c8ec86e3b0675dc4aff84e33dd5ca889 /spec | |
parent | f02fe6b3ad2711f7e84f310bf19128b74fc3cd0e (diff) | |
download | chef-db12e959e88aae92b9414a7637007ce7263fed1a.tar.gz |
knife bootstrap is only knife command to have license acceptance flow
Because in order to run `chef-client` on the bootstrapped node the user
needs to have accepted the licenses locally. Right now we have commented
out this code because we will enforce it in a different PR.
Signed-off-by: tyler-ball <tball@chef.io>
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/application/knife_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/application_spec.rb | 9 | ||||
-rw-r--r-- | spec/unit/knife/bootstrap_spec.rb | 5 |
3 files changed, 10 insertions, 6 deletions
diff --git a/spec/unit/application/knife_spec.rb b/spec/unit/application/knife_spec.rb index f5ede6318b..f8f5560597 100644 --- a/spec/unit/application/knife_spec.rb +++ b/spec/unit/application/knife_spec.rb @@ -45,7 +45,6 @@ describe Chef::Application::Knife do @knife = Chef::Application::Knife.new allow(@knife).to receive(:puts) allow(@knife).to receive(:trap) - allow(@knife).to receive(:check_license_acceptance) allow(Chef::Knife).to receive(:list_commands) end @@ -66,7 +65,6 @@ describe Chef::Application::Knife do with_argv(*%w{noop knife command with some args}) do knife = double(Chef::Knife) expect(Chef::Knife).to receive(:run).with(ARGV, @knife.options).and_return(knife) - expect(@knife).to receive(:check_license_acceptance) expect(@knife).to receive(:exit).with(0) @knife.run end diff --git a/spec/unit/application_spec.rb b/spec/unit/application_spec.rb index ca8397f5d7..e5dc0c4a33 100644 --- a/spec/unit/application_spec.rb +++ b/spec/unit/application_spec.rb @@ -72,7 +72,6 @@ describe Chef::Application do describe "run" do before do allow(@app).to receive(:setup_application).and_return(true) - allow(@app).to receive(:check_license_acceptance) allow(@app).to receive(:run_application).and_return(true) allow(@app).to receive(:configure_chef).and_return(true) allow(@app).to receive(:configure_logging).and_return(true) @@ -88,9 +87,11 @@ describe Chef::Application do @app.run end - it "should check the license acceptance" do - expect(@app).to receive(:check_license_acceptance) - @app.run + describe "when enforce_license is set to true" do + it "should check the license acceptance" do + expect(@app).to receive(:check_license_acceptance) + @app.run(true) + end end it "should run the actual application" do diff --git a/spec/unit/knife/bootstrap_spec.rb b/spec/unit/knife/bootstrap_spec.rb index 995a2ef4c9..da6bebfd1c 100644 --- a/spec/unit/knife/bootstrap_spec.rb +++ b/spec/unit/knife/bootstrap_spec.rb @@ -293,6 +293,7 @@ describe Chef::Knife::Bootstrap do end it "raises a Chef::Exceptions::BootstrapCommandInputError with the proper error message" do + # expect(LicenseAcceptance::Acceptor).to receive(:check_and_persist!) knife.parse_options(["-j", '{"foo":{"bar":"baz"}}']) knife.parse_options(["--json-attribute-file", jsonfile.path]) knife.merge_configs @@ -1793,12 +1794,16 @@ describe Chef::Knife::Bootstrap do end it "verifies that a server to bootstrap was given as a command line arg" do + # expect(LicenseAcceptance::Acceptor).to receive(:check_and_persist!) knife.name_args = nil expect { knife.run }.to raise_error(SystemExit) expect(stderr.string).to match(/ERROR:.+FQDN or ip/) end describe "#bootstrap_context" do + # before do + # expect(LicenseAcceptance::Acceptor).to receive(:check_and_persist!) + # end context "under Windows" do let(:windows_test) { true } it "creates a WindowsBootstrapContext" do |