Initial configuration of automated tests

This commit is contained in:
Andres Montalban 2016-10-28 19:59:34 -03:00
parent 5a50911bc5
commit e29b770f20
7 changed files with 121 additions and 5 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
*.pyc
*~
Gemfile.lock
.kitchen/

6
.kitchen.docker.yml Normal file
View file

@ -0,0 +1,6 @@
---
driver:
name: docker
hostname: salt-formula.ci.local
use_sudo: true
require_chef_omnibus: false

32
.kitchen.yml Normal file
View file

@ -0,0 +1,32 @@
<%
require 'yaml'
formula = YAML.load_file('FORMULA')
formula_name = formula['name']
%>
---
verifier:
name: inspec
platforms:
- name: ubuntu-12.04
- name: ubuntu-14.04
- name: ubuntu-16.04
- name: debian-7
- name: debian-8
provisioner:
name: salt_solo
salt_install: bootstrap
salt_bootstrap_url: https://bootstrap.saltstack.com
salt_version: latest
salt_pillar_root: pillar.example
log_level: <%= ENV['SALT_DEBUG_LEVEL'] || 'info' %>
formula: <%= formula_name %>
state_top:
base:
'*':
- <%= formula_name %>
suites:
- name: default

27
.travis.yml Normal file
View file

@ -0,0 +1,27 @@
language: ruby
rvm:
- 2.2.5
sudo: required
services: docker
env:
matrix:
- INSTANCE=default-ubuntu-1204
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1604
- INSTANCE=default-debian-7
- INSTANCE=default-debian-8
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142455888
before_script: sudo iptables -L DOCKER || sudo iptables -N DOCKER
install:
# setup ci for test formula
- export BUNDLE_GEMFILE=$PWD/Gemfile
- bundle install
script:
# Run unit tests
- KITCHEN_LOCAL_YAML=.kitchen.docker.yml bundle exec kitchen verify ${INSTANCE}

18
Gemfile Normal file
View file

@ -0,0 +1,18 @@
source 'https://rubygems.org'
gem 'codeclimate-test-reporter', group: :test, require: nil
gem 'rake'
gem 'berkshelf', '~> 4.0'
group :integration do
gem 'test-kitchen'
gem 'kitchen-salt'
gem 'kitchen-inspec'
end
group :docker do
gem 'kitchen-docker'
end
# vi: set ft=ruby :
gem "kitchen-vagrant"

31
Rakefile Normal file
View file

@ -0,0 +1,31 @@
require 'rake'
require 'rake/testtask'
require 'bundler/setup'
Rake::TestTask.new do |t|
t.libs << 'lib'
t.pattern = 'test/**/*_test.rb'
t.verbose = false
end
desc 'Run Test Kitchen integration tests'
namespace :integration do
desc 'Run integration tests with kitchen-docker'
task :docker do
require 'kitchen'
Kitchen.logger = Kitchen.default_file_logger
@loader = Kitchen::Loader::YAML.new(local_config: '.kitchen.docker.yml')
Kitchen::Config.new(loader: @loader).instances.each do |instance|
instance.test(:always)
end
end
end
task default: :test
begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts '>>>>> Kitchen gem not loaded, omitting tasks' unless ENV['CI']
end

View file

@ -117,11 +117,11 @@ mysql:
grants: ['select', 'insert', 'update']
# Override any names defined in map.jinja
lookup:
server: mysql-server
client: mysql-client
service: mysql-service
python: python-mysqldb
# lookup:
# server: mysql-server
# client: mysql-client
# service: mysql-service
# python: python-mysqldb
# Install MySQL headers
dev: