From b9173097e5e8b885d5039fe439ad1c18efe6cb00 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 17 Feb 2020 21:46:01 +0000 Subject: [PATCH] Add test for serverinfo cookbook --- .kitchen.yml | 3 +++ .travis.yml | 3 +++ cookbooks/serverinfo/recipes/default.rb | 2 ++ .../serverinfo/serverspec/apache_spec.rb | 21 +++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 test/integration/serverinfo/serverspec/apache_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 0730adbfc..13b3d46a3 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -169,6 +169,9 @@ suites: - name: python run_list: - recipe[python::default] + - name: serverinfo + run_list: + - recipe[serverinfo::default] - name: spamassassin run_list: - recipe[spamassassin::default] diff --git a/.travis.yml b/.travis.yml index 6ae8b5144..826576307 100644 --- a/.travis.yml +++ b/.travis.yml @@ -114,6 +114,9 @@ jobs: - name: "Test Kitchen (python)" script: - bundle exec kitchen test python-ubuntu-1804 + - name: "Test Kitchen (serverinfo)" + script: + - bundle exec kitchen test serverinfo-ubuntu-1804 - name: "Test Kitchen (spamassassin)" script: - bundle exec kitchen test spamassassin-ubuntu-1804 diff --git a/cookbooks/serverinfo/recipes/default.rb b/cookbooks/serverinfo/recipes/default.rb index 92bd5703d..c10d71684 100644 --- a/cookbooks/serverinfo/recipes/default.rb +++ b/cookbooks/serverinfo/recipes/default.rb @@ -23,7 +23,9 @@ include_recipe "git" package %w[ ruby ruby-dev + libssl-dev zlib1g-dev + pkg-config ] gem_package "bundler" do diff --git a/test/integration/serverinfo/serverspec/apache_spec.rb b/test/integration/serverinfo/serverspec/apache_spec.rb new file mode 100644 index 000000000..446d3b915 --- /dev/null +++ b/test/integration/serverinfo/serverspec/apache_spec.rb @@ -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 -- 2.39.5