From 8d4c23ac184a2ad277a7fd2b274ed36711c8fcf9 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 14 Feb 2020 20:09:02 +0000 Subject: [PATCH] Add test for squid cookbook --- .kitchen.yml | 4 ++++ .travis.yml | 3 +++ cookbooks/squid/metadata.rb | 1 + .../squid/serverspec/squid_spec.rb | 21 +++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 test/integration/squid/serverspec/squid_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 576c3e955..0eebce5fe 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -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] diff --git a/.travis.yml b/.travis.yml index d34745523..e280da19c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/cookbooks/squid/metadata.rb b/cookbooks/squid/metadata.rb index 6f9dcc723..845f7bd0c 100644 --- a/cookbooks/squid/metadata.rb +++ b/cookbooks/squid/metadata.rb @@ -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 index 000000000..a72a8b356 --- /dev/null +++ b/test/integration/squid/serverspec/squid_spec.rb @@ -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 -- 2.39.5