summaryrefslogtreecommitdiff
path: root/kitchen-tests
diff options
context:
space:
mode:
authorSerdar Sutay <serdar@opscode.com>2014-11-20 16:33:38 -0800
committertyler-ball <tyleraball@gmail.com>2014-12-17 18:52:03 -0800
commit0066549c2f45ca4ed8e1e3b3e1a8990efafa1019 (patch)
tree121fa023b8e79915a97efdc9f53312dbb659e13a /kitchen-tests
parent58e1f80100273960bf5e04c99f6447736c86420c (diff)
downloadchef-0066549c2f45ca4ed8e1e3b3e1a8990efafa1019.tar.gz
* Some primitive recipes that check basic functionality of audit mode.
* Fix a minor issue where the exception class was not being found correctly.
Diffstat (limited to 'kitchen-tests')
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/default.rb26
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb17
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/error_no_block.rb7
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/error_orphan_control.rb13
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/failed_specs.rb14
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/serverspec_collision.rb31
-rw-r--r--kitchen-tests/cookbooks/audit_test/recipes/with_include_recipe.rb16
7 files changed, 124 insertions, 0 deletions
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/default.rb b/kitchen-tests/cookbooks/audit_test/recipes/default.rb
new file mode 100644
index 0000000000..4f634d73c1
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/default.rb
@@ -0,0 +1,26 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: default
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+controls "basic control group" do
+ control "basic math" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+ end
+end
+
+controls "control group without top level control" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+end
+
+controls "control group with empty control" do
+ control "empty"
+end
+
+controls "empty control group with block" do
+end
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb b/kitchen-tests/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb
new file mode 100644
index 0000000000..77a4592e9d
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/error_duplicate_control_groups.rb
@@ -0,0 +1,17 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: error_duplicate_control_groups
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+controls "basic control group" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+end
+
+controls "basic control group" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+end
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/error_no_block.rb b/kitchen-tests/cookbooks/audit_test/recipes/error_no_block.rb
new file mode 100644
index 0000000000..76a8817b5d
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/error_no_block.rb
@@ -0,0 +1,7 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: error_no_block
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+controls "empty control group without block"
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/error_orphan_control.rb b/kitchen-tests/cookbooks/audit_test/recipes/error_orphan_control.rb
new file mode 100644
index 0000000000..d74acd6c6b
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/error_orphan_control.rb
@@ -0,0 +1,13 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: error_orphan_control
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+controls "basic control group" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+end
+
+control "orphan control"
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/failed_specs.rb b/kitchen-tests/cookbooks/audit_test/recipes/failed_specs.rb
new file mode 100644
index 0000000000..3225d3983e
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/failed_specs.rb
@@ -0,0 +1,14 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: failed_specs
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+controls "basic control group" do
+ control "basic math" do
+ # Can not write a good control :(
+ it "should pass" do
+ expect(2 - 0).to eq(0)
+ end
+ end
+end
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/serverspec_collision.rb b/kitchen-tests/cookbooks/audit_test/recipes/serverspec_collision.rb
new file mode 100644
index 0000000000..70109d84b8
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/serverspec_collision.rb
@@ -0,0 +1,31 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: serverspec_collision
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+file "/tmp/audit_test_file" do
+ action :create
+ content "Welcome to audit mode."
+end
+
+controls "file auditing" do
+ describe "test file" do
+ it "says welcome" do
+ expect(file("/tmp/audit_test_file")).to contain("Welcome")
+ end
+ end
+end
+
+file "/tmp/audit_test_file_2" do
+ action :create
+ content "Bye to audit mode."
+end
+
+controls "end file auditing" do
+ describe "end file" do
+ it "says bye" do
+ expect(file("/tmp/audit_test_file_2")).to contain("Bye")
+ end
+ end
+end
diff --git a/kitchen-tests/cookbooks/audit_test/recipes/with_include_recipe.rb b/kitchen-tests/cookbooks/audit_test/recipes/with_include_recipe.rb
new file mode 100644
index 0000000000..ff39cde117
--- /dev/null
+++ b/kitchen-tests/cookbooks/audit_test/recipes/with_include_recipe.rb
@@ -0,0 +1,16 @@
+#
+# Cookbook Name:: audit_test
+# Recipe:: with_include_recipe
+#
+# Copyright (c) 2014 The Authors, All Rights Reserved.
+
+include_recipe "audit_test::serverspec_collision"
+
+controls "basic example" do
+ it "should pass" do
+ expect(2 - 2).to eq(0)
+ end
+end
+
+include_recipe "audit_test::serverspec_collision"
+include_recipe "audit_test::default"