Slide 1

Slide 1 text

Automated Infrastructure Testing Ranjib Dey System Administrator, ThoughtWorks

Slide 2

Slide 2 text

Part 1 What we are building?

Slide 3

Slide 3 text

What you already know?

Slide 4

Slide 4 text

To Code (develop functionalities) To Test (ensure if its working fine)

Slide 5

Slide 5 text

To Code (develop functionalities) To Test (ensure if its working fine) Automate

Slide 6

Slide 6 text

Enter DevOps/CD

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

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

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

To Code To Test To Deploy Automate Automate CI

Slide 11

Slide 11 text

To Code To Test To Deploy Automate Automate CI CD

Slide 12

Slide 12 text

Part 2 How it is different?

Slide 13

Slide 13 text

Tested code Deployed code Automate

Slide 14

Slide 14 text

Tested code Deployed code Automate Infrastructure

Slide 15

Slide 15 text

Tested code Deployed code Automate Infrastructure Operations

Slide 16

Slide 16 text

Tested code Deployed code Automate Infrastructure Operations Data

Slide 17

Slide 17 text

Tested code Deployed code Automate Infrastructure Operations Data Compliance

Slide 18

Slide 18 text

Tested code Deployed code Automate Infrastructure Operations Data Compliance End users

Slide 19

Slide 19 text

Tested code Deployed code Automate Infrastructure Operations Data Compliance End users Integrations

Slide 20

Slide 20 text

On infrastructure

Slide 21

Slide 21 text

To Code To Test To Deploy Automate Automate

Slide 22

Slide 22 text

To Code To Test To Deploy Automate Automate Build infrastructure

Slide 23

Slide 23 text

To Code To Test To Deploy Automate Automate Build infrastructure Production Infrastructure

Slide 24

Slide 24 text

Part 3 On testing

Slide 25

Slide 25 text

Tested code Deployed code Automate

Slide 26

Slide 26 text

Tested code Deployed code Automate Infrastructure as Code

Slide 27

Slide 27 text

Tested code Deployed code Automate Infrastructure as Code Code

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Tested code Deployed code Automate Infrastructure as Code Code Test

Slide 30

Slide 30 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing

Slide 33

Slide 33 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing Functional Testing

Slide 34

Slide 34 text

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

Slide 35

Slide 35 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing Functional Testing

Slide 36

Slide 36 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing Functional Testing Integration Testing

Slide 37

Slide 37 text

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

Slide 38

Slide 38 text

Tested code Deployed code Automate Infrastructure as Code Code Test Unit Testing Functional Testing Integration Testing Monitoring

Slide 39

Slide 39 text

• Monitoring

Slide 40

Slide 40 text

Tested code Deployed code Automate Infrastructure as Code Monitoring Tests Mocks

Slide 41

Slide 41 text

Tested code Deployed code Automate Infrastructure as Code Monitoring Tests Mocks Analytics

Slide 42

Slide 42 text

Part 4 Cloud cometh

Slide 43

Slide 43 text

Cloud

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

I see more code

Slide 46

Slide 46 text

I see more code I need more tests

Slide 47

Slide 47 text

Cloud AWS

Slide 48

Slide 48 text

Cloud AWS Rackspace GCE HP Joyent

Slide 49

Slide 49 text

Oh yeah We love cross browser testing?

Slide 50

Slide 50 text

Part 5 Lessons learned

Slide 51

Slide 51 text

Health of infrastructure

Slide 52

Slide 52 text

Health of infrastructure Battle tested code

Slide 53

Slide 53 text

Health of infrastructure Battle tested code Thorough Monitoring

Slide 54

Slide 54 text

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

Slide 55

Slide 55 text

Collaborate more with Ops.

Slide 56

Slide 56 text

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.

Slide 57

Slide 57 text

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

Slide 58

Slide 58 text

@RanjibDey http://ranjib.posterous.com http://www.dzone.com/users/ranjibd [email protected]