Properly generate `account` resources from our hiera data

Now with 100% more tests!

This commit introduces the ability to run rspec-puppet tests for the role and
profile classes that are being added into dist/. All other module tests hsould
be done in the repositories for those modules

[FIXED INFRA-8]
This commit is contained in:
R. Tyler Croy 2014-04-30 14:52:37 -07:00
parent f5f187cd57
commit 99366f50bd
9 changed files with 98 additions and 8 deletions

31
.fixtures.yml Normal file
View File

@ -0,0 +1,31 @@
# Fixtures needed for puppetlabs_spec_helper
fixtures:
repositories:
stdlib:
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '3.2.1'
r10k:
repo: 'git://github.com/acidprime/r10k.git'
ref: 'v1.0.2'
git:
repo: 'git://github.com/puppetlabs/puppetlabs-git.git'
ref: '0.0.3'
ruby:
repo: 'git://github.com/puppetlabs/puppetlabs-ruby.git'
ref: '0.1.1'
inifile:
repo: 'git://github.com/puppetlabs/puppetlabs-inifile.git'
ref: '1.0.3'
yamlfile:
repo: 'git://github.com/reidmv/puppet-module-yamlfile.git'
filemapper:
repo: 'git://github.com/adrienthebo/puppet-filemapper.git'
ref: '1.1.2'
account:
repo: 'git://github.com/jenkins-infra/puppet-account.git'
ref: '03280b8'
# Setting up a couple of symlinks to make it easier to treat profiles and roles
# just as another set of "modules" in our environment
symlinks:
profile: "#{source_dir}/dist/profile"
role: "#{source_dir}/dist/role"

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
*.swp
.vagrant*
.ruby-*
spec/fixtures/
.bundle

View File

@ -10,6 +10,10 @@ group :development do
# XXX: Shouldn't be needed anywhere by rtyler's machine, since Vagrant does'nt
# have proper installers for FreeBSD :(
gem 'vagrant', :github => 'mitchellh/vagrant', :ref => 'v1.5.4'
gem 'pry'
gem 'debugger', :platform => :mri
gem 'debugger-pry', :platform => :mri
end
# Vagrant plugins

View File

@ -33,6 +33,17 @@ GEM
nio4r (>= 0.5.0)
childprocess (0.5.3)
ffi (~> 1.0, >= 1.0.11)
coderay (1.1.0)
columnize (0.3.6)
debugger (1.6.5)
columnize (>= 0.3.1)
debugger-linecache (~> 1.2.0)
debugger-ruby_core_source (~> 1.3.1)
debugger-linecache (1.2.0)
debugger-pry (0.1.1)
debugger (~> 1)
pry (>= 0.9.9)
debugger-ruby_core_source (1.3.1)
diff-lcs (1.2.5)
erubis (2.7.0)
excon (0.33.0)
@ -67,6 +78,7 @@ GEM
rb-inotify (>= 0.9)
log4r (1.1.10)
metaclass (0.0.4)
method_source (0.8.2)
mime-types (2.2)
mini_portile (0.5.3)
mocha (1.0.0)
@ -78,6 +90,10 @@ GEM
nio4r (1.0.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
pry (0.9.12.6)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
puppet (3.4.3)
facter (~> 1.6)
hiera (~> 1.0)
@ -105,6 +121,7 @@ GEM
rspec-mocks (2.14.6)
rspec-puppet (1.0.1)
rspec
slop (3.4.7)
timers (1.1.0)
wdm (0.1.0)
@ -112,6 +129,9 @@ PLATFORMS
ruby
DEPENDENCIES
debugger
debugger-pry
pry
puppet (~> 3.4.0)
puppet-lint
puppetlabs_spec_helper

7
dist/profile/manifests/accounts.pp vendored Normal file
View File

@ -0,0 +1,7 @@
#
# Profile defining all the `account` resources with all our important account
# information
class profile::accounts {
$accounts = hiera_hash('accounts')
create_resources('account', $accounts)
}

View File

@ -2,22 +2,24 @@
accounts:
tyler:
ssh_keys:
- AAAAB3NzaC1yc2EAAAABIwAAAQEAueiy12T5bvFhsc9YjfLc3aVIxgySd3gDxQWy/bletIoZL8omKmzocBYJ7F58U1asoyfWsy2ToTOY8jJp1eToXmbD6L5+xvHba0A7djYh9aQRrFam7doKQ0zp0ZSUF6+R1v0OM4nnWqK4n2ECIYd+Bdzrp+xA5+XlW3ZSNzlnW2BeWznzmgRMcp6wI+zQ9GMHWviR1cxpml5Z6wrxTZ0aX91btvnNPqoOGva976B6e6403FOEkkIFTk6CC1TFKwc/VjbqxYBg4kU0JhiTP+iEZibcQrYjWdYUgAotYbFVe5/Dne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/HwTZFZBihw/B8mD6ubut5py0GUc8sI/Qo7++1qaEjhXg6aLZGqu+USH0aE/fgqzZq1o8YF+HxuN5FhWKsbL3T1ukf387gT6rhuUje4Ch9ko/h40IsIyvpcqVCGo47SfDz+lCT2A0mXp/rtJRYOTGdqLAUcJ1zZNawf7FrxGtphuppgyGYFHT+qq4lRRlgVu6rZrAWWoDPPexGB4XuRrbcgKXZ595WQjpx+zlz6Og5TNX4bvX59MQPKr8cg3Qj842ZfOgPkBvOw==
groups:
- sudo

View File

@ -0,0 +1,7 @@
require 'spec_helper'
describe 'profile::accounts' do
it { should contain_account 'tyler' }
it { should contain_account 'kohsuke' }
it { should contain_account 'abayer' }
end

View File

@ -0,0 +1,6 @@
require 'spec_helper'
describe 'profile::puppetmaster' do
it { pending; should contain_class 'r10k' }
it { pending; should contain_file('/etc/puppetlabs/puppet/hiera.yaml') }
end

View File

@ -0,0 +1,11 @@
require 'rubygems'
require 'pry'
require 'puppetlabs_spec_helper/module_spec_helper'
RSpec.configure do |c|
c.hiera_config = File.expand_path(File.dirname(__FILE__) + '/fixtures/hiera.yaml')
c.default_facts = {
:osfamily => 'Debian',
}
c.mock_with :rspec
end