-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #524 from serverspec/support-mysql-config
Support checking MySQL configuration
- Loading branch information
Showing
3 changed files
with
31 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Serverspec::Type | ||
class MysqlConfig < Base | ||
def value | ||
ret = @runner.run_command("mysqld --verbose --help 2> /dev/null | grep '^#{@name}'") | ||
val = ret.stdout.match(/#{@name}\s+(.+)$/)[1] | ||
val = val.to_i if val.match(/^\d+$/) | ||
val | ||
end | ||
end | ||
end |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
require 'spec_helper' | ||
|
||
set :os, :family => 'base' | ||
|
||
describe mysql_config('innodb-buffer-pool-size') do | ||
let(:stdout) { 'innodb-buffer-pool-size 134217728' } | ||
its(:value) { should eq 134217728 } | ||
end | ||
|
||
describe mysql_config('socket') do | ||
let(:stdout) { 'socket /tmp/mysql.sock' } | ||
its(:value) { should eq '/tmp/mysql.sock' } | ||
end |