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

index 576c3e955e57f26d4aefea34022e92f3d2df1c46..0eebce5fea3ce42e0aa3a8a1ab361b6c70446db8 100644 (file)
@@ -142,6 +142,10 @@ suites:
   - name: spamassassin
     run_list:
       - recipe[spamassassin::default]
+  - name: squid
+    run_list:
+      - recipe[apt::default]
+      - recipe[squid::default]
   - name: tools
     run_list:
       - recipe[tools::default]
index d347455232b458c57944edf7822c9884c899ea35..e280da19cb88c50681bba0b3bd0970889bbcea11 100644 (file)
@@ -86,6 +86,9 @@ jobs:
     - name: "Test Kitchen (spamassassin)"
       script:
         - bundle exec kitchen test spamassassin-ubuntu-1804
+    - name: "Test Kitchen (squid)"
+      script:
+        - bundle exec kitchen test squid-ubuntu-1804
     - name: "Test Kitchen (tools)"
       script:
         - bundle exec kitchen test tools-ubuntu-1804
index 6f9dcc7239acad363cdf43598a515873cef500a2..845f7bd0c30730a14d0695bd6fc858ef533046bb 100644 (file)
@@ -6,4 +6,5 @@ description       "Installs and configures squid"
 
 version           "1.0.0"
 supports          "ubuntu"
+depends           "munin"
 depends           "systemd"
diff --git a/test/integration/squid/serverspec/squid_spec.rb b/test/integration/squid/serverspec/squid_spec.rb
new file mode 100644 (file)
index 0000000..a72a8b3
--- /dev/null
@@ -0,0 +1,21 @@
+require "serverspec"
+
+# Required by serverspec
+set :backend, :exec
+
+describe package("squid") do
+  it { should be_installed }
+end
+
+describe service("squid") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(3128) do
+  it { should be_listening.with("tcp") }
+end
+
+describe port(8080) do
+  it { should be_listening.with("tcp") }
+end