SlideShare uma empresa Scribd logo
1 de 16
Baixar para ler offline
TESTING YOUR
INFALLIBLENESS
How to use puppet-retrospec to kickstart your module
testing.
ABOUT ME
Twitter: @cosman2001
Github: logicminds
IRC: cosman2001
Email: corey@logicminds.biz
• Devops toolsmith
• Puppet Consultant
• Ruby Developer
• Foreman Contributor (API, BMC,
Rubyipmi)
WHY TEST ?
* Raise confidence in your work
* Raise confidence for others to contribute
* upgrading to Puppet 4
* No IDE to catch your mistakes
* No sleep
* Your cat jumps on your keyboard before you git commit
http://www.wikihow.com/Get-Your-Cat-
to-Stop-Jumping-on-Your-Keyboard
MODULE
TESTING
TRANSFORMS
FEAR INTO
BOREDOM.
THE PROBLEM
• Puppet unit testing is constantly evolving.
• Best practices have not fully been established.
• Information is scattered across blogs, talks and github repos.
• Module testing requires same steps to setup with every module.
• No tool exists for post module creation.
SIMILAR TOOLS
• https://github.com/garethr/puppet-module-skeleton
• $ puppet module generate lmc-test_module
• $ rspec-puppet-init (outdated)
• Amazon mechanical turk
WHY RETROSPEC?
Your modules need to be tested and you just found out about
rspec-puppet. Now what?
RETROSPEC FEATURES
• Sets up module testing scaffolding for you.
• Parses your puppet code and creates some simple tests
• Auto inserts params that your class/define uses
• Auto resolves some variables for you.
• Uses common rspec test patterns
• Allows for easy template overriding
• Easy CLI workflow
MODULE TESTING
COMPONENTS
* Gemfile
* .travis.yml
* Rakefile
* spec directory
* spec helper
* spec files
* .fixtures.yml
* Beaker files
* misc…
USER TEMPLATES
.puppet_retrospec_templates/
├── acceptance_spec_test.erb
├── module_files
│   ├── Gemfile
│   ├── Rakefile
│   └── spec
│   ├── acceptance
│   │   └── nodesets
│   │   ├── centos-59-x64.yml
│   │   ├── ubuntu-server-12042-x64.yml
│   │   ├── ubuntu-server-1310-x64.yml
│   │   └── ubuntu-server-1404-x64.yml
│   ├── shared_contexts.rb
│   ├── spec_helper.rb
│   └── spec_helper_acceptance.rb
└── resource_spec_file.erb
Retrospect will recursively
create all files in the
modules_file path and
render them as erb
templates.
HOW RETROSPEC WORKS
1. Determines if directory is a module
2. Reads each manifest one at a time
3. Uses the AST puppet parser to parse all types in the module
4. Records parameters for given type and stores variables used
inside each manifest.
4. Parses conditional blocks that contain resources and variables*
5. Uses this information as a context to pass to templates for file
creation.
6. Determines if file already exists before creation.
Does not compile a catalog
DEMO
$ mkdir ~/modules
$ puppet module install -i ~/modules/ puppetlabs/apache
$ cd ~/modules/apache
$ rm -rf spec
$ gem install puppet-retrospec
$ retrospec -h
$ retrospec
FUNCTION MOCKING
describe 'foo::bar' do
let!(:add_stuff) { MockFunction.new('add_stuff') { |f|
f.stub.with([1, 2]).returns(3)
}
}
https://github.com/Accuity/rspec-puppet-utils
class test_add{

add_stuff(1,2)



}
FACT MOCKING
* https://github.com/mcanevet/rspec-puppet-facts
* https://github.com/apenney/puppet_facts
# below is the facts hash that gives you the ability to mock
# facts on a per describe/context block. If you use a fact in your
# manifest you should mock the facts below.
let(:facts) do
{:osfamily => ‘RedHat’}
end
HIERA/PARAMS
MOCKING
shared_context :hiera do

# example only,

let(:windows_hiera_data) do

{ 'tomcat::xmx_mem':
'1024M' }

end

end
describe 'Windows' do

include_context :windows_hiera_data

let(:facts) do

{ osfamily: 'Windows', path: 'c:programdata', operatingsystem: 'windows'}

end

let(:params) do

{

build: '50', version: '1.0', java_home: 'C:/Program Files/Java/jre7'

}

end
it { should contain_package('Go Agent') }
end
QUESTIONS?
Twitter: @cosman2001
Github: logicminds
IRC: cosman2001
Email: corey@logicminds.biz
https://github.com/logicminds/puppet-retrospec

Mais conteúdo relacionado

Mais procurados

Improve your workflow
Improve your workflowImprove your workflow
Improve your workflowAdam Štipák
 
Appium & Robot Framework
Appium & Robot FrameworkAppium & Robot Framework
Appium & Robot FrameworkFurkan Ertürk
 
Puppet in k8s, Miroslav Hadzhiev
Puppet in k8s, Miroslav HadzhievPuppet in k8s, Miroslav Hadzhiev
Puppet in k8s, Miroslav HadzhievPuppet
 
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)Tobias Liebig
 
OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014Anant Shrivastava
 
An Intro to Atom Editor
An Intro to Atom EditorAn Intro to Atom Editor
An Intro to Atom EditorAteev Chopra
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAsko Soukka
 
TYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CITYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CIderdanne
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaborationJulien Pivotto
 
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
Scalable Deployment Architectures with TYPO3 Surf, Git and JenkinsScalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkinsmhelmich
 
Null July - OWTF - Bharadwaj Machiraju
Null July - OWTF - Bharadwaj MachirajuNull July - OWTF - Bharadwaj Machiraju
Null July - OWTF - Bharadwaj MachirajuRaghunath G
 
Bonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopBonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopJano Suchal
 
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기CONNECT FOUNDATION
 

Mais procurados (20)

Improve your workflow
Improve your workflowImprove your workflow
Improve your workflow
 
Docker
DockerDocker
Docker
 
Generamba
GenerambaGeneramba
Generamba
 
Appium & Robot Framework
Appium & Robot FrameworkAppium & Robot Framework
Appium & Robot Framework
 
Puppet in k8s, Miroslav Hadzhiev
Puppet in k8s, Miroslav HadzhievPuppet in k8s, Miroslav Hadzhiev
Puppet in k8s, Miroslav Hadzhiev
 
Jenkins remote loader
Jenkins remote loaderJenkins remote loader
Jenkins remote loader
 
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
T3DD13 - Automated deployment for TYPO3 CMS (Workshop)
 
OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014OWASP Bangalore : OWTF demo : 13 Dec 2014
OWASP Bangalore : OWTF demo : 13 Dec 2014
 
An Intro to Atom Editor
An Intro to Atom EditorAn Intro to Atom Editor
An Intro to Atom Editor
 
Acceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and seleniumAcceptance testing plone sites and add ons with robot framework and selenium
Acceptance testing plone sites and add ons with robot framework and selenium
 
Social Coding GitHub 2015
Social Coding GitHub 2015Social Coding GitHub 2015
Social Coding GitHub 2015
 
TYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CITYPO3 CMS deployment with Jenkins CI
TYPO3 CMS deployment with Jenkins CI
 
Swift for tensorflow
Swift for tensorflowSwift for tensorflow
Swift for tensorflow
 
Chef
ChefChef
Chef
 
Monitoring as an entry point for collaboration
Monitoring as an entry point for collaborationMonitoring as an entry point for collaboration
Monitoring as an entry point for collaboration
 
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
Scalable Deployment Architectures with TYPO3 Surf, Git and JenkinsScalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
Scalable Deployment Architectures with TYPO3 Surf, Git and Jenkins
 
Atom.io Quick Scripting
Atom.io Quick ScriptingAtom.io Quick Scripting
Atom.io Quick Scripting
 
Null July - OWTF - Bharadwaj Machiraju
Null July - OWTF - Bharadwaj MachirajuNull July - OWTF - Bharadwaj Machiraju
Null July - OWTF - Bharadwaj Machiraju
 
Bonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet WorkshopBonetics: Mastering Puppet Workshop
Bonetics: Mastering Puppet Workshop
 
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
[부스트캠프 Tech Talk] 진명훈_datasets로 협업하기
 

Destaque

مالك الحزين إبراهيم اصلان Www.maktbah.com
مالك الحزين إبراهيم اصلان   Www.maktbah.com مالك الحزين إبراهيم اصلان   Www.maktbah.com
مالك الحزين إبراهيم اصلان Www.maktbah.com maktbahCom
 
2016 EOY Launch brchure Jan8
2016 EOY Launch brchure Jan82016 EOY Launch brchure Jan8
2016 EOY Launch brchure Jan8Fran Viau
 
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم www.maktbah.com
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم   www.maktbah.comحيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم   www.maktbah.com
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم www.maktbah.commaktbahCom
 
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة Www.maktbah.com
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة   Www.maktbah.com الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة   Www.maktbah.com
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة Www.maktbah.com maktbahCom
 
الأيام طه حسين - الجزء 1 - www.maktbah.com
الأيام   طه حسين - الجزء 1 - www.maktbah.comالأيام   طه حسين - الجزء 1 - www.maktbah.com
الأيام طه حسين - الجزء 1 - www.maktbah.commaktbahCom
 
جواز سفر فرنسا نادين جوزيف Www.maktbah.com
جواز سفر فرنسا نادين جوزيف   Www.maktbah.com جواز سفر فرنسا نادين جوزيف   Www.maktbah.com
جواز سفر فرنسا نادين جوزيف Www.maktbah.com maktbahCom
 
يوميات لينكساوي – الجزء الثاني
يوميات لينكساوي – الجزء الثانييوميات لينكساوي – الجزء الثاني
يوميات لينكساوي – الجزء الثانيmaktbahCom
 
TaxAlert2016No20
TaxAlert2016No20TaxAlert2016No20
TaxAlert2016No20Fran Viau
 
báo giá dịch vụ giúp việc nhà hcm
báo giá dịch vụ giúp việc nhà hcmbáo giá dịch vụ giúp việc nhà hcm
báo giá dịch vụ giúp việc nhà hcmaugust817
 
Deepa rani - CV updated
Deepa rani - CV updatedDeepa rani - CV updated
Deepa rani - CV updatedDeepa C
 
Что нового в Android M?
Что нового в Android M?Что нового в Android M?
Что нового в Android M?HackDay_Russia
 
Md. Imtiaz - Resume
Md. Imtiaz - ResumeMd. Imtiaz - Resume
Md. Imtiaz - ResumeMd Imtiaz
 

Destaque (12)

مالك الحزين إبراهيم اصلان Www.maktbah.com
مالك الحزين إبراهيم اصلان   Www.maktbah.com مالك الحزين إبراهيم اصلان   Www.maktbah.com
مالك الحزين إبراهيم اصلان Www.maktbah.com
 
2016 EOY Launch brchure Jan8
2016 EOY Launch brchure Jan82016 EOY Launch brchure Jan8
2016 EOY Launch brchure Jan8
 
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم www.maktbah.com
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم   www.maktbah.comحيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم   www.maktbah.com
حيل سحرية على فراش الزوجية Pdf مجاناً تأليف محمد حسان إبراهيم www.maktbah.com
 
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة Www.maktbah.com
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة   Www.maktbah.com الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة   Www.maktbah.com
الأجوبة الفاخرة عن الأسئلة الفاجرة في الرد على الملة الكافرة Www.maktbah.com
 
الأيام طه حسين - الجزء 1 - www.maktbah.com
الأيام   طه حسين - الجزء 1 - www.maktbah.comالأيام   طه حسين - الجزء 1 - www.maktbah.com
الأيام طه حسين - الجزء 1 - www.maktbah.com
 
جواز سفر فرنسا نادين جوزيف Www.maktbah.com
جواز سفر فرنسا نادين جوزيف   Www.maktbah.com جواز سفر فرنسا نادين جوزيف   Www.maktbah.com
جواز سفر فرنسا نادين جوزيف Www.maktbah.com
 
يوميات لينكساوي – الجزء الثاني
يوميات لينكساوي – الجزء الثانييوميات لينكساوي – الجزء الثاني
يوميات لينكساوي – الجزء الثاني
 
TaxAlert2016No20
TaxAlert2016No20TaxAlert2016No20
TaxAlert2016No20
 
báo giá dịch vụ giúp việc nhà hcm
báo giá dịch vụ giúp việc nhà hcmbáo giá dịch vụ giúp việc nhà hcm
báo giá dịch vụ giúp việc nhà hcm
 
Deepa rani - CV updated
Deepa rani - CV updatedDeepa rani - CV updated
Deepa rani - CV updated
 
Что нового в Android M?
Что нового в Android M?Что нового в Android M?
Что нового в Android M?
 
Md. Imtiaz - Resume
Md. Imtiaz - ResumeMd. Imtiaz - Resume
Md. Imtiaz - Resume
 

Semelhante a Testing your infallibleness

From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...Yury Bushmelev
 
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate) Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate) Puppet
 
Continuous integration of_puppet_code
Continuous integration of_puppet_codeContinuous integration of_puppet_code
Continuous integration of_puppet_codeDevoteam Revolve
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-parisJohan De Wit
 
Puppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPuppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPerforce
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015ice799
 
Introduction to puppet - Hands on Session at HPI Potsdam
Introduction to puppet - Hands on Session at HPI PotsdamIntroduction to puppet - Hands on Session at HPI Potsdam
Introduction to puppet - Hands on Session at HPI PotsdamChristoph Oelmüller
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectYen-Chin Lee
 
Puppetizing Your Organization
Puppetizing Your OrganizationPuppetizing Your Organization
Puppetizing Your OrganizationRobert Nelson
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)p3castro
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet ScriptingAchieve Internet
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Puppet
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflowTomas Doran
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Workhorse Computing
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackOpenStack
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Puppet
 
Testing your puppet code
Testing your puppet codeTesting your puppet code
Testing your puppet codeJulien Pivotto
 

Semelhante a Testing your infallibleness (20)

From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...From SaltStack to Puppet and beyond...
From SaltStack to Puppet and beyond...
 
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate) Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
Puppet Camp Paris 2015: Continuous Integration of Puppet Code (Intermediate)
 
Continuous integration of_puppet_code
Continuous integration of_puppet_codeContinuous integration of_puppet_code
Continuous integration of_puppet_code
 
Puppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven DevelopmentPuppet Camp Paris 2014: Test Driven Development
Puppet Camp Paris 2014: Test Driven Development
 
20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris20140408 tdd puppetcamp-paris
20140408 tdd puppetcamp-paris
 
Puppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for DeploymentsPuppet & Perforce: Versioning Everything for Deployments
Puppet & Perforce: Versioning Everything for Deployments
 
Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015Package manages and Puppet - PuppetConf 2015
Package manages and Puppet - PuppetConf 2015
 
Introduction to puppet - Hands on Session at HPI Potsdam
Introduction to puppet - Hands on Session at HPI PotsdamIntroduction to puppet - Hands on Session at HPI Potsdam
Introduction to puppet - Hands on Session at HPI Potsdam
 
Build your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto projectBuild your own embedded linux distributions by yocto project
Build your own embedded linux distributions by yocto project
 
Puppet quick start guide
Puppet quick start guidePuppet quick start guide
Puppet quick start guide
 
Puppetizing Your Organization
Puppetizing Your OrganizationPuppetizing Your Organization
Puppetizing Your Organization
 
Packaging perl (LPW2010)
Packaging perl (LPW2010)Packaging perl (LPW2010)
Packaging perl (LPW2010)
 
Introduction to Puppet Scripting
Introduction to Puppet ScriptingIntroduction to Puppet Scripting
Introduction to Puppet Scripting
 
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013Bootstrapping Puppet and Application Deployment - PuppetConf 2013
Bootstrapping Puppet and Application Deployment - PuppetConf 2013
 
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow Puppet Camp New York 2014: Streamlining Puppet Development Workflow
Puppet Camp New York 2014: Streamlining Puppet Development Workflow
 
Steamlining your puppet development workflow
Steamlining your puppet development workflowSteamlining your puppet development workflow
Steamlining your puppet development workflow
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.
 
How to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStackHow to build your own OpenStack distro using Puppet OpenStack
How to build your own OpenStack distro using Puppet OpenStack
 
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
Testing for Ops: Going Beyond the Manifest - PuppetConf 2013
 
Testing your puppet code
Testing your puppet codeTesting your puppet code
Testing your puppet code
 

Último

Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 

Último (20)

Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 

Testing your infallibleness

  • 1. TESTING YOUR INFALLIBLENESS How to use puppet-retrospec to kickstart your module testing.
  • 2. ABOUT ME Twitter: @cosman2001 Github: logicminds IRC: cosman2001 Email: corey@logicminds.biz • Devops toolsmith • Puppet Consultant • Ruby Developer • Foreman Contributor (API, BMC, Rubyipmi)
  • 3. WHY TEST ? * Raise confidence in your work * Raise confidence for others to contribute * upgrading to Puppet 4 * No IDE to catch your mistakes * No sleep * Your cat jumps on your keyboard before you git commit http://www.wikihow.com/Get-Your-Cat- to-Stop-Jumping-on-Your-Keyboard
  • 5. THE PROBLEM • Puppet unit testing is constantly evolving. • Best practices have not fully been established. • Information is scattered across blogs, talks and github repos. • Module testing requires same steps to setup with every module. • No tool exists for post module creation.
  • 6. SIMILAR TOOLS • https://github.com/garethr/puppet-module-skeleton • $ puppet module generate lmc-test_module • $ rspec-puppet-init (outdated) • Amazon mechanical turk
  • 7. WHY RETROSPEC? Your modules need to be tested and you just found out about rspec-puppet. Now what?
  • 8. RETROSPEC FEATURES • Sets up module testing scaffolding for you. • Parses your puppet code and creates some simple tests • Auto inserts params that your class/define uses • Auto resolves some variables for you. • Uses common rspec test patterns • Allows for easy template overriding • Easy CLI workflow
  • 9. MODULE TESTING COMPONENTS * Gemfile * .travis.yml * Rakefile * spec directory * spec helper * spec files * .fixtures.yml * Beaker files * misc…
  • 10. USER TEMPLATES .puppet_retrospec_templates/ ├── acceptance_spec_test.erb ├── module_files │   ├── Gemfile │   ├── Rakefile │   └── spec │   ├── acceptance │   │   └── nodesets │   │   ├── centos-59-x64.yml │   │   ├── ubuntu-server-12042-x64.yml │   │   ├── ubuntu-server-1310-x64.yml │   │   └── ubuntu-server-1404-x64.yml │   ├── shared_contexts.rb │   ├── spec_helper.rb │   └── spec_helper_acceptance.rb └── resource_spec_file.erb Retrospect will recursively create all files in the modules_file path and render them as erb templates.
  • 11. HOW RETROSPEC WORKS 1. Determines if directory is a module 2. Reads each manifest one at a time 3. Uses the AST puppet parser to parse all types in the module 4. Records parameters for given type and stores variables used inside each manifest. 4. Parses conditional blocks that contain resources and variables* 5. Uses this information as a context to pass to templates for file creation. 6. Determines if file already exists before creation. Does not compile a catalog
  • 12. DEMO $ mkdir ~/modules $ puppet module install -i ~/modules/ puppetlabs/apache $ cd ~/modules/apache $ rm -rf spec $ gem install puppet-retrospec $ retrospec -h $ retrospec
  • 13. FUNCTION MOCKING describe 'foo::bar' do let!(:add_stuff) { MockFunction.new('add_stuff') { |f| f.stub.with([1, 2]).returns(3) } } https://github.com/Accuity/rspec-puppet-utils class test_add{
 add_stuff(1,2)
 
 }
  • 14. FACT MOCKING * https://github.com/mcanevet/rspec-puppet-facts * https://github.com/apenney/puppet_facts # below is the facts hash that gives you the ability to mock # facts on a per describe/context block. If you use a fact in your # manifest you should mock the facts below. let(:facts) do {:osfamily => ‘RedHat’} end
  • 15. HIERA/PARAMS MOCKING shared_context :hiera do
 # example only,
 let(:windows_hiera_data) do
 { 'tomcat::xmx_mem': '1024M' }
 end
 end describe 'Windows' do
 include_context :windows_hiera_data
 let(:facts) do
 { osfamily: 'Windows', path: 'c:programdata', operatingsystem: 'windows'}
 end
 let(:params) do
 {
 build: '50', version: '1.0', java_home: 'C:/Program Files/Java/jre7'
 }
 end it { should contain_package('Go Agent') } end
  • 16. QUESTIONS? Twitter: @cosman2001 Github: logicminds IRC: cosman2001 Email: corey@logicminds.biz https://github.com/logicminds/puppet-retrospec