testing with beaker: the story for windows

24
Testing with Beaker: The story for windows

Upload: liam-bennett

Post on 12-Jul-2015

210 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Testing with Beaker: The story for windows

Testing with Beaker: The story for windows

Page 2: Testing with Beaker: The story for windows

Who am I?

Senior Infrastructure Engineer at OpenTable4 year PuppeteerOccasional user of WindowsOccasional hater of Windows

@liamjbennett

Page 3: Testing with Beaker: The story for windows

Who am I?

Page 4: Testing with Beaker: The story for windows

Who am I?

Page 5: Testing with Beaker: The story for windows

What is Beaker?How does this work for Windows?

Oh god why?!? The pain-points and pitfalls

Page 6: Testing with Beaker: The story for windows

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

Page 7: Testing with Beaker: The story for windows

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

Page 8: Testing with Beaker: The story for windows

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

Page 9: Testing with Beaker: The story for windows

What is Beaker?

Page 10: Testing with Beaker: The story for windows

How does this work for Windows?

Page 11: Testing with Beaker: The story 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

Page 12: Testing with Beaker: The story 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

Page 13: Testing with Beaker: The story for windows
Page 14: Testing with Beaker: The story 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

Page 15: Testing with Beaker: The story 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

Page 16: Testing with Beaker: The story for windows
Page 17: Testing with Beaker: The story for windows

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

Page 18: Testing with Beaker: The story for windows

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

Page 19: Testing with Beaker: The story for windows

Demo

https://www.youtube.com/watch?v=RUyABwvxXwY

Page 20: Testing with Beaker: The story for windows

Oh god why?!?

The pain-points and pitfalls of working on Windows

Page 21: Testing with Beaker: The story for windows

• Beware of those backslashes• WOW3264 re-direction• UAC• WinRM Quotas• Reboots• Bugs (ask me for the KB articles later)

General Windows Challenges

Page 22: Testing with Beaker: The story for windows

• 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

Page 23: Testing with Beaker: The story for windows

Questions ?

Page 24: Testing with Beaker: The story for windows

liamjbennett

@liamjbennett

[email protected]

liamjbennett.me

opentable

@OpenTableTechUK

tech.opentable.co.uk