Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Testing with Beaker: The story for windows

Liam Bennett
November 20, 2014
16

Testing with Beaker: The story for windows

Introduction to testing Puppet on Windows with Beaker

Liam Bennett

November 20, 2014
Tweet

Transcript

  1. Who am I? Senior Infrastructure Engineer at OpenTable 4 year

    Puppeteer Occasional user of Windows Occasional hater of Windows @liamjbennett
  2. What is Beaker? How does this work for Windows? Oh

    god why?!? The pain-points and pitfalls
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. 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
  10. 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
  11. 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
  12. • Beware of those backslashes • WOW3264 re-direction • UAC

    • WinRM Quotas • Reboots • Bugs (ask me for the KB articles later) General Windows Challenges
  13. • 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