Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

20150314 - Functional Testing for Configuration Management @ Cascadia IT Conference

737 views

Published on

Functional Testing for Configuration Management at Cascadia IT Conference 20150314

Published in: Technology
  • Be the first to comment

  • Be the first to like this

20150314 - Functional Testing for Configuration Management @ Cascadia IT Conference

  1. 1. Garrett Honeycutt gh@learnpuppet.com learnpuppet.com @learnpuppet Functional testing for configuration management
  2. 2. spec vs functional
  3. 3. http://www.structuretech1.com/wp-content/uploads/2012/11/Gate-valve-exploded1.jpg
  4. 4. what is functional testing?
  5. 5. Functional test for ntp module 1. set time incorrectly 2. apply ntp class 3. check that time is correct
  6. 6. #/bin/sh # puppet agent -t while [ $? -ne 0 ] do puppet agent -t done
  7. 7. Functional test for idempotency 1. start with a blank system 2. apply class 3. changes should occur 4. apply class again 5. no changes occur
  8. 8. why write tests at all?
  9. 9. tooling
  10. 10. https://github.com/unixmonkey/learngit
  11. 11. http://serverspec.org/
  12. 12. how to approach
  13. 13. functionally test each module
  14. 14. functionally test each role
  15. 15. role: repo * main entry point is the class yum::server
  16. 16. role: repo * main entry point is the class yum::server * simple apache web server with a DocumentRoot set to serve packages
  17. 17. role: repo * main entry point is the class yum::server * simple apache web server with a DocumentRoot set to serve packages * manages only a couple files and packages
  18. 18. apache hosts rsyslog apache::mod::cache inittab selinux apache::mod::cgi motd ssh apache::mod::dav network sysklogd apache::mod::dav_fs nsswitch timezone apache::mod::default ntp types apache::mod::proxy pam utils apache::mod::ssl pam::accesslogin vim apache::params pam::limits wget common papertrail yum dnsclient puppet::agent yum::server facter redhat yum::updatesd
  19. 19. apache hosts rsyslog apache::mod::cache inittab selinux apache::mod::cgi motd ssh apache::mod::dav network sysklogd apache::mod::dav_fs nsswitch timezone apache::mod::default ntp types apache::mod::proxy pam utils apache::mod::ssl pam::accesslogin vim apache::params pam::limits wget common papertrail yum dnsclient puppet::agent yum::server facter redhat yum::updatesd 36 classes in 23 modules
  20. 20. Monitoring
  21. 21. $ 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
  22. 22. $ 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
  23. 23. 1. set the role 2. converge on model 3. seed a package on the system 4. on another system, set it to use the first as a repo 5. install the seeded package from the repo
  24. 24. who does what?
  25. 25. how to automate
  26. 26. &&
  27. 27. Garrett Honeycutt gh@learnpuppet.com learnpuppet.com @learnpuppet

×