Add tests for the forum cookbook
authorTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 20:27:03 +0000 (21:27 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 20:27:03 +0000 (21:27 +0100)
.kitchen.yml
test/data_bags/accounts/forum.json [new file with mode: 0644]
test/data_bags/forum/passwords.json [new file with mode: 0644]
test/integration/forum/serverspec/apache_spec.rb [new file with mode: 0644]
test/integration/forum/serverspec/mysql_spec.rb [new file with mode: 0644]

index fede9d8..b800b89 100644 (file)
@@ -28,6 +28,10 @@ suites:
   - name: bind
     run_list:
       - recipe[bind::default]
+  - name: forum
+    run_list:
+      - recipe[accounts::default]
+      - role[forum]
   - name: munin
     run_list:
       - recipe[munin::default]
diff --git a/test/data_bags/accounts/forum.json b/test/data_bags/accounts/forum.json
new file mode 100644 (file)
index 0000000..12c9e38
--- /dev/null
@@ -0,0 +1,6 @@
+{
+  "id": "forum",
+  "uid": "522",
+  "comment": "Forum",
+  "manage_home": false
+}
diff --git a/test/data_bags/forum/passwords.json b/test/data_bags/forum/passwords.json
new file mode 100644 (file)
index 0000000..384f481
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "id": "passwords",
+  "database": "database-password",
+  "cookie_seed": "cookie-seed"
+}
diff --git a/test/integration/forum/serverspec/apache_spec.rb b/test/integration/forum/serverspec/apache_spec.rb
new file mode 100644 (file)
index 0000000..9d52682
--- /dev/null
@@ -0,0 +1,21 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("apache2") do
+  it { should be_installed }
+end
+
+describe service("apache2") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(80) do
+  it { should be_listening }
+end
+
+describe port(443) do
+  it { should be_listening }
+end
diff --git a/test/integration/forum/serverspec/mysql_spec.rb b/test/integration/forum/serverspec/mysql_spec.rb
new file mode 100644 (file)
index 0000000..68e6358
--- /dev/null
@@ -0,0 +1,17 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("mysql-server") do
+  it { should be_installed }
+end
+
+describe service("mysql") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(3306) do
+  it { should be_listening }
+end