Post on 08-May-2015
description
Automated Infrastructure Testing
Ranjib DeySystem Administrator, ThoughtWorks
Part 1What we are building?
What you already know?
To Code (develop functionalities)
To Test (ensure if its working fine)
To Code (develop functionalities)
To Test (ensure if its working fine)
Automate
Enter DevOps/CD
To Code (develop functionalities)
To Test (ensure if its working fine)
To Deploy (ensure if it can be released)
To Code (develop functionalities)
To Test (ensure if its working fine)
To Deploy (ensure if it can be released)
Automate
To Code (develop functionalities)
To Test (ensure if its working fine)
To Deploy (ensure if it can be released)
Automate
Automate
To Code
To Test
To Deploy
Automate
AutomateCI
To Code
To Test
To Deploy
Automate
AutomateCI
CD
Part 2How it is different?
Tested code
Deployed code
Automate
Tested code
Deployed code
Automate
Infrastructure
Tested code
Deployed code
Automate
Infrastructure
Operations
Tested code
Deployed code
Automate
Infrastructure
Operations
Data
Tested code
Deployed code
Automate
Infrastructure
Operations
Data
Compliance
Tested code
Deployed code
Automate
Infrastructure
Operations
Data
Compliance
End users
Tested code
Deployed code
Automate
Infrastructure
Operations
Data
Compliance
End users
Integrations
On infrastructure
To Code
To Test
To Deploy
Automate
Automate
To Code
To Test
To Deploy
Automate
AutomateBuild infrastructure
To Code
To Test
To Deploy
Automate
AutomateBuild infrastructure
Production Infrastructure
Part 3On testing
Tested code
Deployed code
Automate
Tested code
Deployed code
Automate Infrastructure as Code
Tested code
Deployed code
Automate Infrastructure as Code
Code
Tested code
Deployed code
Automate Infrastructure as Code
Code Test
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Functional Testing
Scenario: Nginx is running as a daemon When I run "ps aux | grep nginx" Then I should see “nginx:master" in the output
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Functional Testing
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Functional Testing
Integration Testing
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
Tested code
Deployed code
Automate Infrastructure as Code
Code TestUnit Testing
Functional Testing
Integration Testing
Monitoring
• Monitoring
Tested code
Deployed code
Automate Infrastructure as Code
Mon
itorin
gTests Mocks
Tested code
Deployed code
Automate Infrastructure as Code
Mon
itorin
gTests Mocks
Analytics
Part 4Cloud cometh
Cloud
I see more code
I see more code
I need more tests
Cloud
AWS
Cloud
AWSRackspace
GCEHP
Joyent
Oh yeahWe love cross browser testing?
Part 5Lessons learned
Health of infrastructure
Health of infrastructure
Battle tested code
Health of infrastructure
Battle tested code
Thorough Monitoring
• 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.
Collaborate more with Ops.
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.
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
The End @RanjibDey
http://ranjib.posterous.comhttp://www.dzone.com/users/ranjibd
dey.ranjib@gmail.com