document mysql_server_id fact and add spec tests
add spec tests, expand documentation to mention lo behaviour also, rename fact, for, consistency.
This commit is contained in:
parent
dbf54cefe8
commit
d7077b43d2
3 changed files with 35 additions and 0 deletions
|
@ -768,6 +768,14 @@ The name of the MySQL plugin to manage.
|
||||||
|
|
||||||
The library file name.
|
The library file name.
|
||||||
|
|
||||||
|
###Facts
|
||||||
|
|
||||||
|
####`mysql_server_id`
|
||||||
|
|
||||||
|
Generates a unique id, based on the node's MAC address, which can be used as
|
||||||
|
`server_id`. This fact will *always* return `0` on all nodes which only have
|
||||||
|
loopback interfaces. Given those nodes' connnectivity that's probably okay.
|
||||||
|
|
||||||
##Limitations
|
##Limitations
|
||||||
|
|
||||||
This module has been tested on:
|
This module has been tested on:
|
||||||
|
|
27
spec/unit/facter/mysql_server_id_spec.rb
Normal file
27
spec/unit/facter/mysql_server_id_spec.rb
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe Facter::Util::Fact do
|
||||||
|
before {
|
||||||
|
Facter.clear
|
||||||
|
}
|
||||||
|
|
||||||
|
describe "mysql_server_id" do
|
||||||
|
context "igalic's laptop" do
|
||||||
|
before :each do
|
||||||
|
Facter.fact(:macadddress).stubs(:value).returns('3c:97:0e:69:fb:e1')
|
||||||
|
end
|
||||||
|
it do
|
||||||
|
Facter.fact(:mysql_server_id).value.to_s.should == '72898961'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "node with lo only" do
|
||||||
|
before :each do
|
||||||
|
Facter.fact(:macadddress).stubs(:value).returns('00:00:00:00:00:00')
|
||||||
|
end
|
||||||
|
it do
|
||||||
|
Facter.fact(:mysql_server_id).value.should == '0'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in a new issue