Testing updates
Signed-off-by: Tim Smith <tsmith@chef.io>
This commit is contained in:
parent
4e8fa5b0c1
commit
648c488172
1
.gitignore
vendored
1
.gitignore
vendored
@ -41,6 +41,7 @@ Berksfile.lock
|
|||||||
vendor/
|
vendor/
|
||||||
.coverage/
|
.coverage/
|
||||||
.zero-knife.rb
|
.zero-knife.rb
|
||||||
|
Policyfile.lock.json
|
||||||
|
|
||||||
# vagrant stuff
|
# vagrant stuff
|
||||||
.vagrant/
|
.vagrant/
|
||||||
|
@ -1,51 +1,100 @@
|
|||||||
settings:
|
|
||||||
parallel: true
|
|
||||||
|
|
||||||
driver:
|
driver:
|
||||||
name: docker
|
name: dokken
|
||||||
# privileged is required otherwise the container doesn't boot right
|
chef_version: latest
|
||||||
privileged: true
|
privileged: true # because Docker and SystemD/Upstart
|
||||||
|
|
||||||
|
transport:
|
||||||
|
name: dokken
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: dokken
|
||||||
|
|
||||||
|
verifier:
|
||||||
|
root_path: '/opt/verifier'
|
||||||
|
sudo: false
|
||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
|
- name: debian-7
|
||||||
|
driver:
|
||||||
|
image: debian:7
|
||||||
|
pid_one_command: /sbin/init
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN /usr/bin/apt-get update
|
||||||
|
- RUN /usr/bin/apt-get install lsb-release procps -y
|
||||||
|
|
||||||
|
- name: debian-8
|
||||||
|
driver:
|
||||||
|
image: debian:8
|
||||||
|
pid_one_command: /bin/systemd
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN /usr/bin/apt-get update
|
||||||
|
- RUN /usr/bin/apt-get install lsb-release -y
|
||||||
|
|
||||||
- name: centos-5
|
- name: centos-5
|
||||||
driver:
|
driver:
|
||||||
image: centos:5
|
image: centos:5
|
||||||
platform: rhel
|
platform: rhel
|
||||||
run_command: /sbin/init
|
pid_one_command: /sbin/init
|
||||||
provision_command:
|
intermediate_instructions:
|
||||||
- /usr/bin/yum install -y initscripts net-tools wget
|
- RUN yum install -y which initscripts
|
||||||
|
|
||||||
- name: centos-6
|
- name: centos-6
|
||||||
driver:
|
driver:
|
||||||
image: centos:6
|
image: centos:6
|
||||||
platform: rhel
|
platform: rhel
|
||||||
run_command: /sbin/init
|
pid_one_command: /sbin/init
|
||||||
provision_command:
|
intermediate_instructions:
|
||||||
- /usr/bin/yum install -y initscripts net-tools wget
|
- RUN yum -y install which initscripts
|
||||||
|
|
||||||
- name: centos-7
|
- name: centos-7
|
||||||
driver:
|
driver:
|
||||||
image: centos:7
|
image: centos:7
|
||||||
platform: rhel
|
platform: rhel
|
||||||
run_command: /usr/lib/systemd/systemd
|
pid_one_command: /usr/lib/systemd/systemd
|
||||||
provision_command:
|
intermediate_instructions:
|
||||||
- /bin/yum install -y initscripts net-tools wget
|
- RUN yum -y install lsof which systemd-sysv initscripts
|
||||||
|
|
||||||
|
- name: fedora-latest
|
||||||
|
driver:
|
||||||
|
image: fedora:latest
|
||||||
|
pid_one_command: /usr/lib/systemd/systemd
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN dnf -y install yum which systemd-sysv initscripts
|
||||||
|
|
||||||
- name: ubuntu-12.04
|
- name: ubuntu-12.04
|
||||||
driver:
|
driver:
|
||||||
image: ubuntu-upstart:12.04
|
image: ubuntu-upstart:12.04
|
||||||
platform: ubuntu
|
pid_one_command: /sbin/init
|
||||||
disable_upstart: false
|
intermediate_instructions:
|
||||||
run_command: /sbin/init
|
- RUN /usr/bin/apt-get update
|
||||||
provision_command:
|
|
||||||
- /usr/bin/apt-get update
|
|
||||||
- /usr/bin/apt-get install apt-transport-https net-tools -y
|
|
||||||
- name: ubuntu-14.04
|
- name: ubuntu-14.04
|
||||||
driver:
|
driver:
|
||||||
image: ubuntu-upstart:14.04
|
image: ubuntu-upstart:14.04
|
||||||
platform: ubuntu
|
pid_one_command: /sbin/init
|
||||||
disable_upstart: false
|
intermediate_instructions:
|
||||||
run_command: /sbin/init
|
- RUN /usr/bin/apt-get update
|
||||||
provision_command:
|
|
||||||
- /usr/bin/apt-get update
|
- name: ubuntu-16.04
|
||||||
- /usr/bin/apt-get install apt-transport-https net-tools -y
|
driver:
|
||||||
|
image: ubuntu:16.04
|
||||||
|
pid_one_command: /bin/systemd
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN /usr/bin/apt-get update
|
||||||
|
|
||||||
|
- name: opensuse-13.2
|
||||||
|
driver:
|
||||||
|
image: opensuse:13.2
|
||||||
|
pid_one_command: /bin/systemd
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which net-tools
|
||||||
|
|
||||||
|
- name: opensuse-42.1
|
||||||
|
driver:
|
||||||
|
image: opensuse:42.1
|
||||||
|
pid_one_command: /bin/systemd
|
||||||
|
intermediate_instructions:
|
||||||
|
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive which hostname
|
||||||
|
|
||||||
suites:
|
suites:
|
||||||
- name: default
|
- name: default
|
||||||
|
18
.kitchen.yml
18
.kitchen.yml
@ -6,26 +6,20 @@ provisioner:
|
|||||||
|
|
||||||
platforms:
|
platforms:
|
||||||
- name: centos-5.11
|
- name: centos-5.11
|
||||||
- name: centos-6.7
|
- name: centos-6.8
|
||||||
- name: centos-7.2
|
- name: centos-7.2
|
||||||
- name: debian-7.10
|
- name: debian-7.11
|
||||||
run_list: apt::default
|
run_list: apt::default
|
||||||
- name: debian-8.4
|
- name: debian-8.5
|
||||||
run_list: apt::default
|
run_list: apt::default
|
||||||
- name: fedora-22
|
- name: fedora-24
|
||||||
run_list: yum::dnf_yum_compat
|
|
||||||
- name: fedora-23
|
|
||||||
run_list: yum::dnf_yum_compat
|
run_list: yum::dnf_yum_compat
|
||||||
- name: ubuntu-12.04
|
- name: ubuntu-12.04
|
||||||
run_list: apt::default
|
run_list: apt::default
|
||||||
- name: ubuntu-14.04
|
- name: ubuntu-14.04
|
||||||
run_list: apt::default
|
run_list: apt::default
|
||||||
- name: omnios-r151014
|
- name: ubuntu-16.04
|
||||||
driver:
|
run_list: apt::default
|
||||||
box: omnios-r151014
|
|
||||||
box_url: http://omnios.omniti.com/media/omnios-r151014.box
|
|
||||||
run_list:
|
|
||||||
- recipe[fake::omnios]
|
|
||||||
|
|
||||||
suites:
|
suites:
|
||||||
- name: default
|
- name: default
|
||||||
|
34
.rubocop.yml
34
.rubocop.yml
@ -1,34 +0,0 @@
|
|||||||
AllCops:
|
|
||||||
Exclude:
|
|
||||||
- vendor/**/*
|
|
||||||
- Guardfile
|
|
||||||
- test/**/*
|
|
||||||
|
|
||||||
AlignParameters:
|
|
||||||
Enabled: false
|
|
||||||
ClassLength:
|
|
||||||
Enabled: false
|
|
||||||
CyclomaticComplexity:
|
|
||||||
Enabled: false
|
|
||||||
Documentation:
|
|
||||||
Enabled: false
|
|
||||||
Encoding:
|
|
||||||
Enabled: false
|
|
||||||
Style/FileName:
|
|
||||||
Enabled: false
|
|
||||||
Style/Alias:
|
|
||||||
Enabled: false
|
|
||||||
Style/SpaceBeforeFirstArg:
|
|
||||||
Enabled: false
|
|
||||||
LineLength:
|
|
||||||
Enabled: false
|
|
||||||
MethodLength:
|
|
||||||
Enabled: false
|
|
||||||
Metrics/AbcSize:
|
|
||||||
Enabled: false
|
|
||||||
Metrics/ModuleLength:
|
|
||||||
Enabled: false
|
|
||||||
PerceivedComplexity:
|
|
||||||
Enabled: false
|
|
||||||
Style/ClassAndModuleChildren:
|
|
||||||
Enabled: false
|
|
33
.travis.yml
33
.travis.yml
@ -5,34 +5,41 @@ dist: trusty
|
|||||||
addons:
|
addons:
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- chef-current-precise
|
- chef-current-trusty
|
||||||
packages:
|
packages:
|
||||||
- chefdk
|
- chefdk
|
||||||
|
|
||||||
|
# Don't `bundle install` which takes about 1.5 mins
|
||||||
|
install: echo "skip bundle install"
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|
||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
matrix:
|
matrix:
|
||||||
- INSTANCE=default-ubuntu-1204
|
- INSTANCE=default-ubuntu-1204
|
||||||
- INSTANCE=default-ubuntu-1404
|
- INSTANCE=default-ubuntu-1404
|
||||||
|
- INSTANCE=default-ubuntu-1604
|
||||||
- INSTANCE=default-centos-5
|
- INSTANCE=default-centos-5
|
||||||
- INSTANCE=default-centos-6
|
- INSTANCE=default-centos-6
|
||||||
- INSTANCE=default-centos-7
|
- INSTANCE=default-centos-7
|
||||||
|
|
||||||
# Don't `bundle install`
|
|
||||||
install: echo "skip bundle install"
|
|
||||||
|
|
||||||
# Ensure we make ChefDK's Ruby the default
|
|
||||||
before_script:
|
before_script:
|
||||||
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142230889
|
|
||||||
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
|
||||||
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
|
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
|
||||||
- /opt/chefdk/embedded/bin/chef gem install kitchen-docker
|
|
||||||
script:
|
script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- before_script:
|
||||||
|
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
|
||||||
- /opt/chefdk/embedded/bin/chef --version
|
- /opt/chefdk/embedded/bin/chef --version
|
||||||
- /opt/chefdk/embedded/bin/rubocop --version
|
- /opt/chefdk/embedded/bin/cookstyle --version
|
||||||
- /opt/chefdk/embedded/bin/rubocop
|
|
||||||
- /opt/chefdk/embedded/bin/foodcritic --version
|
- /opt/chefdk/embedded/bin/foodcritic --version
|
||||||
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec -f any
|
- script:
|
||||||
- /opt/chefdk/embedded/bin/rspec
|
- /opt/chefdk/bin/chef exec rake
|
||||||
- KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
|
env: UNIT_AND_LINT=1
|
||||||
|
@ -5,6 +5,5 @@ metadata
|
|||||||
group :integration do
|
group :integration do
|
||||||
cookbook 'yum'
|
cookbook 'yum'
|
||||||
cookbook 'apt'
|
cookbook 'apt'
|
||||||
cookbook 'fake', path: 'test/fixtures/cookbooks/fake'
|
|
||||||
cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper'
|
cookbook 'wrapper', path: 'test/fixtures/cookbooks/wrapper'
|
||||||
end
|
end
|
||||||
|
30
Gemfile
30
Gemfile
@ -1,24 +1,12 @@
|
|||||||
|
# This gemfile provides additional gems for testing and releasing this cookbook
|
||||||
|
# It is meant to be installed on top of ChefDK which provides the majority
|
||||||
|
# of the necessary gems for testing this cookbook
|
||||||
|
#
|
||||||
|
# Run 'chef exec bundle install' to install these dependencies
|
||||||
|
|
||||||
source 'https://rubygems.org'
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
group :rake do
|
|
||||||
gem 'rake'
|
|
||||||
gem 'tomlrb'
|
gem 'tomlrb'
|
||||||
end
|
gem 'rake'
|
||||||
|
gem 'stove'
|
||||||
group :lint do
|
gem 'community_cookbook_releaser'
|
||||||
gem 'foodcritic', '~> 6.0'
|
|
||||||
gem 'rubocop', '~> 0.38'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :unit do
|
|
||||||
gem 'berkshelf', '~> 4.3'
|
|
||||||
gem 'chefspec', '~> 4.6'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :kitchen_common do
|
|
||||||
gem 'test-kitchen', '~> 1.6'
|
|
||||||
end
|
|
||||||
|
|
||||||
group :kitchen_vagrant do
|
|
||||||
gem 'kitchen-vagrant', '~> 0.19'
|
|
||||||
end
|
|
||||||
|
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Maintainers
|
# Maintainers
|
||||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
file tells you who needs to review your patch - you need a review from an existing maintainer
|
||||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
for the cookbook to provide a :+1: on your pull request. Additionally, you need
|
||||||
to not receive a veto from a Lieutenant or the Project Lead.
|
to not receive a veto from a Lieutenant or the Project Lead.
|
||||||
|
|
||||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
title = "Maintainers"
|
title = "Maintainers"
|
||||||
text = """
|
text = """
|
||||||
This file lists how this cookbook project is maintained. When making changes to the system, this
|
This file lists how this cookbook project is maintained. When making changes to the system, this
|
||||||
file tells you who needs to review your patch - you need a simple majority of maintainers
|
file tells you who needs to review your patch - you need a review from an existing maintainer
|
||||||
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
|
for the cookbook to provide a :+1: on your pull request. Additionally, you need
|
||||||
to not receive a veto from a Lieutenant or the Project Lead.
|
to not receive a veto from a Lieutenant or the Project Lead.
|
||||||
|
|
||||||
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
|
||||||
|
56
Rakefile
56
Rakefile
@ -1,43 +1,69 @@
|
|||||||
require 'rspec/core/rake_task'
|
#!/usr/bin/env rake
|
||||||
require 'rubocop/rake_task'
|
|
||||||
require 'foodcritic'
|
|
||||||
require 'kitchen'
|
|
||||||
|
|
||||||
require_relative 'tasks/maintainers'
|
require_relative 'tasks/maintainers'
|
||||||
|
|
||||||
# Style tests. Rubocop and Foodcritic
|
# Style tests. cookstyle (rubocop) and Foodcritic
|
||||||
namespace :style do
|
namespace :style do
|
||||||
|
begin
|
||||||
|
require 'cookstyle'
|
||||||
|
require 'rubocop/rake_task'
|
||||||
|
|
||||||
desc 'Run Ruby style checks'
|
desc 'Run Ruby style checks'
|
||||||
RuboCop::RakeTask.new(:ruby)
|
RuboCop::RakeTask.new(:ruby)
|
||||||
|
rescue LoadError => e
|
||||||
|
puts ">>> Gem load error: #{e}, omitting style:ruby" unless ENV['CI']
|
||||||
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
require 'foodcritic'
|
||||||
|
|
||||||
desc 'Run Chef style checks'
|
desc 'Run Chef style checks'
|
||||||
FoodCritic::Rake::LintTask.new(:chef) do |t|
|
FoodCritic::Rake::LintTask.new(:chef) do |t|
|
||||||
t.options = {
|
t.options = {
|
||||||
fail_tags: ['any']
|
fail_tags: ['any'],
|
||||||
|
progress: true
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
rescue LoadError
|
||||||
|
puts ">>> Gem load error: #{e}, omitting style:chef" unless ENV['CI']
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run all style checks'
|
desc 'Run all style checks'
|
||||||
task style: ['style:chef', 'style:ruby']
|
task style: ['style:chef', 'style:ruby']
|
||||||
|
|
||||||
# Rspec and ChefSpec
|
# ChefSpec
|
||||||
|
begin
|
||||||
|
require 'rspec/core/rake_task'
|
||||||
|
|
||||||
desc 'Run ChefSpec examples'
|
desc 'Run ChefSpec examples'
|
||||||
RSpec::Core::RakeTask.new(:spec)
|
RSpec::Core::RakeTask.new(:spec)
|
||||||
|
rescue LoadError => e
|
||||||
|
puts ">>> Gem load error: #{e}, omitting spec" unless ENV['CI']
|
||||||
|
end
|
||||||
|
|
||||||
# Integration tests. Kitchen.ci
|
# Integration tests. Kitchen.ci
|
||||||
namespace :integration do
|
namespace :integration do
|
||||||
desc 'Run Test Kitchen with Vagrant'
|
begin
|
||||||
task :vagrant do
|
require 'kitchen/rake_tasks'
|
||||||
Kitchen.logger = Kitchen.default_file_logger
|
|
||||||
Kitchen::Config.new.instances.each do |instance|
|
desc 'Run kitchen integration tests'
|
||||||
instance.test(:always)
|
Kitchen::RakeTasks.new
|
||||||
end
|
rescue StandardError => e
|
||||||
|
puts ">>> Kitchen error: #{e}, omitting #{task.name}" unless ENV['CI']
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
desc 'Run all tests on Travis'
|
namespace :supermarket do
|
||||||
task travis: ['style', 'spec', 'integration:cloud']
|
begin
|
||||||
|
require 'stove/rake_task'
|
||||||
|
|
||||||
|
desc 'Publish cookbook to Supermarket with Stove'
|
||||||
|
Stove::RakeTask.new
|
||||||
|
rescue LoadError => e
|
||||||
|
puts ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
# Default
|
# Default
|
||||||
task default: %w(style spec)
|
task default: %w(style spec)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#
|
#
|
||||||
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
|
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
|
||||||
# License:: Apache License, Version 2.0
|
# License:: Apache License, Version 2.0
|
||||||
#
|
#
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -41,7 +41,7 @@ begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
STDERR.puts "\n*** TomlRb not available.\n\n"
|
STDERR.puts "\n*** TomlRb not available. Skipping the Maintainers Rake task\n\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
3
test/fixtures/cookbooks/fake/metadata.rb
vendored
3
test/fixtures/cookbooks/fake/metadata.rb
vendored
@ -1,3 +0,0 @@
|
|||||||
name 'fake'
|
|
||||||
version '0.0.1'
|
|
||||||
description 'Not a real cookbook, used for testing only.'
|
|
@ -1,5 +0,0 @@
|
|||||||
execute 'pkg set-publisher -g http://pkg.omniti.com/omniti-ms/ ms.omniti.com' do
|
|
||||||
not_if 'pkg publisher ms.omniti.com'
|
|
||||||
end
|
|
||||||
|
|
||||||
execute 'pkg refresh --full'
|
|
Loading…
x
Reference in New Issue
Block a user