Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
adding serverspec/travis tests
  • Loading branch information
extremelylongusername committed Jan 20, 2016
1 parent ff095a5 commit 1f12888
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 41 deletions.
21 changes: 21 additions & 0 deletions .kitchen.yml
@@ -0,0 +1,21 @@
---
driver:
# using docker to test
name: docker
privileged: true

provisioner:
# use an ansible playbook to provision our server
name: ansible_playbook
# name of the host
hosts: test-kitchen
# list ansible galaxy requirements from meta/main.yml
requirements_path: requirements.yml


platforms:
- name: ubuntu-14.04

suites:
# suites found at /test/integration/$test-name
- name: default
41 changes: 9 additions & 32 deletions .travis.yml
@@ -1,38 +1,15 @@
---
language: python
python: "2.7"

env:
- SITE=test-install.yml

before_install:
- sudo apt-get update -qq
- sudo apt-get install -y curl
sudo: required
# docker is required to run tests
services: docker

install:
# Install Ansible.
- pip install ansible

# Add ansible.cfg to pick up roles path.
- "{ echo '[defaults]'; echo 'roles_path = ../'; } >> ansible.cfg"

# Install dependencies
- ansible-galaxy install telusdigital.apt-repository
- bundle install

script:
# Check the role/playbook's syntax.
- "ansible-playbook -i tests/inventory tests/$SITE --syntax-check"

# Run the role/playbook with ansible-playbook.
- "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo"

# Run the role/playbook again, checking to make sure it's idempotent.
- >
fish -v
|& grep -q 'fish, version'
&& (echo 'Fish installed')
|| (echo 'Fish not installed')
# Just for good measure
- fish -v
# run kitchen tests (destroy, create, converge, setup, verify and destroy)
- bundle exec kitchen test

notifications:
slack:
secure: K+Qf40Tui8xo71/0m6v6B+LYl8eTfiBYUu5u8+amGNIERtfbhtvzuYhIYBZGaa1cWJeQc8woAbdDvh4vh/Lj22TR3PsNG3UGgb75lSrYpJ9XJOiuBeyP35nXF1lhCOzFVhwziMdQWy1nfvl16dTIb73G/tFCZMotu9Jl2bZDl2G88bkFZlLtuX3rEXbmyqNIYiy3Z3f+3N5hujenBOABGblnui63vjROy4slM991UbdX++c/ogg+czzopl7C3zAqCPj4fqp7Wu5S0jwn15IFy1dgnJzVqlmvrpwxkzl7K3K9lvRnG/dk0louNlaUiIinzZ3npUqOPkY66e7SoiFhgjeXRHK/33it0UriifPcw1+f9ZvbzyULlYmvvIRAOyQyKikLC/SP4Q4X/Y55KdKmE8wB54q8bRKwSjlTtkDCLBmYiAApV58uyL1hyqHee7wQkYzLHZ1IkE35/mrBxDCoy8QrmCQBmdJv2H+dQVc8VhTWVSOMo+FLHr0d7jp/Kmngvo/OJYbAwPPQbl7vjOSHlLkbf9tqFRGsMzZsiqeTrRxWe4FVB599gA7h7KJ3CAzSsgtpugd+m9mk6/GBoYooouBDkxx4qD6LSMLjhYerYYCgHQCX5s1p9+A1cXtZ3T6DSUncQ7Hx0Q+beLWS8MOmFdqBNVt5K2CND5fdwiOBLqo=
6 changes: 6 additions & 0 deletions Gemfile
@@ -0,0 +1,6 @@
source 'https://rubygems.org'

gem 'test-kitchen'
gem 'serverspec'
gem 'kitchen-ansible'
gem 'kitchen-docker'
2 changes: 2 additions & 0 deletions requirements.yml
@@ -0,0 +1,2 @@
---
- src: telusdigital.apt-repository
8 changes: 8 additions & 0 deletions test/integration/default/default.yml
@@ -0,0 +1,8 @@
---
# host to test against
- hosts: test-kitchen
remote_user: root

roles:
# name of role to test
- role: ansible-fish
9 changes: 9 additions & 0 deletions test/integration/default/serverspec/localhost/default_spec.rb
@@ -0,0 +1,9 @@
require 'spec_helper'

describe 'ansible-fish::default' do

describe package('fish') do
it { should be_installed.by('apt') }
end

end
5 changes: 5 additions & 0 deletions test/integration/default/serverspec/spec_helper.rb
@@ -0,0 +1,5 @@
require 'serverspec'

# :backend can be either :exec or :ssh
# since we are running local we use :exec
set :backend, :exec
1 change: 0 additions & 1 deletion tests/inventory

This file was deleted.

8 changes: 0 additions & 8 deletions tests/test-install.yml

This file was deleted.

0 comments on commit 1f12888

Please sign in to comment.