Skip to content

Commit

Permalink
Merge pull request puppetlabs#936 from wilson208/ci-fix
Browse files Browse the repository at this point in the history
(maint) Fix PROXY privilege spec test when mysql not installed on SUT
  • Loading branch information
tphoney authored Mar 20, 2017
2 parents 291df32 + c91ad27 commit a32697f
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions spec/unit/puppet/type/mysql_grant_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'puppet'
require 'puppet/type/mysql_grant'
require 'spec_helper'
describe Puppet::Type.type(:mysql_grant) do

before :each do
Expand All @@ -15,10 +16,28 @@
expect(@user[:privileges]).to eq(['ALL'])
end

it 'should accept PROXY privilege' do
@user[:privileges] = 'PROXY'
@user[:table] = 'proxy_user@proxy_host'
expect(@user[:privileges]).to eq(['PROXY'])
context 'PROXY privilege with mysql greater than or equal to 5.5.0' do
before :each do
Facter.stubs(:value).with(:mysql_version).returns('5.5.0')
end

it 'should not raise error' do
@user[:privileges] = 'PROXY'
@user[:table] = 'proxy_user@proxy_host'
expect(@user[:privileges]).to eq(['PROXY'])
end
end

context 'PROXY privilege with mysql greater than or equal to 5.4.0' do
before :each do
Facter.stubs(:value).with(:mysql_version).returns('5.4.0')
end

it 'should raise error' do
expect{
@user[:privileges] = 'PROXY'
}.to raise_error(Puppet::ResourceError, /PROXY user not supported on mysql versions < 5.5.0/)
end
end

it 'should accept a table' do
Expand Down

0 comments on commit a32697f

Please sign in to comment.