From: Tom Hughes Date: Thu, 27 Oct 2016 18:31:48 +0000 (+0100) Subject: Add tests for mysql cookbook X-Git-Url: https://git.openstreetmap.org/chef.git/commitdiff_plain/3d3fad5515ff453e5d60dd012e20f130639ee61d Add tests for mysql cookbook --- diff --git a/.kitchen.yml b/.kitchen.yml index e1328af02..fede9d89a 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -34,6 +34,9 @@ suites: - name: munin-server run_list: - recipe[munin::server] + - name: mysql + run_list: + - recipe[mysql::default] - name: networking run_list: - recipe[networking::default] diff --git a/cookbooks/mysql/metadata.rb b/cookbooks/mysql/metadata.rb index 547f5e452..18b2492d7 100644 --- a/cookbooks/mysql/metadata.rb +++ b/cookbooks/mysql/metadata.rb @@ -5,6 +5,7 @@ license "Apache 2.0" description "Installs and configures mysql" long_description IO.read(File.join(File.dirname(__FILE__), "README.md")) version "1.0.0" +depends "munin" attribute "mysql", :display_name => "MySQL", diff --git a/cookbooks/mysql/recipes/default.rb b/cookbooks/mysql/recipes/default.rb index bda006579..49087e67a 100644 --- a/cookbooks/mysql/recipes/default.rb +++ b/cookbooks/mysql/recipes/default.rb @@ -22,7 +22,7 @@ package "mysql-client" service "mysql" do action [:enable, :start] - supports :status => true, :restart => true, :reload => true + supports :status => true, :restart => true end template "/etc/mysql/conf.d/chef.cnf" do @@ -30,7 +30,7 @@ template "/etc/mysql/conf.d/chef.cnf" do owner "root" group "root" mode 0o644 - notifies :reload, "service[mysql]" + notifies :restart, "service[mysql]" end package "libdbd-mysql-perl" diff --git a/test/integration/mysql/serverspec/mysql_spec.rb b/test/integration/mysql/serverspec/mysql_spec.rb new file mode 100644 index 000000000..68e63582b --- /dev/null +++ b/test/integration/mysql/serverspec/mysql_spec.rb @@ -0,0 +1,17 @@ +require "serverspec" + +# Required by serverspec +set :backend, :exec + +describe package("mysql-server") do + it { should be_installed } +end + +describe service("mysql") do + it { should be_enabled } + it { should be_running } +end + +describe port(3306) do + it { should be_listening } +end