-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The spec helper initializes hosts before the test suite is begun. The hosts array is assigned to an RSpec setting to persist access across testing.
- Loading branch information
Alice Nodelman
committed
Nov 6, 2013
1 parent
2c7893d
commit 2a4d973
Showing
5 changed files
with
49 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
Gemfile.lock | ||
.bundle | ||
*.swp |
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 |
---|---|---|
@@ -1,21 +1,23 @@ | ||
HOSTS: | ||
pe-ubuntu-lucid: | ||
ubuntu-10-04-4-x64-master: | ||
roles: | ||
- master | ||
- agent | ||
- dashboard | ||
- database | ||
vmname : pe-ubuntu-lucid | ||
platform: ubuntu-10.04-i386 | ||
snapshot : clean-w-keys | ||
hypervisor : fusion | ||
pe-centos6: | ||
platform: ubuntu-10.04-amd64 | ||
hypervisor : vagrant | ||
box: ubuntu-server-10044-x64-vbox4210 | ||
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210.box | ||
ip : 192.168.20.20 | ||
ubuntu-10-04-4-x64-agent: | ||
roles: | ||
- agent | ||
vmname : pe-centos6 | ||
platform: el-6-i386 | ||
hypervisor : fusion | ||
snapshot: clean-w-keys | ||
platform: ubuntu-10.04-amd64 | ||
hypervisor : vagrant | ||
box: ubuntu-server-10044-x64-vbox4210 | ||
box_url : http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-10044-x64-vbox4210.box | ||
ip : 192.168.21.21 | ||
CONFIG: | ||
nfs_server: none | ||
consoleport: 443 |
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,7 @@ | ||
module BeakerRSpec::Helpers | ||
include Beaker::DSL | ||
|
||
def hosts | ||
self.class.hosts | ||
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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
require "rspec/expectations" | ||
require "beaker-rspec" | ||
require 'beaker-rspec' | ||
require 'helpers' | ||
|
||
include BeakerRSpec | ||
|
||
RSpec.configure do |c| | ||
# Enable color | ||
c.tty = true | ||
|
||
# Define persistant hosts setting | ||
c.add_setting :hosts | ||
|
||
RSpec.configure do |config| | ||
# System specific config | ||
config.include BeakerRSpec | ||
c.extend BeakerRSpec::Helpers #to allow dsl access outside tests | ||
|
||
config.before(:all) do | ||
setup(['--hosts', 'sample.cfg']) | ||
provision | ||
validate | ||
end | ||
# Defined target nodeset | ||
nodeset = ENV['RSPEC_SET'] || 'sample.cfg' | ||
preserve = ENV['RSPEC_DESTROY'] ? '--preserve-hosts' : '' | ||
fresh_nodes = ENV['RSPEC_PROVISION'] ? '' : '--no-provision' | ||
|
||
config.after(:all) do | ||
cleanup | ||
end | ||
# Configure all nodes in nodeset | ||
c.setup([preserve, fresh_nodes, '--type','git','--hosts', nodeset]) | ||
c.provision | ||
c.validate | ||
|
||
# Destroy nodes if no preserve hosts | ||
c.after :suite do | ||
c.cleanup | ||
end | ||
end |