From 7f4c067350c296d71ca72a8ad2f4e27e063051d0 Mon Sep 17 00:00:00 2001 From: Ashley Penney Date: Thu, 24 Apr 2014 22:05:43 +0200 Subject: [PATCH] Remove all rspec-system traces. --- Gemfile | 3 - Rakefile | 1 - spec/spec_helper_system.rb | 25 -- spec/system/mysql_account_delete_spec.rb | 35 -- spec/system/mysql_backup_spec.rb | 62 ---- spec/system/mysql_bindings_spec.rb | 90 ----- spec/system/mysql_db_spec.rb | 88 ----- spec/system/mysql_server_monitor_spec.rb | 30 -- .../system/mysql_server_root_password_spec.rb | 71 ---- spec/system/mysql_server_spec.rb | 106 ------ spec/system/types/mysql_grant_spec.rb | 314 ------------------ spec/system/types/mysql_user_spec.rb | 35 -- 12 files changed, 860 deletions(-) delete mode 100644 spec/spec_helper_system.rb delete mode 100644 spec/system/mysql_account_delete_spec.rb delete mode 100644 spec/system/mysql_backup_spec.rb delete mode 100644 spec/system/mysql_bindings_spec.rb delete mode 100644 spec/system/mysql_db_spec.rb delete mode 100644 spec/system/mysql_server_monitor_spec.rb delete mode 100644 spec/system/mysql_server_root_password_spec.rb delete mode 100644 spec/system/mysql_server_spec.rb delete mode 100644 spec/system/types/mysql_grant_spec.rb delete mode 100644 spec/system/types/mysql_user_spec.rb diff --git a/Gemfile b/Gemfile index 7dc2982..ab87909 100644 --- a/Gemfile +++ b/Gemfile @@ -5,9 +5,6 @@ group :development, :test do gem 'rake', '10.1.1', :require => false gem 'rspec-puppet', :require => false gem 'puppetlabs_spec_helper', :require => false - gem 'rspec-system', :require => false - gem 'rspec-system-puppet', :require => false - gem 'rspec-system-serverspec', :require => false gem 'serverspec', :require => false gem 'puppet-lint', :require => false gem 'pry', :require => false diff --git a/Rakefile b/Rakefile index bb60173..cd3d379 100644 --- a/Rakefile +++ b/Rakefile @@ -1,2 +1 @@ require 'puppetlabs_spec_helper/rake_tasks' -require 'rspec-system/rake_task' diff --git a/spec/spec_helper_system.rb b/spec/spec_helper_system.rb deleted file mode 100644 index de20690..0000000 --- a/spec/spec_helper_system.rb +++ /dev/null @@ -1,25 +0,0 @@ -require 'rspec-system/spec_helper' -require 'rspec-system-puppet/helpers' -require 'rspec-system-serverspec/helpers' - -include RSpecSystemPuppet::Helpers - -RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - - # Enable colour - c.tty = true - - c.include RSpecSystemPuppet::Helpers - - # This is where we 'setup' the nodes before running our tests - c.before :suite do - # Install puppet - puppet_install - - # Install modules and dependencies - puppet_module_install(:source => proj_root, :module_name => 'mysql') - shell('puppet module install puppetlabs-stdlib') - end -end diff --git a/spec/system/mysql_account_delete_spec.rb b/spec/system/mysql_account_delete_spec.rb deleted file mode 100644 index 11f776a..0000000 --- a/spec/system/mysql_account_delete_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::server::account_security class' do - - describe 'running puppet code' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': remove_default_accounts => true } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - - describe 'accounts' do - it 'should delete accounts' do - shell("mysql -e 'show grants for root@127.0.01;'") do |s| - s.exit_code.should == 1 - end - end - - it 'should delete databases' do - shell("mysql -e 'show databases;' |grep test") do |s| - s.exit_code.should == 1 - end - end - end - end - -end diff --git a/spec/system/mysql_backup_spec.rb b/spec/system/mysql_backup_spec.rb deleted file mode 100644 index cdbf4ed..0000000 --- a/spec/system/mysql_backup_spec.rb +++ /dev/null @@ -1,62 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::server::backup class' do - context 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': override_options => { 'root_password' => 'password' } } - mysql::db { 'backup1': - user => 'backup', - password => 'secret', - } - - class { 'mysql::server::backup': - backupuser => 'myuser', - backuppassword => 'mypassword', - backupdir => '/tmp/backups', - backupcompress => true, - postscript => [ - 'rm -rf /var/tmp/mysqlbackups', - 'rm -f /var/tmp/mysqlbackups.done', - 'cp -r /tmp/backups /var/tmp/mysqlbackups', - 'touch /var/tmp/mysqlbackups.done', - ], - } - EOS - - context puppet_apply(pp) do - its(:stderr) { should be_empty } - its(:exit_code) { should_not == 1 } - its(:refresh) { should be_nil } - its(:stderr) { should be_empty } - its(:exit_code) { should be_zero } - end - end - - describe 'mysqlbackup.sh' do - context 'should run mysqlbackup.sh with no errors' do - context shell("/usr/local/sbin/mysqlbackup.sh") do - its(:exit_code) { should be_zero } - its(:stderr) { should be_empty } - end - end - - context 'should dump all databases to single file' do - describe command('ls /tmp/backups/ | grep -c "mysql_backup_[0-9][0-9]*-[0-9][0-9]*.sql.bz2"') do - it { should return_stdout /1/ } - it { should return_exit_status 0 } - end - end - - context 'should create one file per database per run' do - context shell("/usr/local/sbin/mysqlbackup.sh") do - its(:exit_code) { should be_zero } - its(:stderr) { should be_empty } - end - - describe command('ls /tmp/backups/ | grep -c "mysql_backup_backup1_[0-9][0-9]*-[0-9][0-9]*.sql.bz2"') do - it { should return_stdout /2/ } - it { should return_exit_status 0 } - end - end - end -end diff --git a/spec/system/mysql_bindings_spec.rb b/spec/system/mysql_bindings_spec.rb deleted file mode 100644 index 694cf57..0000000 --- a/spec/system/mysql_bindings_spec.rb +++ /dev/null @@ -1,90 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::bindings class' do - let(:os) { - node.facts['osfamily'] - } - - case node.facts['osfamily'] - when 'RedHat' - java_package = 'mysql-connector-java' - perl_package = 'perl-DBD-MySQL' - python_package = 'MySQL-python' - ruby_package = 'ruby-mysql' - when 'Suse' - java_package = 'mysql-connector-java' - perl_package = 'perl-DBD-MySQL' - python_package = 'python-mysql' - case node.facts['operatingsystem'] - when /OpenSuSE/ - ruby_package = 'rubygem-mysql' - when /(SLES|SLED)/ - ruby_package = 'ruby-mysql' - end - when 'Debian' - java_package = 'libmysql-java' - perl_package = 'libdbd-mysql-perl' - python_package = 'python-mysqldb' - ruby_package = 'libmysql-ruby' - when 'FreeBSD' - java_package = 'databases/mysql-connector-java' - perl_package = 'p5-DBD-mysql' - python_package = 'databases/py-MySQLdb' - ruby_package = 'ruby-mysql' - else - case node.facts['operatingsystem'] - when 'Amazon' - java_package = 'mysql-connector-java' - perl_package = 'perl-DBD-MySQL' - python_package = 'MySQL-python' - ruby_package = 'ruby-mysql' - end - end - - describe 'running puppet code' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::bindings': } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end - - describe 'enabling bindings' do - it 'should work with no errors' do - puppet_apply(%{ - class { 'mysql::bindings': - java_enable => true, - perl_enable => true, - python_enable => true, - ruby_enable => true, - } - }) - end - - describe package(java_package) do - it { should be_installed } - end - - describe package(perl_package) do - it { should be_installed } - end - - describe package(python_package) do - it { should be_installed } - end - - describe package(ruby_package) do - it { should be_installed } - end - - end - -end diff --git a/spec/system/mysql_db_spec.rb b/spec/system/mysql_db_spec.rb deleted file mode 100644 index 91f68bf..0000000 --- a/spec/system/mysql_db_spec.rb +++ /dev/null @@ -1,88 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::db define' do - describe 'creating a database' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': override_options => { 'root_password' => 'password' } } - mysql::db { 'spec1': - user => 'root1', - password => 'password', - } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - [0,2].should include r.exit_code - r.refresh - r.exit_code.should be_zero - end - end - - it 'should have the database' do - shell("mysql -e 'show databases;'|grep spec1") do |s| - s.exit_code.should be_zero - end - end - end - - describe 'creating a database with post-sql' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': override_options => { 'root_password' => 'password' } } - file { '/tmp/spec.sql': - ensure => file, - content => 'CREATE TABLE table1 (id int);', - before => Mysql::Db['spec2'], - } - mysql::db { 'spec2': - user => 'root1', - password => 'password', - sql => '/tmp/spec.sql', - } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - [0,2].should include r.exit_code - r.refresh - r.exit_code.should be_zero - end - end - - it 'should have the table' do - shell("mysql -e 'show tables;' spec2|grep table1") do |s| - s.exit_code.should == 0 - end - end - end - - describe 'creating a database with dbname parameter' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': override_options => { 'root_password' => 'password' } } - mysql::db { 'spec1': - user => 'root1', - password => 'password', - dbname => 'realdb', - } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - [0,2].should include r.exit_code - r.refresh - r.exit_code.should be_zero - end - end - - it 'should have the database' do - shell("mysql -e 'show databases;'|grep realdb") do |s| - s.exit_code.should be_zero - end - end - end -end diff --git a/spec/system/mysql_server_monitor_spec.rb b/spec/system/mysql_server_monitor_spec.rb deleted file mode 100644 index b7ebd0d..0000000 --- a/spec/system/mysql_server_monitor_spec.rb +++ /dev/null @@ -1,30 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::server::monitor class' do - context 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': root_password => 'password' } - - class { 'mysql::server::monitor': - mysql_monitor_username => 'monitoruser', - mysql_monitor_password => 'monitorpass', - mysql_monitor_hostname => 'localhost', - } - EOS - - context puppet_apply(pp) do - its(:stderr) { should be_empty } - its(:exit_code) { should_not == 1 } - its(:refresh) { should be_nil } - its(:stderr) { should be_empty } - its(:exit_code) { should be_zero } - end - - context 'should run mysqladmin ping with no errors' do - describe command("mysqladmin -u monitoruser -pmonitorpass -h localhost ping") do - it { should return_stdout /mysqld is alive/ } - it { should return_exit_status 0 } - end - end - end -end diff --git a/spec/system/mysql_server_root_password_spec.rb b/spec/system/mysql_server_root_password_spec.rb deleted file mode 100644 index ea9cafa..0000000 --- a/spec/system/mysql_server_root_password_spec.rb +++ /dev/null @@ -1,71 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql::server::root_password class' do - - describe 'reset' do - it 'shuts down mysql' do - pp = <<-EOS - class { 'mysql::server': service_enabled => false } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - it 'deletes the /root/.my.cnf password' do - shell('rm -rf /root/.my.cnf') - end - - it 'deletes all databases' do - case node.facts['osfamily'] - when 'RedHat' - shell('rm -rf `grep datadir /etc/my.cnf | cut -d" " -f 3`/*') - when 'Debian' - shell('rm -rf `grep datadir /etc/mysql/my.cnf | cut -d" " -f 3`/*') - shell('mysql_install_db') - end - end - - it 'starts up mysql' do - pp = <<-EOS - class { 'mysql::server': service_enabled => true } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - end - - describe 'when unset' do - it 'should work' do - pp = <<-EOS - class { 'mysql::server': root_password => 'test' } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end - - describe 'when set' do - it 'should work' do - pp = <<-EOS - class { 'mysql::server': root_password => 'new', old_root_password => 'test' } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end - -end diff --git a/spec/system/mysql_server_spec.rb b/spec/system/mysql_server_spec.rb deleted file mode 100644 index b9ecabd..0000000 --- a/spec/system/mysql_server_spec.rb +++ /dev/null @@ -1,106 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql class' do - case node.facts['osfamily'] - when 'RedHat' - package_name = 'mysql-server' - service_name = 'mysqld' - mycnf = '/etc/my.cnf' - when 'Suse' - package_name = 'mysql-community-server' - service_name = 'mysql' - mycnf = '/etc/my.cnf' - when 'Debian' - package_name = 'mysql-server' - service_name = 'mysql' - mycnf = '/etc/mysql/my.cnf' - end - - describe 'running puppet code' do - # Using puppet_apply as a helper - it 'should work with no errors' do - pp = <<-EOS - class { 'mysql::server': } - EOS - - # Run it twice and test for idempotency - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - - describe package(package_name) do - it { should be_installed } - end - - describe service(service_name) do - it { should be_running } - it { should be_enabled } - end - end - - describe 'mycnf' do - it 'should contain sensible values' do - pp = <<-EOS - class { 'mysql::server': } - EOS - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe file(mycnf) do - it { should contain 'key_buffer = 16M' } - it { should contain 'max_binlog_size = 100M' } - it { should contain 'query_cache_size = 16M' } - end - end - - describe 'my.cnf changes' do - it 'sets values' do - pp = <<-EOS - class { 'mysql::server': - override_options => { 'mysqld' => - { 'key_buffer' => '32M', - 'max_binlog_size' => '200M', - 'query_cache_size' => '32M', - } - } - } - EOS - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe file(mycnf) do - it { should contain 'key_buffer = 32M' } - it { should contain 'max_binlog_size = 200M' } - it { should contain 'query_cache_size = 32M' } - end - end - - describe 'my.cnf should contain multiple instances of the same option' do - it 'sets multiple values' do - pp = <<-EOS - class { 'mysql::server': - override_options => { 'mysqld' => - { 'replicate-do-db' => ['base1', 'base2', 'base3'], } - } - } - EOS - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - end - end - - describe file(mycnf) do - it { should contain 'replicate-do-db = base1' } - it { should contain 'replicate-do-db = base2' } - it { should contain 'replicate-do-db = base3' } - end - end - -end diff --git a/spec/system/types/mysql_grant_spec.rb b/spec/system/types/mysql_grant_spec.rb deleted file mode 100644 index a3bdf82..0000000 --- a/spec/system/types/mysql_grant_spec.rb +++ /dev/null @@ -1,314 +0,0 @@ -require 'spec_helper_system' - -describe 'mysql_grant' do - - describe 'setup' do - it 'setup mysql::server' do - pp = <<-EOS - class { 'mysql::server': } - EOS - - puppet_apply(pp) - end - end - - describe 'missing privileges for user' do - it 'should fail' do - pp = <<-EOS - mysql_grant { 'test1@tester/test.*': - ensure => 'present', - table => 'test.*', - user => 'test1@tester', - } - EOS - - puppet_apply(pp) do |r| - r.stderr.should =~ /privileges parameter is required/ - end - end - - it 'should not find the user' do - shell("mysql -NBe \"SHOW GRANTS FOR test1@tester\"") do |r| - r.stderr.should =~ /There is no such grant defined for user 'test1' on host 'tester'/ - r.exit_code.should eq 1 - end - end - end - - describe 'missing table for user' do - it 'should fail' do - pp = <<-EOS - mysql_grant { 'atest@tester/test.*': - ensure => 'present', - user => 'atest@tester', - privileges => ['ALL'], - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should eq 1 - end - end - - it 'should not find the user' do - shell("mysql -NBe \"SHOW GRANTS FOR atest@tester\"") do |r| - r.stderr.should =~ /There is no such grant defined for user 'atest' on host 'tester'/ - r.exit_code.should eq 1 - end - end - end - - describe 'adding privileges' do - it 'should work without errors' do - pp = <<-EOS - mysql_grant { 'test2@tester/test.*': - ensure => 'present', - table => 'test.*', - user => 'test2@tester', - privileges => ['SELECT', 'UPDATE'], - } - EOS - - puppet_apply(pp) - end - - it 'should find the user' do - shell("mysql -NBe \"SHOW GRANTS FOR test2@tester\"") do |r| - r.stdout.should =~ /GRANT SELECT, UPDATE.*TO 'test2'@'tester'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - end - - describe 'adding option' do - it 'should work without errors' do - pp = <<-EOS - mysql_grant { 'test3@tester/test.*': - ensure => 'present', - table => 'test.*', - user => 'test3@tester', - options => ['GRANT'], - privileges => ['SELECT', 'UPDATE'], - } - EOS - - puppet_apply(pp) - end - - it 'should find the user' do - shell("mysql -NBe \"SHOW GRANTS FOR test3@tester\"") do |r| - r.stdout.should =~ /GRANT SELECT, UPDATE ON `test`.* TO 'test3'@'tester' WITH GRANT OPTION$/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - end - - describe 'adding all privileges without table' do - it 'should fail' do - pp = <<-EOS - mysql_grant { 'test4@tester/test.*': - ensure => 'present', - user => 'test4@tester', - options => ['GRANT'], - privileges => ['SELECT', 'UPDATE', 'ALL'], - } - EOS - - puppet_apply(pp) do |r| - r.stderr.should =~ /table parameter is required./ - end - end - - end - - - describe 'adding all privileges' do - it 'should only try to apply ALL' do - pp = <<-EOS - mysql_grant { 'test4@tester/test.*': - ensure => 'present', - table => 'test.*', - user => 'test4@tester', - options => ['GRANT'], - privileges => ['SELECT', 'UPDATE', 'ALL'], - } - EOS - - puppet_apply(pp) - end - - it 'should find the user' do - shell("mysql -NBe \"SHOW GRANTS FOR test4@tester\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test4'@'tester' WITH GRANT OPTION/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - end - - # Test combinations of user@host to ensure all cases work. - describe 'short hostname' do - it 'should apply' do - pp = <<-EOS - mysql_grant { 'test@short/test.*': - ensure => 'present', - table => 'test.*', - user => 'test@short', - privileges => 'ALL', - } - mysql_grant { 'test@long.hostname.com/test.*': - ensure => 'present', - table => 'test.*', - user => 'test@long.hostname.com', - privileges => 'ALL', - } - mysql_grant { 'test@192.168.5.6/test.*': - ensure => 'present', - table => 'test.*', - user => 'test@192.168.5.6', - privileges => 'ALL', - } - mysql_grant { 'test@2607:f0d0:1002:0051:0000:0000:0000:0004/test.*': - ensure => 'present', - table => 'test.*', - user => 'test@2607:f0d0:1002:0051:0000:0000:0000:0004', - privileges => 'ALL', - } - mysql_grant { 'test@::1/128/test.*': - ensure => 'present', - table => 'test.*', - user => 'test@::1/128', - privileges => 'ALL', - } - EOS - - puppet_apply(pp) - end - - it 'finds short hostname' do - shell("mysql -NBe \"SHOW GRANTS FOR test@short\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'short'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - it 'finds long hostname' do - shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'long.hostname.com'\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'long.hostname.com'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - it 'finds ipv4' do - shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'192.168.5.6'\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'192.168.5.6'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - it 'finds ipv6' do - shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'2607:f0d0:1002:0051:0000:0000:0000:0004'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - it 'finds short ipv6' do - shell("mysql -NBe \"SHOW GRANTS FOR 'test'@'::1/128'\"") do |r| - r.stdout.should =~ /GRANT ALL PRIVILEGES ON `test`.* TO 'test'@'::1\/128'/ - r.stderr.should be_empty - r.exit_code.should be_zero - end - end - end - - describe 'complex test' do - it 'setup mysql::server' do - pp = <<-EOS - $dbSubnet = '10.10.10.%' - - mysql_database { 'foo': - ensure => present, - } - - exec { 'mysql-create-table': - command => '/usr/bin/mysql -NBe "CREATE TABLE foo.bar (name VARCHAR(20))"', - environment => "HOME=${::root_home}", - unless => '/usr/bin/mysql -NBe "SELECT 1 FROM foo.bar LIMIT 1;"', - require => Mysql_database['foo'], - } - - Mysql_grant { - ensure => present, - options => ['GRANT'], - privileges => ['ALL'], - table => '*.*', - require => [ Mysql_database['foo'], Exec['mysql-create-table'] ], - } - - mysql_grant { "user1@${dbSubnet}/*.*": - user => "user1@${dbSubnet}", - } - mysql_grant { "user2@${dbSubnet}/foo.bar": - privileges => ['SELECT', 'INSERT', 'UPDATE'], - user => "user2@${dbSubnet}", - table => 'foo.bar', - } - mysql_grant { "user3@${dbSubnet}/foo.*": - privileges => ['SELECT', 'INSERT', 'UPDATE'], - user => "user3@${dbSubnet}", - table => 'foo.*', - } - mysql_grant { 'web@%/*.*': - user => 'web@%', - } - mysql_grant { "web@${dbSubnet}/*.*": - user => "web@${dbSubnet}", - } - mysql_grant { "web@${fqdn}/*.*": - user => "web@${fqdn}", - } - mysql_grant { 'web@localhost/*.*': - user => 'web@localhost', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should_not == 1 - r.refresh - r.exit_code.should be_zero - end - end - end - - describe 'lower case privileges' do - it 'create ALL privs' do - pp = <<-EOS - mysql_grant { 'lowercase@localhost/*.*': - user => 'lowercase@localhost', - privileges => 'ALL', - table => '*.*', - } - EOS - - puppet_apply(pp) - end - - it 'create lowercase all privs' do - pp = <<-EOS - mysql_grant { 'lowercase@localhost/*.*': - user => 'lowercase@localhost', - privileges => 'all', - table => '*.*', - } - EOS - - puppet_apply(pp) do |r| - r.exit_code.should be_zero - end - end - end - -end diff --git a/spec/system/types/mysql_user_spec.rb b/spec/system/types/mysql_user_spec.rb deleted file mode 100644 index 7aaa979..0000000 --- a/spec/system/types/mysql_user_spec.rb +++ /dev/null @@ -1,35 +0,0 @@ -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