Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

alex-d-bondarev/learn-chef

Repository files navigation

learn-chef

Note

Archived since I have learned what I planned to and no longer plan to commit new changes

You can copy and reuse code MIT License

Added for QAOps presentation

Preconditions

  1. Install chefDK from this link (these examples were implemented for chef 3.0.36 version)
  2. Install Vagrant from this link
  3. Install Virtualbox from this link

Steps that were run in order to get the mydatabase

  1. chef generate cookbook mydatabase.
  2. [Alternative for tests #1] create mydatabase folder and run kitchen init there.
  3. [Alternative for tests #2] create mydatabase folder and run chef exec rspec init there.

Unit tests

Unit tests run in memory without deploying recipe to VM

Run tests

  1. chef exec rspec - quick run
  2. chef exec rspec --format documentation - with details

Integration tests

Integration tests run against VM with deployed recipe.

Verify kitchen (set up/verified/etc.)

  1. cd mydatabase/
  2. kitchen list Expected: No errors

Run tests

  1. [Optional] kitchen converge - redeploy cookbook after recipe changes to run kitchen correctly
  2. [Optional] kitchen login - verify setup manually
  3. kitchen verify - create VM, deploy cookbook and run inspec tests

Investigate inspec resources

  1. inspec shell
  2. help <resource_name> (For example: help postgres_session)