From 51ad0dc454e261eed1a40a613ead989d743ab463 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Tue, 25 Feb 2020 18:48:56 +0000 Subject: [PATCH] Add test for snmpd cookbook --- .github/workflows/test-kitchen.yml | 1 + .kitchen.yml | 3 +++ cookbooks/snmpd/attributes/default.rb | 2 +- test/data_bags/snmpd/communities.json | 3 +++ test/integration/snmpd/serverspec/snmpd_spec.rb | 17 +++++++++++++++++ 5 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 test/data_bags/snmpd/communities.json create mode 100644 test/integration/snmpd/serverspec/snmpd_spec.rb diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 7cb3e874a..58735a202 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -69,6 +69,7 @@ jobs: - python - rsyncd - serverinfo + - snmpd - spamassassin - squid - stateofthemap diff --git a/.kitchen.yml b/.kitchen.yml index c21b1a177..8b7c6b2a8 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -250,6 +250,9 @@ suites: - name: serverinfo run_list: - recipe[serverinfo::default] + - name: snmpd + run_list: + - recipe[snmpd::default] - name: spamassassin run_list: - recipe[spamassassin::default] diff --git a/cookbooks/snmpd/attributes/default.rb b/cookbooks/snmpd/attributes/default.rb index 0cba387e1..3e7c1d1c4 100644 --- a/cookbooks/snmpd/attributes/default.rb +++ b/cookbooks/snmpd/attributes/default.rb @@ -1 +1 @@ -default[:rsyncd][:modules] = [] +default[:snmpd][:clients] = [] diff --git a/test/data_bags/snmpd/communities.json b/test/data_bags/snmpd/communities.json new file mode 100644 index 000000000..3532754b4 --- /dev/null +++ b/test/data_bags/snmpd/communities.json @@ -0,0 +1,3 @@ +{ + "id": "communities" +} diff --git a/test/integration/snmpd/serverspec/snmpd_spec.rb b/test/integration/snmpd/serverspec/snmpd_spec.rb new file mode 100644 index 000000000..baed87b4d --- /dev/null +++ b/test/integration/snmpd/serverspec/snmpd_spec.rb @@ -0,0 +1,17 @@ +require "serverspec" + +# Required by serverspec +set :backend, :exec + +describe package("snmpd") do + it { should be_installed } +end + +describe service("snmpd") do + it { should be_enabled } + it { should be_running } +end + +describe port(161) do + it { should be_listening.with("udp") } +end -- 2.39.5