Successfully reported this slideshow.

2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14

0

Share

Upcoming SlideShare
Modul dasa rq
Modul dasa rq
Loading in …3
×
1 of 51
1 of 51

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

2014-11-14 - Why Test Driven Development (TDD) Works for Sysadmins @ LISA14

  1. 1. Garrett Honeycutt gh@learnpuppet.com learnpuppet.com @learnpuppet Garrett Honeycutt gh@learnpuppet.com learnpuppet.com @learnpuppet
  2. 2. TDD?
  3. 3. Why Test?
  4. 4. DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS! DEVELOPERS!
  5. 5. Why Test First?
  6. 6. What to Test?
  7. 7. Tooling
  8. 8. require 'spec_helper' ! describe package('httpd') do it { should be_installed } end ! describe service('httpd') do it { should be_enabled } it { should be_running } end ! describe port(80) do it { should be_listening } end
  9. 9. $ rake spec ! Package "httpd" should be installed ! Service "httpd" should be enabled should be running ! Port "80" should be listening ! 4 examples, 0 failures
  10. 10. Monitoring
  11. 11. $ ping -c1 example.com PING example.com (93.184.216.119): 56 data bytes 64 bytes from 93.184.216.119: icmp_seq=0 ttl=58 time=4.947 ms ! --- example.com ping statistics --- 1 packets transmitted, 1 packets received, 0.0% packet loss round-trip min/avg/max/stddev = 4.947/4.947/4.947/0.000 ms
  12. 12. $ curl example.com -I HTTP/1.1 200 OK Accept-Ranges: bytes Cache-Control: max-age=604800 Content-Type: text/html Date: Thu, 13 Nov 2014 03:52:15 GMT Etag: "359670651" Expires: Thu, 20 Nov 2014 03:52:15 GMT Last-Modified: Fri, 09 Aug 2013 23:54:35 GMT Server: ECS (pae/3796) X-Cache: HIT x-ec-custom-error: 1 Content-Length: 1270
  13. 13. write tests (which fail)
  14. 14. just enough code to pass
  15. 15. refactor
  16. 16. Garrett Honeycutt gh@learnpuppet.com learnpuppet.com @learnpuppet

×