mirror of
https://github.com/saltstack-formulas/mysql-formula.git
synced 2025-04-16 01:30:25 +00:00
Initial configuration of automated tests
This commit is contained in:
parent
5a50911bc5
commit
e29b770f20
7 changed files with 121 additions and 5 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,2 +1,4 @@
|
|||
*.pyc
|
||||
*~
|
||||
Gemfile.lock
|
||||
.kitchen/
|
||||
|
|
6
.kitchen.docker.yml
Normal file
6
.kitchen.docker.yml
Normal 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
32
.kitchen.yml
Normal 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
27
.travis.yml
Normal 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
18
Gemfile
Normal 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
31
Rakefile
Normal 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
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Reference in a new issue