You are previewing Test-Driven Infrastructure with Chef, 2nd Edition.
O'Reilly logo
Test-Driven Infrastructure with Chef, 2nd Edition

Book Description

Since this book first appeared in mid-2011, infrastructure testing has begun to flourish in the web ops world. In this revised and expanded edition, author Stephen Nelson-Smith brings you up to date on this rapidly evolving discipline, including the philosophy driving it and a growing array of tools. You’ll get a hands-on introduction to the Chef framework, and a recommended toolchain and workflow for developing your own test-driven production infrastructure.

Table of Contents

  1. Preface
    1. Conventions Used in This Book
    2. Using Code Examples
    3. Safari® Books Online
    4. How to Contact Us
    5. Acknowledgments
  2. 1. The Philosophy of Test-Driven Infrastructure
    1. Underpinning Philosophy
    2. Infrastructure as Code
      1. The origins of Infrastructure as Code
      2. The principles of Infrastructure as Code
      3. The risks of Infrastructure as Code
    3. Professionalism
  3. 2. An Introduction to Chef
    1. Exercise 1: Install Chef
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
        1. The Chef framework
        2. The Chef tool
        3. The Chef API
        4. The Chef community
    2. Exercise 2: Install a user
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    3. Exercise 3: Install an IRC client
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    4. Exercise 4: Install Git
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    5. Exercise 1: Ruby
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    6. Exercise 2: Virtualbox
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    7. Exercise 3: Vagrant
      1. Objectives
      2. Directions
      3. Worked example
      4. Discussion
    8. Conclusion
  4. 3. An Introduction to Ruby
    1. What is Ruby?
    2. Grammar and Vocabulary
      1. Methods and Objects
      2. Identifiers
        1. Variables
        2. Constants
        3. Keywords
        4. Method names
      3. More about methods
      4. Classes
      5. Arrays
      6. Conditional logic
      7. Hashes
      8. Truthiness
      9. Operators
      10. Bundler
  5. 4. An Introduction to Test and Behavior Driven Development
    1. The Principles of TDD and BDD
      1. A very brief history of Agile software development
      2. Test-driven development
      3. Behavior-driven development
        1. Building the right thing
        2. Reducing risk
        3. Evolving design
    2. TDD and BDD with Ruby
      1. Minitest - unit testing for the 21st century
      2. RSpec - the transition to BDD
      3. Cucumber - acceptance testing for the masses
  6. 5. A Test-driven Infrastructure Framework
    1. Test-Driven Infrastructure: a Conceptual Framework
      1. Test-driven infrastructure should be mainstream
      2. Test-driven infrastructure should be automated
      3. Test-driven infrastructure should be side-effect aware
      4. Test-driven infrastructure should be continuously integrated
      5. Test-driven infrastructure should be outside in
      6. Test-driven infrastructure should be test-first
    2. The Pillars of Test-driven Infrastructure
      1. Writing tests
      2. Running tests
      3. Provisioning machines
      4. Feedback of results
  7. 6. Test-Driven Infrastructure: a Recommended Toolchain
    1. Tool Selection
      1. Unit Testing
      2. Integration Testing
      3. Acceptance Testing
      4. Testing workflow
    2. Supporting Tools: Berkshelf
      1. Overview
      2. Getting started
      3. Example
        1. Berkshelf and Vagrant
        2. Berkshelf and Chef environments
      4. Advantages and disadvantages
      5. Summary and conclusion
    3. Supporting Tools: Test Kitchen
      1. Overview
      2. Getting started
      3. Summary and conclusion
    4. Acceptance Testing: Cucumber and Leibniz
      1. Overview
      2. Getting started
      3. Example
      4. Advantages and disadvantages
      5. Summary and conclusion
    5. Integration Testing: Test Kitchen with Serverspec and Bats
      1. Introducing Bats
      2. Introducing Serverspec
      3. Templates
    6. Integration Testing: Minitest Handler
      1. Overview
      2. Getting started
      3. Example
        1. Minitest Handler with Test Kitchen
      4. Advantages and disadvantages
      5. Summary and conclusion
    7. Unit Testing: Chefspec
      1. Overview
      2. Getting started
      3. Example
      4. Advantages and disadvantages
      5. Summary and conclusion
    8. Static Analysis and Linting Tools
      1. Overview
      2. Getting started
      3. Example
      4. Advantages and disadvantages
      5. Summary and conclusion
    9. To Conclude
  8. 7. Epilogue
  9. 8. Bibliography
    1. Books on TDD and ATDD
    2. Books and Articles on BDD
    3. Books on Agile Testing in General
    4. Chef Articles and Presentations
    5. Books on Tools
    6. Books on Ruby
    7. Books on Bash and Shell Scripting
    8. General Programming Books
    9. Other Great Books
  10. About the Author
  11. Copyright