summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2017-04-05 22:57:35 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2017-04-05 22:57:35 -0700
commitef004920a9be65359721375991d075173fb3cc60 (patch)
tree9f2e15b6d0f2dd3b732e1799729e74239da5ec21
parent505f1244da92c8767eb289bb81b4328e81992d1b (diff)
downloadchef-ef004920a9be65359721375991d075173fb3cc60.tar.gz
couple of integration tests for Chef-13 formatter
make sure that we fail if we can see info logs at least (halfway decent check that we're not getting the logger when we're going through a pipe / not through a tty) Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
-rw-r--r--spec/integration/client/client_spec.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/spec/integration/client/client_spec.rb b/spec/integration/client/client_spec.rb
index 733503de42..00086c75ca 100644
--- a/spec/integration/client/client_spec.rb
+++ b/spec/integration/client/client_spec.rb
@@ -554,4 +554,42 @@ EOM
command.error!
end
end
+
+ when_the_repository "has a cookbook that logs at the info level" do
+ before do
+ file "cookbooks/x/recipes/default.rb", <<EOM
+ log "info level" do
+ level :info
+ end
+EOM
+ file "config/client.rb", <<EOM
+local_mode true
+cookbook_path "#{path_to('cookbooks')}"
+EOM
+ end
+
+ it "a chef client run should not log to info by default" do
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command.error!
+ expect(command.stdout).not_to include("INFO")
+ end
+
+ it "a chef client run to a pipe should not log to info by default" do
+ command = shell_out("#{chef_client} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", :cwd => chef_dir)
+ command.error!
+ expect(command.stdout).not_to include("INFO")
+ end
+
+ it "a chef solo run should not log to info by default" do
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork", :cwd => chef_dir)
+ command.error!
+ expect(command.stdout).not_to include("INFO")
+ end
+
+ it "a chef solo run to a pipe should not log to info by default" do
+ command = shell_out("#{chef_solo} -c \"#{path_to('config/client.rb')}\" -o 'x::default' --no-fork | tee #{path_to('chefrun.out')}", :cwd => chef_dir)
+ command.error!
+ expect(command.stdout).not_to include("INFO")
+ end
+ end
end