58
Automated Infrastructure Testing Ranjib Dey System Administrator, ThoughtWorks

Automated infrastructure testing - by Ranjib Dey

Embed Size (px)

DESCRIPTION

This was a full length talk presented by Ranjib Dey in vodQA-10 : Going Beyond the Usual held in ThoughtWorks, Pune on the 13th,October,2012

Citation preview

Page 1: Automated infrastructure testing - by Ranjib Dey

Automated Infrastructure Testing

Ranjib DeySystem Administrator, ThoughtWorks

Page 2: Automated infrastructure testing - by Ranjib Dey

Part 1What we are building?

Page 3: Automated infrastructure testing - by Ranjib Dey

What you already know?

Page 4: Automated infrastructure testing - by Ranjib Dey

To Code (develop functionalities)

To Test (ensure if its working fine)

Page 5: Automated infrastructure testing - by Ranjib Dey

To Code (develop functionalities)

To Test (ensure if its working fine)

Automate

Page 6: Automated infrastructure testing - by Ranjib Dey

Enter DevOps/CD

Page 7: Automated infrastructure testing - by Ranjib Dey

To Code (develop functionalities)

To Test (ensure if its working fine)

To Deploy (ensure if it can be released)

Page 8: Automated infrastructure testing - by Ranjib Dey

To Code (develop functionalities)

To Test (ensure if its working fine)

To Deploy (ensure if it can be released)

Automate

Page 9: Automated infrastructure testing - by Ranjib Dey

To Code (develop functionalities)

To Test (ensure if its working fine)

To Deploy (ensure if it can be released)

Automate

Automate

Page 10: Automated infrastructure testing - by Ranjib Dey

To Code

To Test

To Deploy

Automate

AutomateCI

Page 11: Automated infrastructure testing - by Ranjib Dey

To Code

To Test

To Deploy

Automate

AutomateCI

CD

Page 12: Automated infrastructure testing - by Ranjib Dey

Part 2How it is different?

Page 13: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Page 14: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Page 15: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Operations

Page 16: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Operations

Data

Page 17: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Operations

Data

Compliance

Page 18: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Operations

Data

Compliance

End users

Page 19: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Infrastructure

Operations

Data

Compliance

End users

Integrations

Page 20: Automated infrastructure testing - by Ranjib Dey

On infrastructure

Page 21: Automated infrastructure testing - by Ranjib Dey

To Code

To Test

To Deploy

Automate

Automate

Page 22: Automated infrastructure testing - by Ranjib Dey

To Code

To Test

To Deploy

Automate

AutomateBuild infrastructure

Page 23: Automated infrastructure testing - by Ranjib Dey

To Code

To Test

To Deploy

Automate

AutomateBuild infrastructure

Production Infrastructure

Page 24: Automated infrastructure testing - by Ranjib Dey

Part 3On testing

Page 25: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate

Page 26: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Page 27: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code

Page 28: Automated infrastructure testing - by Ranjib Dey
Page 29: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code Test

Page 30: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Page 31: Automated infrastructure testing - by Ranjib Dey
Page 32: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Page 33: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Functional Testing

Page 34: Automated infrastructure testing - by Ranjib Dey

Scenario: Nginx is running as a daemon When I run "ps aux | grep nginx" Then I should see “nginx:master" in the output

Page 35: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Functional Testing

Page 36: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Functional Testing

Integration Testing

Page 37: Automated infrastructure testing - by Ranjib Dey

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

Page 38: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Code TestUnit Testing

Functional Testing

Integration Testing

Monitoring

Page 39: Automated infrastructure testing - by Ranjib Dey

• Monitoring

Page 40: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Mon

itorin

gTests Mocks

Page 41: Automated infrastructure testing - by Ranjib Dey

Tested code

Deployed code

Automate Infrastructure as Code

Mon

itorin

gTests Mocks

Analytics

Page 42: Automated infrastructure testing - by Ranjib Dey

Part 4Cloud cometh

Page 43: Automated infrastructure testing - by Ranjib Dey

Cloud

Page 44: Automated infrastructure testing - by Ranjib Dey
Page 45: Automated infrastructure testing - by Ranjib Dey

I see more code

Page 46: Automated infrastructure testing - by Ranjib Dey

I see more code

I need more tests

Page 47: Automated infrastructure testing - by Ranjib Dey

Cloud

AWS

Page 48: Automated infrastructure testing - by Ranjib Dey

Cloud

AWSRackspace

GCEHP

Joyent

Page 49: Automated infrastructure testing - by Ranjib Dey

Oh yeahWe love cross browser testing?

Page 50: Automated infrastructure testing - by Ranjib Dey

Part 5Lessons learned

Page 51: Automated infrastructure testing - by Ranjib Dey

Health of infrastructure

Page 52: Automated infrastructure testing - by Ranjib Dey

Health of infrastructure

Battle tested code

Page 53: Automated infrastructure testing - by Ranjib Dey

Health of infrastructure

Battle tested code

Thorough Monitoring

Page 54: Automated infrastructure testing - by Ranjib Dey

• 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.

Page 55: Automated infrastructure testing - by Ranjib Dey

Collaborate more with Ops.

Page 56: Automated infrastructure testing - by Ranjib Dey

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.

Page 57: Automated infrastructure testing - by Ranjib Dey

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

Page 58: Automated infrastructure testing - by Ranjib Dey

The End @RanjibDey

http://ranjib.posterous.comhttp://www.dzone.com/users/ranjibd

[email protected]