Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a test infrastructure. For #6 #7

Closed
wants to merge 30 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1656a9b
Added a gitignore for Ruby and test-kitchen
ferrarimarco Jan 27, 2017
2701a49
Configured Test-Kitchen and Kitchen-docker gems
ferrarimarco Jan 27, 2017
8e4f1dc
Updated README
ferrarimarco Jan 27, 2017
0279bf6
Updated README with information about testing
ferrarimarco Jan 27, 2017
cddd3e5
Implemented support for test-kitchen, kitchen-docker and inspec
ferrarimarco Jan 27, 2017
844b2d0
Added a missing dot
ferrarimarco Jan 27, 2017
6274419
Enabled +x mode for test scripts
ferrarimarco Jan 30, 2017
77acaaa
Implemented ansible-lint test
ferrarimarco Jan 30, 2017
7636754
Added an additional platform (Ubuntu 16.04)
ferrarimarco Jan 30, 2017
d4a3bee
Formatted code in README
ferrarimarco Jan 30, 2017
903b64e
Use codename for Ubuntu builds
ferrarimarco Jan 30, 2017
ff1e17b
Use a local connection instead of ssh
ferrarimarco Jan 31, 2017
33af8e6
Added a note about parallel test execution
ferrarimarco Feb 2, 2017
645d5b0
Added a comment about concurrency
ferrarimarco Feb 2, 2017
73de4ae
Implemented a check with yamllint
ferrarimarco Feb 8, 2017
c0acc5c
Fixed yamllint errors
ferrarimarco Feb 8, 2017
29e5fef
Merge pull request #1 from iknite/master
ferrarimarco Feb 13, 2017
22b54b2
Added a gitignore for Ruby and test-kitchen
ferrarimarco Jan 27, 2017
1aaea9d
Configured Test-Kitchen and Kitchen-docker gems
ferrarimarco Jan 27, 2017
3cb0c80
Implemented support for test-kitchen, kitchen-docker and inspec
ferrarimarco Jan 27, 2017
ca7cd06
Enabled +x mode for test scripts
ferrarimarco Jan 30, 2017
e849de6
Implemented ansible-lint test
ferrarimarco Jan 30, 2017
344efa4
Added an additional platform (Ubuntu 16.04)
ferrarimarco Jan 30, 2017
a1ae8be
Use codename for Ubuntu builds
ferrarimarco Jan 30, 2017
aea14fd
Use a local connection instead of ssh
ferrarimarco Jan 31, 2017
c093f97
Added a note about parallel test execution
ferrarimarco Feb 2, 2017
a889247
Added a comment about concurrency
ferrarimarco Feb 2, 2017
cb4027e
Implemented a check with yamllint
ferrarimarco Feb 8, 2017
b4f7b70
Fixed yamllint errors
ferrarimarco Feb 8, 2017
0fdca9b
Merge remote-tracking branch 'refs/remotes/origin/feat/test-kitchen' …
ferrarimarco Feb 14, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions {{cookiecutter.role_name}}/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
.kitchen/
.kitchen.local.yml

*.gem
*.rbc
/.config
/coverage/
/InstalledFiles
/pkg/
/spec/reports/
/spec/examples.txt
/test/tmp/
/test/version_tmp/
/tmp/

# Used by dotenv library to load environment variables.
# .env

## Specific to RubyMotion:
.dat*
.repl_history
build/
*.bridgesupport
build-iPhoneOS/
build-iPhoneSimulator/

## Specific to RubyMotion (use of CocoaPods):
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# vendor/Pods/

## Documentation cache and generated files:
/.yardoc/
/_yardoc/
/doc/
/rdoc/

## Environment normalization:
/.bundle/
/vendor/bundle
/lib/bundler/man/

# for a library or gem, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# Gemfile.lock
# .ruby-version
# .ruby-gemset

# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
.rvmrc
35 changes: 35 additions & 0 deletions {{cookiecutter.role_name}}/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
driver:
name: docker
require_chef_omnibus: false
require_ruby_for_busser: false
use_sudo: false

platforms:
- name: ubuntu-14.04
driver_config:
image: ubuntu:14.04
platform: ubuntu
- name: ubuntu-16.04
driver_config:
image: ubuntu:16.04
platform: ubuntu

provisioner:
ansible_connection: local
ansible_host_key_checking: false
ansible_version: latest
name: ansible_playbook
hosts: test-kitchen
idempotency_test: true
require_ansible_repo: true
require_chef_for_busser: false
require_ruby_for_busser: false
role_name: {{cookiecutter.role_name}}
roles_path: .

suites:
- name: default

verifier:
name: inspec
15 changes: 15 additions & 0 deletions {{cookiecutter.role_name}}/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
language: ruby
rvm:
- 2.3
sudo: required

services:
- docker

before_install: "./test/scripts/before-install.sh"
install: "./test/scripts/install.sh"
script: "./test/scripts/test-role.sh"

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
12 changes: 12 additions & 0 deletions {{cookiecutter.role_name}}/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true
source "https://rubygems.org"

if Gem::Version.new(Bundler::VERSION) < Gem::Version.new('1.13.0')
abort "Bundler version >= 1.13.0 is required"
end

gem "test-kitchen"
gem "kitchen-docker"
gem "kitchen-ansible"
gem "inspec"
gem "kitchen-inspec"
1 change: 1 addition & 0 deletions {{cookiecutter.role_name}}/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
1 change: 0 additions & 1 deletion {{cookiecutter.role_name}}/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
---

41 changes: 20 additions & 21 deletions {{cookiecutter.role_name}}/meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
---

allow_duplicates: {{ cookiecutter.allow_duplicates }}
allow_duplicates: {{cookiecutter.allow_duplicates}}


galaxy_info:
author: {{ cookiecutter.full_name }}
description: {{ cookiecutter.short_description }}
author: {{cookiecutter.full_name}}
description: {{cookiecutter.short_description}}
license: 3-clause BSD license.
min_ansible_version: {{ cookiecutter.min_ansible_version }}
min_ansible_version: {{cookiecutter.min_ansible_version}}
platforms:
- name: Ubuntu
versions:
14.04
- trusty
- xenial
categories:
#- cloud
#- cloud:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web


# - cloud
# - cloud:ec2
# - cloud:gce
# - cloud:rax
# - clustering
# - database
# - database:nosql
# - database:sql
# - development
# - monitoring
# - networking
# - packaging
# - system
# - web
1 change: 0 additions & 1 deletion {{cookiecutter.role_name}}/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
---

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- hosts: all
roles:
- role: {{cookiecutter.role_name}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
control "{{ cookiecutter.role_name }}" do
title "{{ cookiecutter.role_name }} role check"

end
11 changes: 11 additions & 0 deletions {{cookiecutter.role_name}}/test/scripts/before-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

# See https://github.com/travis-ci/travis-ci/issues/1066
# Fail if one of the commands of this script fails
set -e

gem install bundle
pip install ansible-lint
pip install yamllint

set +e
9 changes: 9 additions & 0 deletions {{cookiecutter.role_name}}/test/scripts/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# See https://github.com/travis-ci/travis-ci/issues/1066
# Fail if one of the commands of this script fails
set -e

bundle install

set +e
13 changes: 13 additions & 0 deletions {{cookiecutter.role_name}}/test/scripts/test-role.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# See https://github.com/travis-ci/travis-ci/issues/1066
# Fail if one of the commands of this script fails
set -e

ansible-lint .
yamllint .
kitchen diagnose --all
# Uncomment the --concurrency flag to run multiple tests in parallel
kitchen test #--concurrency

set +e