]> git.openstreetmap.org Git - chef.git/commitdiff
Add tests for mysql cookbook
authorTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 18:31:48 +0000 (19:31 +0100)
committerTom Hughes <tom@compton.nu>
Thu, 27 Oct 2016 19:44:40 +0000 (20:44 +0100)
.kitchen.yml
cookbooks/mysql/metadata.rb
cookbooks/mysql/recipes/default.rb
test/integration/mysql/serverspec/mysql_spec.rb [new file with mode: 0644]

index e1328af0230237b6642ff3d5952fb8131467198a..fede9d89ac539ba30320e1bb083948208b38a108 100644 (file)
@@ -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]
index 547f5e4528093ba7f02928419119cf97c9c7e744..18b2492d7912c67cdfc5a94d9eced773a53c57cb 100644 (file)
@@ -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",
index bda0065798c16761205e6824c3b0a939918f3a1c..49087e67a1b78d7a2dacfb1f1377042d4438d1b2 100644 (file)
@@ -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 (file)
index 0000000..68e6358
--- /dev/null
@@ -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