Skip to content

Commit

Permalink
Fixed test classes
Browse files Browse the repository at this point in the history
Oracle 7 uses mariadb

Update PE and OS compatibility info in metadata

Now compatible with PE 3.4 and SLES 10.

Clean up metadata for new SLES support

Add timeout parameter to increase for long time running sql imports

Signed-off-by: refnode <refnode@gmail.com>

Add documentation for new mysql::db "import_timeout" parameter

Signed-off-by: refnode <refnode@gmail.com>

Add support for Gentoo

The old regex requires something after the 'host' part. Fix this.

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns
"GRANT SELECT ON `database`.* TO 'user'@'%'" which does not match (\s.*)$ .
This small patch fixes this making last bloc optional (thanks to '?').

Add explicit dependencies for types

mysql_grant has an autorequire()'d dependency on the .my.cnf file used
by the provider to talk to the database.

I've added this to mysql_database and mysql_user too since logically
these also need the file to be in place.

I've hit this bug because of a slightly unusual edge case in our own
manifests, but I think this fix belongs upstream regardless.

(maint) add statement "MANAGED BY PUPPET" to my.cnf config file template and remove unused my.conf.cnf.erb template

Improve checks for MySQL user's name.

As per http://dev.mysql.com/doc/refman/5.5/en/identifiers.html , MySQL
allows for more than '\w-'. This commit improves the check to ensure
that:
 - if username only contains [0-9a-zA-Z$_], it might be quoted. It is
   not a requirement though
 - if username contains anything else, it MUST be quoted

I kept 2 checks, but the 2nd one can probably be removed (I can't find a
username which match the 2nd one but not the first.)

Fix escaped backslashes in grants

* Mysql uses the underscore character to represent a single character
  wildcard.
* A grant on table `the_database`.* would match `theAdatabase`.*, so
  underscores must be escaped to avoid this match.
* The output from mysql escapes special characters (\n, \t, \0, and \\),
  but the input does not need to be escaped.
* In order for the provider to compare the tables, the output of
  mysql -NBe <query> must have \\ substituted with \.

Fixed backup test

Oracle 7 uses mariadb

Update PE and OS compatibility info in metadata

Now compatible with PE 3.4 and SLES 10.

Add timeout parameter to increase for long time running sql imports

Signed-off-by: refnode <refnode@gmail.com>

Add documentation for new mysql::db "import_timeout" parameter

Signed-off-by: refnode <refnode@gmail.com>

Add support for Gentoo

The old regex requires something after the 'host' part. Fix this.

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns
"GRANT SELECT ON `database`.* TO 'user'@'%'" which does not match (\s.*)$ .
This small patch fixes this making last bloc optional (thanks to '?').

Add explicit dependencies for types

mysql_grant has an autorequire()'d dependency on the .my.cnf file used
by the provider to talk to the database.

I've added this to mysql_database and mysql_user too since logically
these also need the file to be in place.

I've hit this bug because of a slightly unusual edge case in our own
manifests, but I think this fix belongs upstream regardless.

(maint) add statement "MANAGED BY PUPPET" to my.cnf config file template and remove unused my.conf.cnf.erb template

Improve checks for MySQL user's name.

As per http://dev.mysql.com/doc/refman/5.5/en/identifiers.html , MySQL
allows for more than '\w-'. This commit improves the check to ensure
that:
 - if username only contains [0-9a-zA-Z$_], it might be quoted. It is
   not a requirement though
 - if username contains anything else, it MUST be quoted

I kept 2 checks, but the 2nd one can probably be removed (I can't find a
username which match the 2nd one but not the first.)

Fix escaped backslashes in grants

* Mysql uses the underscore character to represent a single character
  wildcard.
* A grant on table `the_database`.* would match `theAdatabase`.*, so
  underscores must be escaped to avoid this match.
* The output from mysql escapes special characters (\n, \t, \0, and \\),
  but the input does not need to be escaped.
* In order for the provider to compare the tables, the output of
  mysql -NBe <query> must have \\ substituted with \.
  • Loading branch information
biancini authored and Morgan Haskel committed Nov 18, 2014
1 parent 18265e0 commit 473a3c3
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 27 deletions.
6 changes: 3 additions & 3 deletions manifests/bindings.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@

case $::osfamily {
'Archlinux': {
if $java_enable { fatal("::mysql::bindings::java cannot be managed by puppet on ${::osfamily} as it is not in official repositories. Please disable java mysql binding.") }
if $java_enable { fail("::mysql::bindings::java cannot be managed by puppet on ${::osfamily} as it is not in official repositories. Please disable java mysql binding.") }
if $perl_enable { include '::mysql::bindings::perl' }
if $php_enable { warn("::mysql::bindings::php does not need to be managed by puppet on ${::osfamily} as it is included in mysql package by default.") }
if $php_enable { warning("::mysql::bindings::php does not need to be managed by puppet on ${::osfamily} as it is included in mysql package by default.") }
if $python_enable { include '::mysql::bindings::python' }
if $ruby_enable { fatal("::mysql::bindings::ruby cannot be managed by puppet on ${::osfamily} as it is not in official repositories. Please disable ruby mysql binding.") }
if $ruby_enable { fail("::mysql::bindings::ruby cannot be managed by puppet on ${::osfamily} as it is not in official repositories. Please disable ruby mysql binding.") }
}

default: {
Expand Down
5 changes: 3 additions & 2 deletions tests/backup.pp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
class { 'mysql::server':
config_hash => {'root_password' => 'password'}
root_password => 'password'
}
class { 'mysql::backup':

class { 'mysql::server::backup':
backupuser => 'myuser',
backuppassword => 'mypassword',
backupdir => '/tmp/backups',
Expand Down
2 changes: 1 addition & 1 deletion tests/bindings.pp
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
class { 'mysql::bindings':
php_enable => 'true',
php_enable => true,
}
8 changes: 4 additions & 4 deletions tests/mysql_database.pp
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
class { 'mysql::server':
config_hash => {'root_password' => 'password'}
root_password => 'password'
}
database{ ['test1', 'test2', 'test3']:
mysql::db{ ['test1', 'test2', 'test3']:
ensure => present,
charset => 'utf8',
require => Class['mysql::server'],
}
database{ 'test4':
mysql::db{ 'test4':
ensure => present,
charset => 'latin1',
}
database{ 'test5':
mysql::db{ 'test5':
ensure => present,
charset => 'binary',
collate => 'binary',
Expand Down
2 changes: 1 addition & 1 deletion tests/mysql_db.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class { 'mysql::server':
config_hash => {'root_password' => 'password'}
root_password => 'password'
}
mysql::db { 'mydb':
user => 'myuser',
Expand Down
4 changes: 1 addition & 3 deletions tests/mysql_user.pp
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
$mysql_root_pw = 'password'

class { 'mysql::server':
config_hash => {
root_password => 'password',
}
root_password => 'password',
}

mysql_user{ 'redmine@localhost':
Expand Down
2 changes: 1 addition & 1 deletion tests/perl.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include mysql::perl
include mysql::bindings::perl
2 changes: 1 addition & 1 deletion tests/python.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
class { 'mysql::python':}
class { 'mysql::bindings::python':}
2 changes: 1 addition & 1 deletion tests/ruby.pp
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include mysql::ruby
include mysql::bindings::ruby
2 changes: 1 addition & 1 deletion tests/server/account_security.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class { 'mysql::server':
config_hash => { 'root_password' => 'password', },
root_password => 'password',
}
class { 'mysql::server::account_security': }
10 changes: 1 addition & 9 deletions tests/server/config.pp
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
mysql::server::config { 'testfile':
settings => {
'mysqld' => {
'bind-address' => '0.0.0.0',
'read-only' => true,
},
'client' => {
'port' => '3306'
}
}

}

0 comments on commit 473a3c3

Please sign in to comment.