Post on 12-Jul-2015
Testing with Beaker: The story for windows
Who am I?
Senior Infrastructure Engineer at OpenTable4 year PuppeteerOccasional user of WindowsOccasional hater of Windows
@liamjbennett
Who am I?
Who am I?
What is Beaker?How does this work for Windows?
Oh god why?!? The pain-points and pitfalls
What is Beaker?
• Acceptance testing harness
• Ruby-based DSL for testing your puppet manifests in a 'real' environment
• Uses rspec and serverspec under the hoodSpin up nodes in vagrant/aws/vsphere/docker
What is Beaker?
NodeSets
HOSTS:
ubuntu-server-12042-x64:
roles:
- master
platform: ubuntu-12.04-amd64
box: ubuntu-server-12042-x64-vbox4210-nocm
hypervisor : vagrant
CONFIG:
type: foss
spec/acceptance/nodesets/ubuntu-server-12042-x64.yml
What is Beaker?First Test
require 'spec_helper'
describe 'homes::home', :type => :define do
context 'manage the users' do
myuser = {
'testuser' => {'groups' => {'testgroup1' => '', 'testgroup2' => '' } }
}
describe 'ensure that the user and home directory exists' do
let(:title) { "user exists" }
let(:params) {{ 'user' => myuser }}
let(:facts) {{ :osfamily => 'Debian' }}
it { should compile.with_all_deps }
it { should contain_user('testuser').with(
'groups' => ['testgroup1', 'testgroup2']
)}
end
end
end
What is Beaker?
How does this work for Windows?
How does this work for Windows?
NodeSets
spec/acceptance/nodesets/windows-2008R2-serverstandard-x64.yml
HOSTS:
win-2008R2-std:
box: opentable/win-2008r2-standard-amd64-nocm
platform: windows-server-amd64
roles:
- default
- agent
hypervisor: vagrant
user: vagrant
ip: '10.255.33.129'
communicator: bitvise
CONFIG:
log_level: verbose
How does this work for Windows?
NodeSets
spec/acceptance/nodesets/windows-2008R2-serverstandard-x64.yml
HOSTS:
win-2008R2-std:
box: opentable/win-2008r2-standard-amd64-nocm
platform: windows-server-amd64
roles:
- default
- agent
hypervisor: vagrant
user: vagrant
ip: '10.255.33.129'
communicator: bitvise
CONFIG:
log_level: verbose
How does this work for Windows?
NodeSets
spec/acceptance/nodesets/windows-2008R2-serverstandard-x64.yml
HOSTS:
win-2008R2-std:
box: opentable/win-2008r2-standard-amd64-nocm
platform: windows-server-amd64
roles:
- default
- agent
hypervisor: vagrant
user: vagrant
ip: '10.255.33.129'
communicator: bitvise
CONFIG:
log_level: verbose
How does this work for Windows?
NodeSets
spec/acceptance/nodesets/windows-2008R2-serverstandard-x64.yml
HOSTS:
win-2008R2-std:
box: opentable/win-2008r2-standard-amd64-nocm
platform: windows-server-amd64
roles:
- default
- agent
hypervisor: vagrant
user: vagrant
ip: '10.255.33.129'
communicator: bitvise
CONFIG:
log_level: verbose
How does this work for Windows?
require 'spec_helper_acceptance'
describe 'windowsfeature' do
context 'windows feature should be installed' do
it 'should install .net 3.5 feature' do
pp = <<-PP
windowsfeature { 'as-net-framework': }
PP
apply_manifest(pp, :catch_failures => true)
expect(apply_manifest(pp, :catch_failures => true).exit_code).to be_zero
end
describe windows_feature('as-net-framework') do
it { should be_installed.by('powershell') }
end
end
end
First windows test
How does this work for Windows?
require 'spec_helper_acceptance'
context 'Disabling of UAC' do
$key = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System'
describe windows_registry_key($key) do
it { should have_property_value('EnableLUA', :type_dword, '0x00000000') }
end
end
Other Examples
require 'spec_helper_acceptance'
context 'Installation of McAfee Agent' do
describe package('McAfee Agent') do
it { should be_installed }
end
describe service('McAfee Framework Service') do
it { should be_running }
it { should have_start_mode('Automatic') }
end
end
Oh god why?!?
The pain-points and pitfalls of working on Windows
• Beware of those backslashes• WOW3264 re-direction• UAC• WinRM Quotas• Reboots• Bugs (ask me for the KB articles later)
General Windows Challenges
• Not all SSH daemons are equal• No WinRM just yet• Not all hypervisors are equal• 64-bit version of Puppet• FOSS vs PE
Challenges of Beaker with Windows
Questions ?
liamjbennett
@liamjbennett
liamjbennett@gmail.com
liamjbennett.me
opentable
@OpenTableTechUK
tech.opentable.co.uk