Kitchen::Gce - A Test Kitchen Driver for Google Compute Engine

Build Status Code Climate

This is a Test Kitchen driver for Google Compute Engine. While similar to EC2 and other IaaS providers, GCE has a couple of advantages for Chef cookbook testing:

  • (Subjectively) faster instance launch times; and
  • Sub-hour billing.


Ruby 1.9 or greater.

A Google Cloud Platform account is required. If you do not already have an appropriate "project" in which to run your test-kitchen instances, create one, noting the "project id". Then, within the Google API Console, create a "service account" for the project under the "API Access" tab. Save the key file, and note the email address associated with the service account (e.g. [email protected] - not the project owner's email address).

If you are not using the public_key_path setting (see below) and have not set up SSH keys for your GCE environment, you must also do that prior to using kitchen-gce. Also, you will likely want to add your SSH keys to ssh-agent prior to converging any instances.


Assuming you are using Bundler, ensure the Gemfile within your Chef cookbook contains at least the following:

source ''

gem 'berkshelf'

group :integration do
  gem 'kitchen-gce'

Then, execute bundle install.



(Deprecated - use equivalent "region" instead. If both "area" and "region" are set, the value of "region" will be used.)


Boolean specifying whether or not to automatically delete boot disk for test instance. Default: true


Size, in gigabytes of boot disk. Default: 10.


Required Email address associated with your GCE service account. (N.B. - this is not the same as the Google Cloud Platform user's email account; should be in the form "[email protected]".)


Required Path to GCE service account key file.


Required Project ID of the GCE project into which test-kitchen instances will be launched.


Required Operating system image to deploy.


Name to give to instance; unlike EC2's "Name" tag, this is used as an instance identifier and must be unique. If none is specified, a unique name will be auto-generated; note that auto-generated names must be used if there is more than one test suite. Default: <suite>-<platform>-<UUID>


GCE instance type (size) to launch; default: n1-standard-1


GCE network that instance will be attached to; default: default


Path to the public half of the ssh key that will be deployed to ~username/.ssh/authorized_keys; see also "username" below.


Region in which to launch instances. "Region" is defined as the part prior to the second hyphen in an availability zone's name; e.g. in "us-central1-b", the region is "us-central1". Specifying region but not "zone_name" allows kitchen-gce to avoid launching instances into a zone that is down for maintenance. If "any" is specified, kitchen-gce will select a zone from all regions. Default: us-central1 (lowest cost region); valid values: any, asia-east1, europe-west1, us-central1


Array of tags to associate with instance; default: []


Username test-kitchen will log into instance as; default: ENV['USER']


Location into which instances will be launched. If not specified, a zone is chosen from available zones within the "region" (see above).


An example .kitchen.yml file using kitchen-gce might look something like this:

driver_plugin: gce
  google_client_email: "[email protected]"
  google_key_location: "<%= ENV['HOME']%>/gce/1234567890abcdef1234567890abcdef12345678-privatekey.p12"
  google_project: "alpha-bravo-123"
  network: "kitchenci"
  region: any

- name: debian-7
    image_name: debian-7-wheezy-v20140318
    require_chef_omnibus: true
    public_key_path: '/home/alice/.ssh/'
    tags: ["somerole"]

- name: default
  run_list: ["recipe[somecookbook]"]
  attributes: {}


Source is hosted on GitHub.

  • Pull requests are welcome, using topic branches if possible:
  1. Fork the repo.
  2. Create a feature branch, commit changes to it and push them.
  3. Submit a pull request.
  • Report issues or submit feature requests on GitHub

Author, Acknowledgements, Etc.

Created and maintained by Andrew Leonard ([email protected]).

The initial release drew heavily on the kitchen-ec2 gem for both inspiration and implementation details. Any bugs, however, are solely the author's own doing.


Licensed under Apache 2.0.