Skip to content
This repository has been archived by the owner on Jun 22, 2018. It is now read-only.

mlocher/sample-chef-kitchen-docker

Repository files navigation

Chef and Test Kitchen sample repo

Test a sample chef recipe on multiple Docker container via test-kitchen and kitchen-docker.

Prerequisites

  1. Ruby

    Currently configured to use 2.4.0, though other versions might work as well. You can use rvm to install custom Ruby versions on macOS.

    gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
    \curl -sSL https://get.rvm.io | bash -s stable
    rvm use 2.4.0 --install
  2. Docker

    You need to have Docker installed on your computer. To install it on your Mac, please download Docker CE for Mac from the Docker Store

Running locally

git clone https://github.com/mlocher/sample-chef-kitchen-docker.git
bundle install
kitchen test

Running via Codeship's "jet" CLI

This repository also contains configuration files for Codeship Pro.

Those files are the codeship-services.yml, defining which services are required to run the tests on Codeship, the codeship-steps.yml defining the individual steps to run and a Dockerfile to build the main image to run those tests on.

To use the kitchen-docker driver, the main image makes use of "Docker in Docker", making the Docker daemon available inside a Docker container.

Unfortunately, because of this special setup, Test Kitchen, doesn't connect to the correct host when trying to access the containers via SSH and the tests hang with the following log output

Waiting for SSH service on localhost:32779, retrying in 3 seconds
...

The mentioned port is exposed on the main Docker host and forwards traffic to port 22 on the container.

If you want to give this a try, install the "jet" CLI on your local computer and the run the following command from the root of this repository.

jet steps

Releases

No releases published

Packages

No packages published

Languages