Behaviour driven infrastructure

6,294 views
4,983 views

Published on

Does Behaviour Driven Development have a role in the infrastructure world? Enter Behaviour Driven Infrastructure where systems administrators can apply some simple open source tools and BDD principles to make infrastructure management more powerful, more insightful and deliver more value to their customers.

The typical enterprise monitoring and configuration management set-up for a website is:

- Is the Apache package installed and the appropriate version?
- Is the Apache service running?
- Can I connect to the HTTP port and is HTML returned?
- Multiply this by a few hundred iterations of hosts and types of services and you’re probably looking at your typical Nagios, Puppet, Cfengine, Hyperic set-up.

All this monitoring misses something critical though – we’re not actually monitoring that the service does what it should. Yes, it matters whether Apache is installed, the Apache service is running, and you can connect to HTTP but does this actually prove anything about the availability of the service we’re managing and providing for our customers? Nope…

We need to demonstrate more than just a check that says the Apache server is up. We need to demonstrate that the service delivered by that infrastructure was available to our customers AND functioning as intended.

Enter Behaviour Driven Infrastructure or BDI which applies the principles of Behavioural Driven Development to the management of infrastructure. In this presentation you’ll learn:

- How Behaviour Driven Development works
- What makes a behavioural test
- How to install and use Cucumber to perform BDI
- Practical examples of behavioural tests in Cucumber, and
- How to integrate BDI into your work flow and your enterprise monitoring and configuration management frameworks.

Published in: Technology, Business
1 Comment
5 Likes
Statistics
Notes
  • <br /><object type="application/x-shockwave-flash" data="http://blip.tv/play/AYKh%2BFUC" width="350" height="288"><param name="movie" value="http://blip.tv/play/AYKh%2BFUC"></param><embed src="http://blip.tv/play/AYKh%2BFUC" width="350" height="288" type="application/x-shockwave-flash"></embed></object>
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total views
6,294
On SlideShare
0
From Embeds
0
Number of Embeds
86
Actions
Shares
0
Downloads
173
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Behaviour driven infrastructure

  1. Behaviour DrivenInfrastructure Lindsay Holmwood
  2. DevOps
  3. Behaviour DrivenDevelopment
  4. Behaviour DrivenInfrastructure?
  5. What is abehavioural test?
  6. origins
  7. Test Driven Development
  8. write test
  9. write test run test
  10. write test run test test fails
  11. write test run test test fails make test pass
  12. write test run testrefactor test fails make test pass
  13. unit tests
  14. input/output of functions
  15. result = bar(foo)assert(result, true)
  16. xUnit
  17. Behavior Driven Developmenta reaction to test focus
  18. testing theflow of data in a system
  19. test auser canperform atask
  20. make a donationsearch for productcheckout cart
  21. verifying a business’s functionalrequirements are met
  22. underlyingimplementation is irrelevant to the business
  23. Business: “assert(bar(foo),true)?”Tech: “Yes”Business: “Great”
  24. Business: “assert(bar(foo),true)?”Tech: “Yes”Business: “Great”
  25. Business: “Can I search for things?”Tech: “Yes”Business: “Great”
  26. functionis important
  27. implementation is not
  28. verifying a business’s functionalrequirements are met
  29. integration testsacceptance tests
  30. “outside-in tests”
  31. executable specification
  32. written inspoken language
  33. so the businessunderstands what it is paying for
  34. Enough businesstouchy-feely mumbo jumbo!
  35. I thought this was a Behaviour DrivenInfrastructure talk?
  36. I thought this was a Behaviour DrivenInfrastructure talk?
  37. Infrastructure as code
  38. “The ‘Infrastructure’ is anapplication, a long runningprocess with inputs, outputsand state.” - Andrew Schafer, 2009 http://bit.ly/he3HBt
  39. an abstraction
  40. infrastructure is the application
  41. daemons are thelibraries
  42. configuration management is the programming language
  43. infrastructure isbuilt with code
  44. code without tests is bad
  45. code without tests evil is
  46. Why?
  47. You can’t verify thatyour system works.
  48. Behaviour DrivenInfrastructure
  49. Taking BDDprincipals & tools
  50. Adapting them toinfrastructure development
  51. Show me the tools!
  52. Cucumber
  53. Executable format forsoftware specifications
  54. Tool to execute that specification
  55. Terminology
  56. feature is amodule of common functionality
  57. Feature: Google search To increase her knowledge A user Needs a search interface To discover information
  58. feature has manyscenarios
  59. Feature: Google search To increase her knowledge A user Needs a search interface To discover information Scenario: Home page When I visit "http://google.com.au/" And I fill in "q" with "great balls of fire" Then I should see "great balls of fire"
  60. scenariohas many steps
  61. Given
  62. When
  63. Then
  64. And*
  65. steps are likeunit tests
  66. they map toblocks of code
  67. Feature: Google search To increase her knowledge A user Needs a search interface To discover information Scenario: Home page When I visit "http://google.com.au/" And I fill in "q" with "great balls of fire" Then I should see "great balls of fire"
  68. When /^I visit "([^"]*)"$/ do |location| # codeendWhen /^I fill in "([^"]*)" with "([^"]*)"$/ do |input, value| # codeendThen /^I should see "([^"]*)"$/ do |string| # codeend
  69. When /^I visit "([^"]*)"$/ do |location| visit(location)endWhen /^I fill in "([^"]*)" with "([^"]*)"$/ do |input, value| fill_in(input, :with => value)endThen /^I should see "([^"]*)"$/ do |string| response.body.should match(string)end
  70. blocks of code are like unit tests
  71. ∴ scenario is aserial execution of unit tests
  72. Installing
  73. $ apt-get install rubygems$ gem install cucumber
  74. Using
  75. $ apt-get install rubygems$ gem install cucumber
  76. $ apt-get install rubygems$ gem install cucumber$ mkdir -p project/features/steps$ cd project
  77. Testing Workflow
  78. write test
  79. write test run test
  80. write test run test test fails
  81. write test run test test fails make test pass
  82. write test run testrefactor test fails make test pass
  83. $ apt-get install rubygems$ gem install cucumber$ mkdir -p project/features/steps$ cd project$ vim features/site.feature
  84. Feature: Google search To increase her knowledge A user Needs a search interface To discover information Scenario: Home page When I visit "http://google.com.au/" And I fill in "q" with "great balls of fire" Then I should see "great balls of fire"
  85. $ apt-get install rubygems$ gem install cucumber$ mkdir -p project/features/steps$ cd project$ vim features/site.feature$ cucumber features/site.feature$ vim features/steps/site_steps.rb
  86. $ apt-get install rubygems$ gem install cucumber$ mkdir -p project/features/steps$ cd project$ vim features/site.feature$ cucumber features/site.feature$ vim features/steps/site_steps.rb$ cucumber features/site.feature
  87. Implications
  88. ContinuousIntegration
  89. Test server builds
  90. Execute tests on committo config management
  91. What environments are the tests run against?
  92. UAT? Staging?Production?
  93. Destructive tests?
  94. Fixtures
  95. Setup / Teardown Pattern
  96. A/B testing
  97. Migration toconfig management
  98. Continuous Integration & Monitoring Systems
  99. build deploynotify test
  100. build deploynotify test
  101. notify test
  102. We’ve been asking the wrong questions
  103. pingconnect
  104. is the host up?is the service available?
  105. n etwork s tack up other w is e broken but is the host up?is the service available?misconfiguration, bugs trig gere d by user data, hacke d
  106. Why should I care?
  107. “Nagios checksalready do this!”
  108. Cucumber provides a frameworkto phrase questions
  109. Given
  110. When
  111. Then
  112. Lowers the barrier of entry towriting good checks
  113. Caveat:You need a firmgrasp of language
  114. Feature: Candy Store Wooooooooo! Scenario: Lollipops When I fly to the moon Then I should see monkeys
  115. Feature: Candy Store Wooooooooo! Scenario: Lollipops When I fly to the moon Then I should see monkeys o mpletely vali d, c co mpletely useless
  116. Cucumber provides a common specification formatdev & ops can share
  117. Cucumber provides a common specification formatIT & business can share
  118. Duplication of tests
  119. Development
  120. Production
  121. Cucumber featuresare librarised tests
  122. Same specification
  123. Different implementation
  124. Where tofrom here?
  125. Write more code.
  126. Patterns.
  127. Expand the library of tests.
  128. Explain to your friends,colleagues, family, pets these ideas.
  129. Discuss! Thank you.
  130. Creditshttp://www.flickr.com/photos/51746218@N03/5077975818/http://www.flickr.com/photos/abrinsky/4981594203/http://www.flickr.com/photos/andresrueda/3020304543/http://www.flickr.com/photos/communityfriend/2342578485/http://www.flickr.com/photos/damienroue/2775342201/http://www.flickr.com/photos/elsie/3917813380/http://www.flickr.com/photos/hugo90/5343453489/http://www.flickr.com/photos/iamphejom/4930805430/http://www.flickr.com/photos/jiuck/5060618037/http://www.flickr.com/photos/kusamakura/2435343128/http://www.flickr.com/photos/laurelfan/100700370/http://www.flickr.com/photos/littledebbie11/3208631777/http://www.flickr.com/photos/master-blitzy/1192778834/http://www.flickr.com/photos/nasacommons/4858567480/http://www.flickr.com/photos/nhankamer/4703022414/http://www.flickr.com/photos/normanlowery/4674154988/http://www.flickr.com/photos/paul_lowry/2266388742/http://www.flickr.com/photos/pinprick/467320431/http://www.flickr.com/photos/superciliousness/91346618/http://www.flickr.com/photos/xaviergp/4003730145/

×