puppet-keepalived
puppet-keepalived copied to clipboard
Beaker tests for multiple nodes acceptance testing
Hi @arioch!
I remember you asking about how to write beaker specs for multiple nodes at the Puppet Contributor Summit, and I just figured out an example of how it could work:
Node set
HOSTS:
master:
roles:
- default
- master
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
backup:
roles:
- default
- backup
platform: el-6-x86_64
box : centos-64-x64-vbox4210-nocm
box_url : http://puppet-vagrant-boxes.puppetlabs.com/centos-64-x64-vbox4210-nocm.box
hypervisor : vagrant
CONFIG:
type: foss
require 'spec_helper_acceptance'
if hosts.length > 1
describe "configuring multi-node keepalived" do
let(:ipaddresses) do
hosts_as('backup').inject({}) do |memo,host|
memo[host] = fact_on host, "ipaddress_eth1"
memo
end
end
hosts_as('backup').each do |host|
it "should be able to configure a host as backup on #{host}" do
pp = <<-EOS
# Puppet code for BACKUP state here
EOS
apply_manifest_on(host, pp, :catch_failures => true)
end
end
hosts_as('master').each do |host|
it "should be able to configure a host as backup on #{host}" do
pp = <<-EOS
# Puppet code for MASTER state here
EOS
apply_manifest_on(host, pp, :catch_failures => true)
end
end
# Some sort of text to destroy host here and check that IP goes back to master?
end
end
Ohh excellent, thanks! :+1: Will have a closer look at it over the weekend.
No prob! :smile: I adapted this from @hunner's HAProxy multi-node testing code