]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for blog cookbook
authorTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 00:18:59 +0000 (00:18 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 18 Feb 2020 00:18:59 +0000 (00:18 +0000)
.kitchen.yml
cookbooks/wordpress/metadata.rb
cookbooks/wordpress/recipes/default.rb
test/data_bags/accounts/wordpress.json [new file with mode: 0644]
test/data_bags/blog/passwords.json [new file with mode: 0644]
test/integration/blog/serverspec/apache_spec.rb [new file with mode: 0644]

index 13b3d46a38f813dbac60044c386914ca0b605e81..879ca82af42788bd935116fbc4db92de9ef334f4 100644 (file)
@@ -38,6 +38,9 @@ suites:
     attributes:
       bind:
         clients: none
     attributes:
       bind:
         clients: none
+  - name: blog
+    run_list:
+      - recipe[blog::default]
   - name: blogs
     run_list:
       - recipe[blogs::default]
   - name: blogs
     run_list:
       - recipe[blogs::default]
index 6aaf827455585efb37c756a8538a91b1f45f5314..3ef2a0c9bb1b6c816f1d9fb53870c2c6582efdeb 100644 (file)
@@ -6,8 +6,11 @@ description       "Installs and configures Wordpress"
 
 version           "1.0.0"
 supports          "ubuntu"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "accounts"
 depends           "apache"
 depends           "chef"
 depends           "apache"
 depends           "chef"
+depends           "fail2ban"
+depends           "git"
 depends           "mysql"
 depends           "ssl"
 gem               "httpclient"
 depends           "mysql"
 depends           "ssl"
 gem               "httpclient"
index 52c544db53f1d8d3389c695e2a3f1eadc59f385b..2ca2b240bacdc1f8f88a70f44e3bf4d233fe5f22 100644 (file)
 # limitations under the License.
 #
 
 # limitations under the License.
 #
 
+include_recipe "accounts"
 include_recipe "apache"
 include_recipe "apache"
+include_recipe "fail2ban"
+include_recipe "git"
 include_recipe "mysql"
 
 package %w[
 include_recipe "mysql"
 
 package %w[
diff --git a/test/data_bags/accounts/wordpress.json b/test/data_bags/accounts/wordpress.json
new file mode 100644 (file)
index 0000000..a081519
--- /dev/null
@@ -0,0 +1,5 @@
+{
+  "id": "wordpress",
+  "uid": "516",
+  "comment": "Wordpress"
+}
diff --git a/test/data_bags/blog/passwords.json b/test/data_bags/blog/passwords.json
new file mode 100644 (file)
index 0000000..7db4860
--- /dev/null
@@ -0,0 +1,4 @@
+{
+  "id": "passwords",
+  "osm-blog-user": "osm-blog-password"
+}
diff --git a/test/integration/blog/serverspec/apache_spec.rb b/test/integration/blog/serverspec/apache_spec.rb
new file mode 100644 (file)
index 0000000..446d3b9
--- /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.with("tcp") }
+end
+
+describe port(443) do
+  it { should be_listening.with("tcp") }
+end