From 351c722fbda1ca77deee911a3e7a0c97e6327261 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Sat, 17 Aug 2013 20:56:53 -0400 Subject: [PATCH] Add rspec-system test for mysql_user. --- spec/system/types/mysql_user_spec.rb | 35 ++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 spec/system/types/mysql_user_spec.rb diff --git a/spec/system/types/mysql_user_spec.rb b/spec/system/types/mysql_user_spec.rb new file mode 100644 index 0000000..7aaa979 --- /dev/null +++ b/spec/system/types/mysql_user_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper_system' + +describe 'mysql_user' do + + describe 'setup' do + it 'should work with no errors' do + pp = <<-EOS + class { 'mysql::server': } + EOS + + puppet_apply(pp) + end + end + + describe 'adding user' do + it 'should work without errors' do + pp = <<-EOS + mysql_user { 'ashp@localhost': + password_hash => '6f8c114b58f2ce9e', + } + EOS + + puppet_apply(pp) + end + + it 'should find the user' do + shell("mysql -NBe \"select '1' from mysql.user where CONCAT(user, '@', host) = 'ashp@localhost'\"") do |r| + r.stdout.should =~ /^1$/ + r.stderr.should be_empty + r.exit_code.should be_zero + end + end + end + +end