Automated Infrastructure Testing

  • View
    956

  • Download
    0

Embed Size (px)

DESCRIPTION

An introduction to testing paradigms for chef managed infrastructure

Transcript

  • 1. Automated Infrastructure TestingRanjib Dey System Administrator, ThoughtWorks

2. Part 1What we are building? 3. What you already know? 4. To Code (develop functionalities)To Test (ensure if its working fine) 5. To Code (develop functionalities)AutomateTo Test (ensure if its working fine) 6. Enter DevOps/CD 7. To Code (develop functionalities)To Test (ensure if its working fine)To Deploy (ensure if it can be released) 8. To Code (develop functionalities)To Test (ensure if its working fine)AutomateTo Deploy (ensure if it can be released) 9. To Code (develop functionalities)AutomateTo Test (ensure if its working fine)AutomateTo Deploy (ensure if it can be released) 10. To CodeAutomateCITo TestAutomateTo Deploy 11. To CodeAutomateCITo TestCDAutomateTo Deploy 12. Part 2How it is different? 13. Tested codeAutomateDeployed code 14. InfrastructureTested codeAutomateDeployed code 15. InfrastructureTested code OperationsAutomateDeployed code 16. InfrastructureTested code OperationsAutomateDataDeployed code 17. InfrastructureTested code OperationsAutomateDataDeployed code Compliance 18. InfrastructureTested code OperationsAutomateDataDeployed code ComplianceEnd users 19. InfrastructureTested code OperationsAutomateDataDeployed code ComplianceEnd usersIntegrations 20. On infrastructure 21. To CodeAutomateTo TestAutomateTo Deploy 22. To Code AutomateBuild infrastructure To Test Automate To Deploy 23. To Code AutomateBuild infrastructure To Test AutomateProduction To DeployInfrastructure 24. Part 3On testing 25. Tested codeAutomateDeployed code 26. Tested codeAutomateInfrastructure as CodeDeployed code 27. Tested codeAutomateInfrastructure as CodeDeployed codeCode 28. Tested codeAutomateInfrastructure as CodeDeployed codeCodeTest 29. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTest 30. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTest 31. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTestFunctional Testing 32. Scenario: Nginx is running as a daemon When I run "ps aux | grep nginx"Then I should see nginx:master" in the output 33. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTest Functional Testing 34. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTest Functional TestingIntegration Testing 35. 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 endend 36. Tested codeAutomate Infrastructure as CodeDeployed code Unit TestingCodeTest Functional Testing Monitoring Integration Testing 37. Monitoring 38. Tested codeAutomate Infrastructure as CodeDeployed codeMonitoringTests Mocks 39. Tested codeAutomate Infrastructure as CodeDeployed codeTests MocksMonitoring Analytics 40. Part 4Cloud cometh 41. Cloud 42. I see more code 43. I see more codeI need more tests 44. CloudAWS 45. Cloud AWSRackspaceGCEHP Joyent 46. Oh yeahWe love cross browser testing? 47. Part 5Lessons learned 48. Health of infrastructure 49. Health of infrastructureBattle tested code 50. Health of infrastructureBattle tested code Thorough Monitoring 51. Remember to build feedback system . Test harness should publish metrics in the samesystem where ops and project metrics are kept. Have analytics or trending system on top of themetrics. 52. Collaborate more withOps. 53. Some advice Remember MIME types? World wont be fully automatic ever. Alwaysautomate the most time consuming task first. No easy way out. The function domainrequires you to understand man pages, rfpsetc. Choose a text editor rather than an Windowmanager based IDE. 54. 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 55. @RanjibDey http://ranjib.posterous.comhttp://www.dzone.com/users/ranjibd dey.ranjib@gmail.com