diff options
author | Salim Afiune <afiune@chef.io> | 2017-03-13 11:11:11 -0400 |
---|---|---|
committer | Tom Duffield <tom@chef.io> | 2017-03-16 14:06:57 -0500 |
commit | 7187c969b2d2cd3f8226687fe2b563be5fee9afb (patch) | |
tree | c7a320466a44c8a524d0094aed079b150832d3d0 | |
parent | d6a969be1142b31418b342d3f1c1e4ff18207e9c (diff) | |
download | chef-7187c969b2d2cd3f8226687fe2b563be5fee9afb.tar.gz |
Add Shell SoloSession tests
Signed-off-by: Salim Afiune <afiune@chef.io>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | spec/data/shef-config.rb | 2 | ||||
-rw-r--r-- | spec/functional/shell_spec.rb | 18 |
3 files changed, 21 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore index 03d53ceb10..aaf9fa045e 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,7 @@ kitchen-tests/nodes/* # Temporary files present during spec runs spec/data/test-dir +spec/data/nodes /config/ # acceptance binstubs diff --git a/spec/data/shef-config.rb b/spec/data/shef-config.rb index 02d3610e55..efd601d6d8 100644 --- a/spec/data/shef-config.rb +++ b/spec/data/shef-config.rb @@ -7,3 +7,5 @@ ohai[:disabled_plugins] << "solaris2::cpu" << "solaris2::dmi" << "solaris2::file ohai[:disabled_plugins] << "solaris2::virtualization" << "solaris2::zpools" ohai[:disabled_plugins] << "c" << "php" << "mono" << "groovy" << "lua" << "erlang" ohai[:disabled_plugins] << "kernel" << "linux::filesystem" << "ruby" +chef_repo_path File.dirname(__FILE__) +cookbook_path "#{chef_repo_path}/cookbooks" diff --git a/spec/functional/shell_spec.rb b/spec/functional/shell_spec.rb index 636162fb16..8c8d7ba482 100644 --- a/spec/functional/shell_spec.rb +++ b/spec/functional/shell_spec.rb @@ -135,6 +135,24 @@ describe Shell do expect(exitstatus).to eq(0) end + context "on solo mode" do + it "starts correctly" do + output, exitstatus = run_chef_shell_with("--solo") + expect(output).to include("done") + expect(exitstatus).to eq(0) + end + + it "should be able to use the API" do + output, exitstatus = run_chef_shell_with("-s") do |out, keyboard| + simple_api_get = "api.get('data')" + keyboard.puts(simple_api_get) + read_until(out, simple_api_get) + end + expect(output).to include("{}") + expect(exitstatus).to eq(0) + end + end + it "sets the override_runlist from the command line" do output, exitstatus = run_chef_shell_with("-o 'override::foo,override::bar'") do |out, keyboard| show_recipes_code = %q[puts "#{node["recipes"].inspect}"] |