From e2fad83c1cadcfdfab088867126d92a545b16a28 Mon Sep 17 00:00:00 2001 From: Bryan Jen Date: Thu, 26 May 2016 11:18:27 -0700 Subject: [PATCH] Skips mysqlbackup.sh tests on MySQL 5.7+ --- README.md | 6 ++- spec/acceptance/mysql_backup_spec.rb | 75 +++++++++++++++++++--------- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 3287100..85ea0b0 100644 --- a/README.md +++ b/README.md @@ -908,14 +908,16 @@ loopback interfaces. Because those nodes aren't connected to the outside world, This module has been tested on: * RedHat Enterprise Linux 5, 6, 7 -* Debian 6, 7 +* Debian 6, 7, 8 * CentOS 5, 6, 7 -* Ubuntu 10.04, 12.04, 14.04 +* Ubuntu 10.04, 12.04, 14.04, 16.04 * Scientific Linux 5, 6 * SLES 11 Testing on other platforms has been minimal and cannot be guaranteed. +**Note:** The mysqlbackup.sh does not work and is not supported on MySQL 5.7 and greater. + ## Development Puppet Labs modules on the Puppet Forge are open projects, and community diff --git a/spec/acceptance/mysql_backup_spec.rb b/spec/acceptance/mysql_backup_spec.rb index c33fcf5..e5fcfd5 100644 --- a/spec/acceptance/mysql_backup_spec.rb +++ b/spec/acceptance/mysql_backup_spec.rb @@ -47,28 +47,40 @@ describe 'mysql::server::backup class' do describe 'mysqlbackup.sh' do it 'should run mysqlbackup.sh with no errors' do - shell("/usr/local/sbin/mysqlbackup.sh") do |r| - expect(r.stderr).to eq("") + pre_run + if ! version_is_greater_than('5.7.0') + shell("/usr/local/sbin/mysqlbackup.sh") do |r| + expect(r.stderr).to eq("") + end end end it 'should dump all databases to single file' do - shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r| - expect(r.stdout).to match(/1/) - expect(r.exit_code).to be_zero + pre_run + if ! version_is_greater_than('5.7.0') + shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r| + expect(r.stdout).to match(/1/) + expect(r.exit_code).to be_zero + end end end context 'should create one file per database per run' do it 'executes mysqlbackup.sh a second time' do - shell('sleep 1') - shell('/usr/local/sbin/mysqlbackup.sh') + pre_run + if ! version_is_greater_than('5.7.0') + shell('sleep 1') + shell('/usr/local/sbin/mysqlbackup.sh') + end end it 'creates at least one backup tarball' do - shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r| - expect(r.stdout).to match(/2/) - expect(r.exit_code).to be_zero + pre_run + if ! version_is_greater_than('5.7.0') + shell('ls -l /tmp/backups/mysql_backup_*-*.sql.bz2 | wc -l') do |r| + expect(r.stdout).to match(/2/) + expect(r.exit_code).to be_zero + end end end end @@ -110,31 +122,43 @@ describe 'mysql::server::backup class' do describe 'mysqlbackup.sh' do it 'should run mysqlbackup.sh with no errors without root credentials' do - shell("HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh") do |r| - expect(r.stderr).to eq("") + pre_run + if ! version_is_greater_than('5.7.0') + shell("HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh") do |r| + expect(r.stderr).to eq("") + end end end it 'should create one file per database' do - ['backup1', 'backup2'].each do |database| - shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| - expect(r.stdout).to match(/1/) - expect(r.exit_code).to be_zero + pre_run + if ! version_is_greater_than('5.7.0') + ['backup1', 'backup2'].each do |database| + shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| + expect(r.stdout).to match(/1/) + expect(r.exit_code).to be_zero + end end end end context 'should create one file per database per run' do it 'executes mysqlbackup.sh a second time' do - shell('sleep 1') - shell('HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh') + pre_run + if ! version_is_greater_than('5.7.0') + shell('sleep 1') + shell('HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh') + end end it 'has one file per database per run' do - ['backup1', 'backup2'].each do |database| - shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| - expect(r.stdout).to match(/2/) - expect(r.exit_code).to be_zero + pre_run + if ! version_is_greater_than('5.7.0') + ['backup1', 'backup2'].each do |database| + shell("ls -l /tmp/backups/mysql_backup_#{database}_*-*.sql.bz2 | wc -l") do |r| + expect(r.stdout).to match(/2/) + expect(r.exit_code).to be_zero + end end end end @@ -179,8 +203,11 @@ describe 'mysql::server::backup class' do end it 'should run mysqlbackup.sh with no errors' do - shell("/usr/local/sbin/mysqlbackup.sh") do |r| - expect(r.stderr).to eq("") + pre_run + if ! version_is_greater_than('5.7.0') + shell("/usr/local/sbin/mysqlbackup.sh") do |r| + expect(r.stderr).to eq("") + end end end end