-
Notifications
You must be signed in to change notification settings - Fork 794
mysql_grant: Output missmatching data during validation #1666
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
Open
bastelfreak
wants to merge
1
commit into
puppetlabs:main
Choose a base branch
from
bastelfreak:debug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The type does some validation for the title and user/table. It's helpful to output the data when the validation doesn't succeed.
@@ -37,7 +37,9 @@ def initialize(*args) | |||
raise(_('mysql_grant: `table` `parameter` is required.')) if self[:ensure] == :present && self[:table].nil? | |||
raise(_('mysql_grant: `user` `parameter` is required.')) if self[:ensure] == :present && self[:user].nil? | |||
|
|||
raise(_('mysql_grant: `name` `parameter` must match user@host/table format.')) if self[:user] && self[:table] && (self[:name] != "#{self[:user]}/#{self[:table]}") | |||
if self[:user] && self[:table] && (self[:name] != "#{self[:user]}/#{self[:table]}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following spec tests are failing, can you please check on this
Failures:
1) Facter::Util::Fact mysql_server_id igalic's laptop
Failure/Error: Facter.fact(:macaddress).stubs(:value).returns('3c:97:0e:69:fb:e1')
Mocha::StubbingError:
can't stub method on frozen object: nil
# ./spec/unit/facter/mysql_server_id_spec.rb:11:in `block (4 levels) in <top (required)>'
2) Facter::Util::Fact mysql_server_id node with lo only
Failure/Error: Facter.fact(:macaddress).stubs(:value).returns('00:00:00:00:00:00')
Mocha::StubbingError:
can't stub method on frozen object: nil
# ./spec/unit/facter/mysql_server_id_spec.rb:20:in `block (4 levels) in <top (required)>'
3) function_mysql_deepmerge when calling mysql_deepmerge from puppet should not compile when no arguments are passed
Failure/Error:
expect {
scope.compiler.compile
}.to raise_error(Puppet::ParseError, /wrong number of arguments/)
expected Puppet::ParseError with message matching /wrong number of arguments/, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:13:in `block (4 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:12:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:12:in `block (3 levels) in <top (required)>'
4) function_mysql_deepmerge when calling mysql_deepmerge from puppet should not compile when 1 argument is passed
Failure/Error:
expect {
scope.compiler.compile
}.to raise_error(Puppet::ParseError, /wrong number of arguments/)
expected Puppet::ParseError with message matching /wrong number of arguments/, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:21:in `block (4 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:20:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:20:in `block (3 levels) in <top (required)>'
5) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should require all parameters are hashes
Failure/Error: expect { new_hash = scope.function_mysql_deepmerge([{}, '2'])}.to raise_error(Puppet::ParseError, /unexpected argument type String/)
expected Puppet::ParseError with message matching /unexpected argument type String/, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:28:in `block (4 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:28:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:28:in `block (3 levels) in <top (required)>'
6) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should accept empty strings as puppet undef
Failure/Error: expect { new_hash = scope.function_mysql_deepmerge([{}, ''])}.not_to raise_error
expected no Exception, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:33:in `block (4 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:33:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:33:in `block (3 levels) in <top (required)>'
7) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should be able to mysql_deepmerge two hashes
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:37:in `block (3 levels) in <top (required)>'
8) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should mysql_deepmerge multiple hashes
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:44:in `block (3 levels) in <top (required)>'
9) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should accept empty hashes
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:49:in `block (3 levels) in <top (required)>'
10) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should mysql_deepmerge subhashes
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:53:in `block (3 levels) in <top (required)>'
11) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should append to subhashes
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:60:in `block (3 levels) in <top (required)>'
12) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should append to subhashes 2
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:65:in `block (3 levels) in <top (required)>'
13) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should append to subhashes 3
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:72:in `block (3 levels) in <top (required)>'
14) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should equate keys mod dash and underscore
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:78:in `block (3 levels) in <top (required)>'
15) function_mysql_deepmerge when calling mysql_deepmerge on the scope instance should keep style of the last when keys are euqal mod dash and underscore
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:6:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_deepmerge_spec.rb:84:in `block (3 levels) in <top (required)>'
16) the mysql_password function should raise a ParseError if there is less than 1 arguments
Failure/Error: expect { scope.function_mysql_password([]) }.to( raise_error(Puppet::ParseError))
expected Puppet::ParseError, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_password_spec.rb:8:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:15:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:15:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:15:in `block (2 levels) in <top (required)>'
17) the mysql_password function should raise a ParseError if there is more than 1 arguments
Failure/Error: expect { scope.function_mysql_password(%w(foo bar)) }.to( raise_error(Puppet::ParseError))
expected Puppet::ParseError, got #<NoMethodError: undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^> with backtrace:
# ./spec/unit/puppet/functions/mysql_password_spec.rb:8:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:19:in `block (3 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:19:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:19:in `block (2 levels) in <top (required)>'
18) the mysql_password function should convert password into a hash
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_password_spec.rb:8:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:23:in `block (2 levels) in <top (required)>'
19) the mysql_password function should convert an empty password into a empty string
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_password_spec.rb:8:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:28:in `block (2 levels) in <top (required)>'
20) the mysql_password function should not convert a password that is already a hash
Failure/Error: let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
NoMethodError:
undefined method `scope' for PuppetlabsSpec::PuppetInternals:Module
let(:scope) { PuppetlabsSpec::PuppetInternals.scope }
^^^^^^
# ./spec/unit/puppet/functions/mysql_password_spec.rb:8:in `block (2 levels) in <top (required)>'
# ./spec/unit/puppet/functions/mysql_password_spec.rb:33:in `block (2 levels) in <top (required)>'
Finished in 0.85942 seconds (files took 1.04 seconds to load)
117 examples, 20 failures
Although not related to your change, can you please fix lint error so that spec test cases will run |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The type does some validation for the title and user/table. It's helpful to output the data when the validation doesn't succeed.
Summary
Provide a detailed description of all the changes present in this pull request.
Additional Context
Add any additional context about the problem here.
Related Issues (if any)
Mention any related issues or pull requests.
Checklist
puppet apply
)