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

Automated Infrastructure Testing

Ranjib Dey
September 08, 2012
200

Automated Infrastructure Testing

Testing strategies for chef managed infrastructure

Ranjib Dey

September 08, 2012
Tweet

Transcript

  1. To Code (develop functionalities) To Test (ensure if its working

    fine) To Deploy (ensure if it can be released)
  2. To Code (develop functionalities) To Test (ensure if its working

    fine) To Deploy (ensure if it can be released) Automate
  3. To Code (develop functionalities) To Test (ensure if its working

    fine) To Deploy (ensure if it can be released) Automate Automate
  4. Scenario: Nginx is running as a daemon When I run

    "ps aux | grep nginx" Then I should see “nginx:master" in the output
  5. Tested code Deployed code Automate Infrastructure as Code Code Test

    Unit Testing Functional Testing Integration Testing
  6. describe_recipe 'nginx:configuration' do it 'installs version 1.0.15' do node[:nginx][:version].should ==

    '1.0.15' file("/etc/nginx/nginx.conf").must_have(:mode, "644") package("nginx").must_be_installed service("nginx").must_be_running end end
  7. Tested code Deployed code Automate Infrastructure as Code Code Test

    Unit Testing Functional Testing Integration Testing Monitoring
  8. • Remember to build feedback system . – Test harness

    should publish metrics in the same system where ops and project metrics are kept. – Have analytics or trending system on top of the metrics.
  9. Some advice • Remember MIME types? • World wont be

    fully automatic ever. Always automate the most time consuming task first. • No easy way out. The function domain requires you to understand man pages, rfps etc. • Choose a text editor rather than an Window manager based IDE.
  10. References • Infra-automation: http://www.opscode.com/chef/ • Monitoring: http://www.nagios.org/ • Lint tool:

    http://acrmp.github.com/foodcritic/ • Unit testing: https://github.com/acrmp/chefspec • Functional testing: http://www.cucumber-chef.org/ • Integration testing: https://github.com/calavera/minitest-chef-handler