SlideShare a Scribd company logo
1 of 33
Download to read offline
Sunday, April 7, 13
testing!



                                 www.nedap.com
Sunday, April 7, 13
testing!
                         before production
                          not in production




                                          www.nedap.com
Sunday, April 7, 13
whoami

                      •   Daniele Sluijters
                      •   @daenney: irc, twitter, github, ...
                      •   mail: daniele.sluijters@nedap.com
                      •   XMPP / Jabber: ☝



                                                                www.nedap.com
Sunday, April 7, 13
www.nedap.com
© Ines Hegedus-Garcia | https://secure.flickr.com/photos/miamism/8446238376/
Sunday, April 7, 13
consequences

           exec	
  {	
  ‘first-­‐run-­‐reboot’:
           	
  	
  command	
  =>	
  ‘touch	
  /tmp/first-­‐run	
  
           	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  &&	
  reboot’,
           	
  	
  creates	
  =>	
  ‘/tmp/first-­‐run’,
           }


                                                                     www.nedap.com
Sunday, April 7, 13
avoid latest
                      class	
  mysql	
  {
                      	
  	
  package	
  {	
  ‘mysql-­‐server’:
                      	
  	
  	
  	
  ensure	
  =>	
  latest,
                      	
  	
  	
  	
  notify	
  =>	
  Service[‘mysql’],
                      	
  	
  }
                      }

                                                                  www.nedap.com
Sunday, April 7, 13
structure



                                  www.nedap.com
Sunday, April 7, 13
params
                 class	
  acme::params	
  {
                 	
  	
  case	
  $::osfamily	
  {
                 	
  	
  	
  	
  ‘Debian’:	
  {	
  $founder	
  =	
  ‘Marvin’	
  }
                 	
  	
  	
  	
  default:	
  {	
  fail(“No	
  can’t	
  do.”)	
  }
                 	
  	
  }
                 }

                                                                     www.nedap.com
Sunday, April 7, 13
params
                      class	
  acme::package	
  {	
  
                      	
  	
  package	
  {	
  ‘marvin’:
                      	
  	
  	
  	
  ensure	
  =>	
  $::acme::version,
                      	
  	
  }
                      	
  	
  ...
                      }

                                                                  www.nedap.com
Sunday, April 7, 13
configurable
                      class	
  acme(
                      	
  	
  $version	
  =	
  ‘1.6’,
                      	
  	
  $enable	
  =	
  true,
                      )	
  inherits	
  acme::params	
  {	
  
                      	
  	
  ...
                      }

                                                               www.nedap.com
Sunday, April 7, 13
users are crazy
                      class	
  acme(
                      	
  	
  $version	
  =	
  ‘1.6’,
                      	
  	
  $enable	
  =	
  true,
                      ){	
  
                      	
  	
  validate_string($version)
                      	
  	
  validate_bool($enable)
                      }

                                                          www.nedap.com
Sunday, April 7, 13
data sources

                      • Don’t couple modules to data
                      • Pass in data through params
                      • Use a profile to configure the module

                                                       www.nedap.com
Sunday, April 7, 13
profile
                      class	
  profile::acme	
  {
                      	
  	
  class	
  {	
  ‘acme’:
                      	
  	
  	
  	
  version	
  =>	
  hiera(‘version’)
                      	
  	
  	
  	
  ...
                      	
  	
  }
                      }

                                                                  www.nedap.com
Sunday, April 7, 13
misc


                      • Write docs
                      • Include a README + license


                                                      www.nedap.com
Sunday, April 7, 13
www.nedap.com
© elycefeliz | https://secure.flickr.com/photos/elycefeliz/4649829000/
Sunday, April 7, 13
www.nedap.com
© a200/a77Wells | https://secure.flickr.com/photos/aiwells/4672742619/
Sunday, April 7, 13
rspec-puppet



                                     www.nedap.com
Sunday, April 7, 13
setup
                      • Setup:
                       • use puppetlabs_spec_helper
                       • https://puppetlabs.com/blog/the-
                          next-generation-of-puppet-module-
                          testing/

                      • Read the tutorial:
                       • http://rspec-puppet.com/tutorial/
                                                        www.nedap.com
Sunday, April 7, 13
setup

                 source	
  :rubygems
                 gem	
  'puppet'	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  '~>	
  3.1'
                 gem	
  'facter'	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  '~>	
  1.6.18'
                 gem	
  'puppet-­‐lint'	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  ,	
  '~>	
  0.3.2'
                 gem	
  'puppetlabs_spec_helper'	
  ,	
  '~>	
  0.4.1'



                                                                                                           www.nedap.com
Sunday, April 7, 13
data

                • let	
  :params	
  do	
  {}	
  end
                • let	
  :facts	
  do	
  {}	
  end
                • let	
  :pre_condition	
  do	
  {}	
  end




                                                             www.nedap.com
Sunday, April 7, 13
matchers
                • should ⬌	
  should_not	
  
                • include_type
                • with_attr(‘value’)
                • ‘value2’})
                  with({:attr1	
  =>	
  ‘value1’,	
  :attr2	
  =>	
  


                • with_content(regex)
                                                          www.nedap.com
Sunday, April 7, 13
example
                      describe	
  'acme'	
  do
                      	
  	
  it	
  'should	
  declare	
  itself'	
  do
                      	
  	
  	
  	
  should	
  contain_class('acme')
                      	
  	
  end
                      end


                                                                     www.nedap.com
Sunday, April 7, 13
example
           context	
  ‘on	
  Debian’	
  do

           	
  	
  let	
  :facts	
  do	
  {	
  :osfamily	
  =>	
  ‘Debian’	
  }	
  end

           	
  	
  let	
  :params	
  do	
  {	
  :ver	
  =>	
  ‘1.2’	
  }	
  end

           	
  	
  it	
  ‘should	
  install	
  mysql’	
  do

           	
  	
  	
  	
  should	
  contain_package(‘mysql’).with_ensure(params[:ver]})

           	
  	
  end

           	
  	
  it	
  ‘should	
  not	
  install	
  redis’	
  do

           	
  	
  	
  	
  should_not	
  contain_package(‘redis’).with_ensure(‘present’)

           	
  	
  end

           end
                                                                                         www.nedap.com
Sunday, April 7, 13
success

                      module	
  git:master	
  ›❯	
  rake	
  spec
                      .............


                      Finished	
  in	
  2.43	
  seconds
                      13	
  examples,	
  0	
  failures


                                                               www.nedap.com
Sunday, April 7, 13
www.nedap.com
© Colin Fahrion | https://secure.flickr.com/photos/headlouse/1484615917/
Sunday, April 7, 13
automate

                      • Generate module structure
                       • init, install, config, services, params
                      • Generate tests
                      • Generate README
                      • CI
                                                           www.nedap.com
Sunday, April 7, 13
behaviour



                                  www.nedap.com
Sunday, April 7, 13
options

                      • Deploy to a testing environment
                      • Monitor your testing environment
                      • Test with rspec-...?

                                                           www.nedap.com
Sunday, April 7, 13
environment

                      • Jenkins + vagrant
                       • Can’t run on slaves
                       • Can’t run concurrent builds

                                                       www.nedap.com
Sunday, April 7, 13
monitoring

                      • Any tool you want to:
                       • nagios / icinga
                       • zabbix / zenoss / sensu
                       • ...

                                                   www.nedap.com
Sunday, April 7, 13
www.nedap.com
© Kristina Alexanderson | https://secure.flickr.com/photos/kalexanderson/5421517469/
Sunday, April 7, 13
q?



                           www.nedap.com
Sunday, April 7, 13

More Related Content

Similar to How and why you should test

Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet
 
Silex: From nothing to an API
Silex: From nothing to an APISilex: From nothing to an API
Silex: From nothing to an APIchrisdkemper
 
Ruby 2.0 / Rails 4.0, A selection of new features.
Ruby 2.0 / Rails 4.0, A selection of new features.Ruby 2.0 / Rails 4.0, A selection of new features.
Ruby 2.0 / Rails 4.0, A selection of new features.lrdesign
 
Ember and containers
Ember and containersEmber and containers
Ember and containersMatthew Beale
 
Rspec group
Rspec groupRspec group
Rspec groupthefonso
 
spring3.2 java config Servler3
spring3.2 java config Servler3spring3.2 java config Servler3
spring3.2 java config Servler3YongHyuk Lee
 

Similar to How and why you should test (8)

Puppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worldsPuppet and AWS: Getting the best of both worlds
Puppet and AWS: Getting the best of both worlds
 
Silex: From nothing to an API
Silex: From nothing to an APISilex: From nothing to an API
Silex: From nothing to an API
 
Ruby 2.0 / Rails 4.0, A selection of new features.
Ruby 2.0 / Rails 4.0, A selection of new features.Ruby 2.0 / Rails 4.0, A selection of new features.
Ruby 2.0 / Rails 4.0, A selection of new features.
 
Ruby 20th birthday
Ruby 20th birthdayRuby 20th birthday
Ruby 20th birthday
 
Ember and containers
Ember and containersEmber and containers
Ember and containers
 
Rspec group
Rspec groupRspec group
Rspec group
 
Rails Intro & Tutorial
Rails Intro & TutorialRails Intro & Tutorial
Rails Intro & Tutorial
 
spring3.2 java config Servler3
spring3.2 java config Servler3spring3.2 java config Servler3
spring3.2 java config Servler3
 

More from Puppet

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyamlPuppet
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)Puppet
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscodePuppet
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twentiesPuppet
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codePuppet
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approachPuppet
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationPuppet
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliancePuppet
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowPuppet
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Puppet
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppetPuppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkPuppet
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping groundPuppet
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy SoftwarePuppet
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User GroupPuppet
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsPuppet
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyPuppet
 

More from Puppet (20)

Puppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepoPuppet camp2021 testing modules and controlrepo
Puppet camp2021 testing modules and controlrepo
 
Puppetcamp r10kyaml
Puppetcamp r10kyamlPuppetcamp r10kyaml
Puppetcamp r10kyaml
 
2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)2021 04-15 operational verification (with notes)
2021 04-15 operational verification (with notes)
 
Puppet camp vscode
Puppet camp vscodePuppet camp vscode
Puppet camp vscode
 
Modules of the twenties
Modules of the twentiesModules of the twenties
Modules of the twenties
 
Applying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance codeApplying Roles and Profiles method to compliance code
Applying Roles and Profiles method to compliance code
 
KGI compliance as-code approach
KGI compliance as-code approachKGI compliance as-code approach
KGI compliance as-code approach
 
Enforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automationEnforce compliance policy with model-driven automation
Enforce compliance policy with model-driven automation
 
Keynote: Puppet camp compliance
Keynote: Puppet camp complianceKeynote: Puppet camp compliance
Keynote: Puppet camp compliance
 
Automating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNowAutomating it management with Puppet + ServiceNow
Automating it management with Puppet + ServiceNow
 
Puppet: The best way to harden Windows
Puppet: The best way to harden WindowsPuppet: The best way to harden Windows
Puppet: The best way to harden Windows
 
Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020Simplified Patch Management with Puppet - Oct. 2020
Simplified Patch Management with Puppet - Oct. 2020
 
Accelerating azure adoption with puppet
Accelerating azure adoption with puppetAccelerating azure adoption with puppet
Accelerating azure adoption with puppet
 
Puppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael PinsonPuppet catalog Diff; Raphael Pinson
Puppet catalog Diff; Raphael Pinson
 
ServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin ReeuwijkServiceNow and Puppet- better together, Kevin Reeuwijk
ServiceNow and Puppet- better together, Kevin Reeuwijk
 
Take control of your dev ops dumping ground
Take control of your  dev ops dumping groundTake control of your  dev ops dumping ground
Take control of your dev ops dumping ground
 
100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software100% Puppet Cloud Deployment of Legacy Software
100% Puppet Cloud Deployment of Legacy Software
 
Puppet User Group
Puppet User GroupPuppet User Group
Puppet User Group
 
Continuous Compliance and DevSecOps
Continuous Compliance and DevSecOpsContinuous Compliance and DevSecOps
Continuous Compliance and DevSecOps
 
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick MaludyThe Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
The Dynamic Duo of Puppet and Vault tame SSL Certificates, Nick Maludy
 

Recently uploaded

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 

Recently uploaded (20)

Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 

How and why you should test

  • 2. testing! www.nedap.com Sunday, April 7, 13
  • 3. testing! before production not in production www.nedap.com Sunday, April 7, 13
  • 4. whoami • Daniele Sluijters • @daenney: irc, twitter, github, ... • mail: daniele.sluijters@nedap.com • XMPP / Jabber: ☝ www.nedap.com Sunday, April 7, 13
  • 5. www.nedap.com © Ines Hegedus-Garcia | https://secure.flickr.com/photos/miamism/8446238376/ Sunday, April 7, 13
  • 6. consequences exec  {  ‘first-­‐run-­‐reboot’:    command  =>  ‘touch  /tmp/first-­‐run                            &&  reboot’,    creates  =>  ‘/tmp/first-­‐run’, } www.nedap.com Sunday, April 7, 13
  • 7. avoid latest class  mysql  {    package  {  ‘mysql-­‐server’:        ensure  =>  latest,        notify  =>  Service[‘mysql’],    } } www.nedap.com Sunday, April 7, 13
  • 8. structure www.nedap.com Sunday, April 7, 13
  • 9. params class  acme::params  {    case  $::osfamily  {        ‘Debian’:  {  $founder  =  ‘Marvin’  }        default:  {  fail(“No  can’t  do.”)  }    } } www.nedap.com Sunday, April 7, 13
  • 10. params class  acme::package  {      package  {  ‘marvin’:        ensure  =>  $::acme::version,    }    ... } www.nedap.com Sunday, April 7, 13
  • 11. configurable class  acme(    $version  =  ‘1.6’,    $enable  =  true, )  inherits  acme::params  {      ... } www.nedap.com Sunday, April 7, 13
  • 12. users are crazy class  acme(    $version  =  ‘1.6’,    $enable  =  true, ){      validate_string($version)    validate_bool($enable) } www.nedap.com Sunday, April 7, 13
  • 13. data sources • Don’t couple modules to data • Pass in data through params • Use a profile to configure the module www.nedap.com Sunday, April 7, 13
  • 14. profile class  profile::acme  {    class  {  ‘acme’:        version  =>  hiera(‘version’)        ...    } } www.nedap.com Sunday, April 7, 13
  • 15. misc • Write docs • Include a README + license www.nedap.com Sunday, April 7, 13
  • 16. www.nedap.com © elycefeliz | https://secure.flickr.com/photos/elycefeliz/4649829000/ Sunday, April 7, 13
  • 17. www.nedap.com © a200/a77Wells | https://secure.flickr.com/photos/aiwells/4672742619/ Sunday, April 7, 13
  • 18. rspec-puppet www.nedap.com Sunday, April 7, 13
  • 19. setup • Setup: • use puppetlabs_spec_helper • https://puppetlabs.com/blog/the- next-generation-of-puppet-module- testing/ • Read the tutorial: • http://rspec-puppet.com/tutorial/ www.nedap.com Sunday, April 7, 13
  • 20. setup source  :rubygems gem  'puppet'                                  ,  '~>  3.1' gem  'facter'                                  ,  '~>  1.6.18' gem  'puppet-­‐lint'                        ,  '~>  0.3.2' gem  'puppetlabs_spec_helper'  ,  '~>  0.4.1' www.nedap.com Sunday, April 7, 13
  • 21. data • let  :params  do  {}  end • let  :facts  do  {}  end • let  :pre_condition  do  {}  end www.nedap.com Sunday, April 7, 13
  • 22. matchers • should ⬌  should_not   • include_type • with_attr(‘value’) • ‘value2’}) with({:attr1  =>  ‘value1’,  :attr2  =>   • with_content(regex) www.nedap.com Sunday, April 7, 13
  • 23. example describe  'acme'  do    it  'should  declare  itself'  do        should  contain_class('acme')    end end www.nedap.com Sunday, April 7, 13
  • 24. example context  ‘on  Debian’  do    let  :facts  do  {  :osfamily  =>  ‘Debian’  }  end    let  :params  do  {  :ver  =>  ‘1.2’  }  end    it  ‘should  install  mysql’  do        should  contain_package(‘mysql’).with_ensure(params[:ver]})    end    it  ‘should  not  install  redis’  do        should_not  contain_package(‘redis’).with_ensure(‘present’)    end end www.nedap.com Sunday, April 7, 13
  • 25. success module  git:master  ›❯  rake  spec ............. Finished  in  2.43  seconds 13  examples,  0  failures www.nedap.com Sunday, April 7, 13
  • 26. www.nedap.com © Colin Fahrion | https://secure.flickr.com/photos/headlouse/1484615917/ Sunday, April 7, 13
  • 27. automate • Generate module structure • init, install, config, services, params • Generate tests • Generate README • CI www.nedap.com Sunday, April 7, 13
  • 28. behaviour www.nedap.com Sunday, April 7, 13
  • 29. options • Deploy to a testing environment • Monitor your testing environment • Test with rspec-...? www.nedap.com Sunday, April 7, 13
  • 30. environment • Jenkins + vagrant • Can’t run on slaves • Can’t run concurrent builds www.nedap.com Sunday, April 7, 13
  • 31. monitoring • Any tool you want to: • nagios / icinga • zabbix / zenoss / sensu • ... www.nedap.com Sunday, April 7, 13
  • 32. www.nedap.com © Kristina Alexanderson | https://secure.flickr.com/photos/kalexanderson/5421517469/ Sunday, April 7, 13
  • 33. q? www.nedap.com Sunday, April 7, 13