Chef DevOps Chef DevOps Testing & Quality Assurance 1 — Questions and Answers
Question 1: What Chef tool is used for integration testing of cookbooks in real environments?
- Test Kitchen (Correct answer)
- ChefSpec
- InSpec
- Foodcritic
Correct answer: Test Kitchen
Test Kitchen is Chef's integration testing tool that spins up temporary instances to verify cookbook behavior end-to-end.
Question 2: Which framework is used for unit testing Chef cookbooks without converging a node?
- Minitest
- ChefSpec (Correct answer)
- Test Kitchen
- InSpec
Correct answer: ChefSpec
ChefSpec is the unit testing framework for Chef that uses RSpec syntax to test cookbook logic without running Chef on a real node.
Question 3: What does InSpec provide in a Chef DevOps workflow?
- Cookbook dependency management
- Compliance-as-code testing (Correct answer)
- Node bootstrapping
- Recipe compilation
Correct answer: Compliance-as-code testing
InSpec provides compliance-as-code testing, enabling teams to write human-readable tests that verify infrastructure meets security and compliance requirements.
Question 4: What is the purpose of Foodcritic in Chef cookbook development?
- Running integration tests
- Linting Chef cookbooks for style and correctness issues (Correct answer)
- Managing cookbook versions
- Bootstrapping nodes
Correct answer: Linting Chef cookbooks for style and correctness issues
Foodcritic is a linting tool that analyzes Chef cookbooks against defined rules to catch common mistakes and style violations.
Question 5: Which Test Kitchen command runs the full test lifecycle from instance creation through destruction?
- kitchen run
- kitchen test (Correct answer)
- kitchen verify
- kitchen converge
Correct answer: kitchen test
The `kitchen test` command runs the complete lifecycle — create, converge, verify, and destroy — in a single command.
Question 6: What file at the cookbook root defines platforms, suites, and driver settings for Test Kitchen?
- .kitchen.yml (Correct answer)
- Berksfile
- metadata.rb
- Policyfile.rb
Correct answer: .kitchen.yml
The `.kitchen.yml` file is the Test Kitchen configuration file that defines platforms, test suites, and the driver to use for provisioning.
What Chef tool is used for integration testing of cookbooks in real environments?