Skip to content

Set ordering of acceptance tests #1420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'
export_locales

describe 'mysql class' do
describe 'advanced config' do
Expand Down Expand Up @@ -62,7 +63,6 @@ class { '::mysql::server':
end

it 'can be set' do
export_locales
apply_manifest(pp, catch_failures: true) do |r|
expect(r.stderr).to be_empty
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ class { 'mysql::server::backup':
end

describe 'mysqlbackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') do
before(:all) do
pre_run
end

it 'runs mysqlbackup.sh with no errors' do
run_shell('/usr/local/sbin/mysqlbackup.sh') do |r|
expect(r.stderr).to eq('')
Expand Down Expand Up @@ -99,10 +95,6 @@ class { 'mysql::server::backup':
end

describe 'mysqlbackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') do
before(:all) do
pre_run
end

it 'runs mysqlbackup.sh with no errors without root credentials' do
run_shell('HOME=/tmp/dontreadrootcredentials /usr/local/sbin/mysqlbackup.sh') do |r|
expect(r.stderr).to eq('')
Expand Down Expand Up @@ -215,10 +207,6 @@ class { 'mysql::server::backup':
end

describe 'xtrabackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') && ((os[:family] == 'debian' && os[:release].to_i >= 9) || (os[:family] == 'ubuntu' && os[:release] =~ %r{^16\.04|^18\.04}) || (os[:family] == 'redhat' && os[:release].to_i > 6)) do # rubocop:disable Layout/LineLength
before(:all) do
pre_run
end

it 'runs xtrabackup.sh full backup with no errors' do
run_shell('/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/xtrabackups/$(date +%F)_full --backup 2>&1 | tee /tmp/xtrabackup_full.log') do |r|
expect(r.exit_code).to be_zero
Expand Down Expand Up @@ -332,10 +320,6 @@ class { 'mysql::server::backup':
end

describe 'xtrabackup.sh', if: Gem::Version.new(mysql_version) < Gem::Version.new('5.7.0') && ((os[:family] == 'debian' && os[:release].to_i >= 9) || (os[:family] == 'ubuntu' && os[:release] =~ %r{^16\.04|^18\.04}) || (os[:family] == 'redhat' && os[:release].to_i > 6)) do # rubocop:disable Layout/LineLength
before(:all) do
pre_run
end

it 'runs xtrabackup.sh with no errors' do
run_shell('/usr/local/sbin/xtrabackup.sh --target-dir=/tmp/xtrabackups/$(date +%F_%H-%M-%S) --backup 2>&1 | tee /tmp/xtrabackup.log') do |r|
expect(r.exit_code).to be_zero
Expand Down
3 changes: 0 additions & 3 deletions spec/acceptance/types/mysql_grant_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,6 @@ class { 'mysql::server':
end

describe 'proxy privilieges' do
pre_run

describe 'adding proxy privileges', if: Gem::Version.new(mysql_version) > Gem::Version.new('5.5.0') do
pp = <<-MANIFEST
mysql_user { 'proxy1@tester':
Expand Down Expand Up @@ -648,7 +646,6 @@ class { 'mysql::server':
end

it 'fails with fqdn' do
pre_run
unless Gem::Version.new(mysql_version) > Gem::Version.new('5.7.0')
result = run_shell('mysql -NBe "SHOW GRANTS FOR test@fqdn.com"', expect_failures: true)
expect(result.stderr).to contain(%r{There is no such grant defined for user 'test' on host 'fqdn.com'})
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/types/mysql_user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ class { 'mysql::server': * => $ed25519_opts }
end

it 'does not have a password', if: (os[:family] != 'sles' && os[:release].to_i == 15) do
pre_run
table = if Gem::Version.new(mysql_version) > Gem::Version.new('5.7.0')
'authentication_string'
else
Expand Down
7 changes: 2 additions & 5 deletions spec/spec_helper_acceptance_local.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,11 @@ class LitmusHelper
include PuppetLitmus
end

def pre_run
LitmusHelper.instance.apply_manifest("class { 'mysql::server': root_password => 'password' }", catch_failures: true)
end

def mysql_version
shell_output = LitmusHelper.instance.run_shell('mysql --version', expect_failures: true)
if shell_output.stdout.match(%r{\d+\.\d+\.\d+}).nil?
pre_run
# mysql is not yet installed, so we apply this class to install it
LitmusHelper.instance.apply_manifest('include mysql::server', debug: true, catch_failures: true)
shell_output = LitmusHelper.instance.run_shell('mysql --version')
raise _('unable to get mysql version') if shell_output.stdout.match(%r{\d+\.\d+\.\d+}).nil?
end
Expand Down