Add test for nginx cookbook
authorTom Hughes <tom@compton.nu>
Fri, 14 Feb 2020 20:00:39 +0000 (20:00 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 14 Feb 2020 20:00:39 +0000 (20:00 +0000)
.kitchen.yml
.travis.yml
cookbooks/nginx/metadata.rb
test/integration/nginx/serverspec/nginx_spec.rb [new file with mode: 0644]

index 6c8d8a4bbcb9ba611410340dac4645e013ca4c56..576c3e955e57f26d4aefea34022e92f3d2df1c46 100644 (file)
@@ -114,6 +114,14 @@ suites:
   - name: networking
     run_list:
       - recipe[networking::default]
+  - name: nginx
+    run_list:
+      - recipe[munin::default]
+      - recipe[nginx::default]
+    attributes:
+      networking:
+        nameservers:
+          - 127.0.0.1
   - name: nodejs
     run_list:
       - recipe[nodejs::default]
index d12cb11647601608168edaf970f3d22cc44073a3..d347455232b458c57944edf7822c9884c899ea35 100644 (file)
@@ -65,6 +65,9 @@ jobs:
     - name: "Test Kitchen (networking)"
       script:
         - bundle exec kitchen test networking-ubuntu-1804
+    - name: "Test Kitchen (nginx)"
+      script:
+        - bundle exec kitchen test nginx-ubuntu-1804
     - name: "Test Kitchen (nodejs)"
       script:
         - bundle exec kitchen test nodejs-ubuntu-1804
index edd5573b0753883092ecbce1af97f2396827509d..9e544a8a2c69daf30bd5a814e63c53c805dab43f 100644 (file)
@@ -6,4 +6,6 @@ description       "Installs and configures nginx"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "munin"
+depends           "networking"
 depends           "ssl"
diff --git a/test/integration/nginx/serverspec/nginx_spec.rb b/test/integration/nginx/serverspec/nginx_spec.rb
new file mode 100644 (file)
index 0000000..03901cc
--- /dev/null
@@ -0,0 +1,17 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("nginx") do
+  it { should be_installed }
+end
+
+describe service("nginx") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(8050) do
+  it { should be_listening.with("tcp") }
+end