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:
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
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