Commit 750c0b9c authored by Tim Smith's avatar Tim Smith
Browse files

Testing updates


Signed-off-by: default avatarTim Smith <tsmith@chef.io>
parent 81943841
......@@ -34,15 +34,16 @@ _yardoc
doc/
.idea
#chef stuff
# chef stuff
Berksfile.lock
.kitchen
.kitchen.local.yml
vendor/
.coverage/
.zero-knife.rb
Policyfile.lock.json
#vagrant stuff
# vagrant stuff
.vagrant/
.vagrant.d/
.kitchen/
......@@ -11,7 +11,6 @@ provisioner:
verifier:
name: inspec
format: doc
platforms:
- name: debian-7
......@@ -99,3 +98,46 @@ platforms:
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive
suites:
- name: default
run_list:
- recipe[rsyslog::default]
- name: relp
run_list:
- recipe[rsyslog::client]
attributes:
rsyslog:
use_relp: true
custom_remote:
- server: 10.0.0.45
logs: auth.*,mail.*
port: 555
protocol: udp
- server: 10.1.1.33
logs: authpriv.*,cron.*,daemon.*
port: 654
protocol: tcp
remote_template: RSYSLOG_SyslogProtocol23Format
- name: client
run_list:
- recipe[rsyslog_test::client]
attributes:
rsyslog:
server_ip: 10.0.0.50
custom_remote:
- server: 10.0.0.45
logs: auth.*,mail.*
port: 555
protocol: udp
- server: 10.1.1.33
logs: authpriv.*,cron.*,daemon.*
port: 654
protocol: tcp
remote_template: RSYSLOG_SyslogProtocol23Format
- name: server
run_list:
- recipe[rsyslog_test::server]
- name: input_file_provider
run_list:
- recipe[rsyslog_test::input_file_provider]
......@@ -6,13 +6,13 @@ provisioner:
platforms:
- name: centos-5.11
- name: centos-6.7
- name: centos-6.8
- name: centos-7.2
- name: debian-7.10
- name: debian-7.11
run_list: apt::default
- name: debian-8.4
- name: debian-8.5
run_list: apt::default
- name: fedora-23
- name: fedora-24
run_list: yum::dnf_yum_compat
- name: opensuse-13.2
- name: ubuntu-12.04
......
......@@ -14,7 +14,7 @@ install: echo "skip bundle install"
branches:
only:
- master
- master
services: docker
......@@ -61,17 +61,19 @@ env:
- INSTANCE=server-opensuse-132
- INSTANCE=server-opensuse-421
fast_finish: true
before_script:
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/cookstyle
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec -f any -P
#- /opt/chefdk/embedded/bin/rspec
- KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
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/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version
- script:
- /opt/chefdk/bin/chef exec rake
env: UNIT_AND_LINT=1
# 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'
gem 'berkshelf', '>= 4.3'
gem 'chefspec', '~> 4.6'
gem 'cookstyle'
gem 'foodcritic', '~> 7.0'
gem 'kitchen-dokken'
gem 'kitchen-inspec', '>= 0.14'
gem 'kitchen-vagrant', '>= 0.20'
gem 'tomlrb'
gem 'rake'
gem 'stove'
gem 'test-kitchen', '>= 1.10'
gem 'tomlrb'
gem 'community_cookbook_releaser'
......@@ -2,8 +2,8 @@
# Maintainers
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
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
file tells you who needs to review your patch - you need a review from an existing maintainer
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.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
......
......@@ -6,8 +6,8 @@
title = "Maintainers"
text = """
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
for the relevant subsystems to provide a :+1: on your pull request. Additionally, you need
file tells you who needs to review your patch - you need a review from an existing maintainer
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.
Check out [How Cookbooks are Maintained](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD)
......
require 'rspec/core/rake_task'
require 'cookstyle'
require 'rubocop/rake_task'
require 'foodcritic'
require 'kitchen'
#!/usr/bin/env rake
require_relative 'tasks/maintainers'
# Style tests. cookstyle (rubocop) and Foodcritic
namespace :style do
desc 'Run Ruby style checks'
RuboCop::RakeTask.new(:ruby)
desc 'Run Chef style checks'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any']
}
begin
require 'cookstyle'
require 'rubocop/rake_task'
desc 'Run Ruby style checks'
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'
FoodCritic::Rake::LintTask.new(:chef) do |t|
t.options = {
fail_tags: ['any'],
progress: true
}
end
rescue LoadError
puts ">>> Gem load error: #{e}, omitting style:chef" unless ENV['CI']
end
end
desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']
# Rspec and ChefSpec
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
# ChefSpec
begin
require 'rspec/core/rake_task'
desc 'Run ChefSpec examples'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting spec" unless ENV['CI']
end
# Integration tests. Kitchen.ci
namespace :integration do
desc 'Run Test Kitchen with Vagrant'
task :vagrant do
Kitchen.logger = Kitchen.default_file_logger
Kitchen::Config.new.instances.each do |instance|
instance.test(:always)
end
begin
require 'kitchen/rake_tasks'
desc 'Run kitchen integration tests'
Kitchen::RakeTasks.new
rescue StandardError => e
puts ">>> Kitchen error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end
namespace :supermarket do
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
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'rsyslog::client' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['custom_remote'] = custom_remote
end.converge(described_recipe)
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'rsyslog::default' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04').converge(described_recipe)
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04').converge(described_recipe)
end
let(:service_resource) { 'service[rsyslog]' }
......@@ -13,7 +13,7 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['relp'] is true" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['use_relp'] = true
end.converge(described_recipe)
end
......@@ -26,7 +26,7 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['enable_tls'] is true" do
context "when node['rsyslog']['tls_ca_file'] is not set" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['enable_tls'] = true
end.converge(described_recipe)
end
......@@ -38,7 +38,7 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['tls_ca_file'] is set" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
end.converge(described_recipe)
......@@ -55,7 +55,7 @@ describe 'rsyslog::default' do
end
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
node.normal['rsyslog']['protocol'] = 'udp'
......
......@@ -2,7 +2,7 @@ require 'spec_helper'
describe 'rsyslog::server' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '16.04') do |node|
node.normal['rsyslog']['server'] = false
end.converge(described_recipe)
end
......
# require 'chef/application'
require 'chefspec'
require 'chefspec/berkshelf'
at_exit { ChefSpec::Coverage.report! }
RSpec.configure do |config|
config.color = true # Use color in STDOUT
config.formatter = :documentation # Use the specified formatter
config.log_level = :error # Avoid deprecation notice SPAM
end
#
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -41,7 +41,7 @@ begin
end
rescue LoadError
STDERR.puts "\n*** TomlRb not available.\n\n"
STDERR.puts "\n*** TomlRb not available. Skipping the Maintainers Rake task\n\n"
end
private
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment