From e10c0f93c10de4729e932078569374a8eff58004 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Fri, 14 Feb 2020 20:00:39 +0000 Subject: [PATCH 1/1] Add test for nginx cookbook --- .kitchen.yml | 8 ++++++++ .travis.yml | 3 +++ cookbooks/nginx/metadata.rb | 2 ++ test/integration/nginx/serverspec/nginx_spec.rb | 17 +++++++++++++++++ 4 files changed, 30 insertions(+) create mode 100644 test/integration/nginx/serverspec/nginx_spec.rb diff --git a/.kitchen.yml b/.kitchen.yml index 6c8d8a4bb..576c3e955 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -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] diff --git a/.travis.yml b/.travis.yml index d12cb1164..d34745523 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/cookbooks/nginx/metadata.rb b/cookbooks/nginx/metadata.rb index edd5573b0..9e544a8a2 100644 --- a/cookbooks/nginx/metadata.rb +++ b/cookbooks/nginx/metadata.rb @@ -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 index 000000000..03901cc32 --- /dev/null +++ b/test/integration/nginx/serverspec/nginx_spec.rb @@ -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 -- 2.39.5