This repository has been archived by the owner on May 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 58
Integration Test trial #53
Open
chrisduong
wants to merge
19
commits into
sunggun-yu:master
Choose a base branch
from
chrisduong:test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
787d776
added basic kitchen.docker.yml
7076f51
override platforms supported by kitchen-dokken
7cdcb84
added suite for dokken
e77794e
use ChefDK for running test
3d7ab91
remove gemfile statement
0ae3010
specify service Docker
ac781d2
fix wrong Docker driver parameters
dd56d9e
env matrix
0e7cd66
before_script for Docker instances
68a47ee
script to run the Integration test
697b2c8
include before_script for unit test
f2f1179
Rake tasks for unit tests
eef7467
execute Rake tasks
db523fb
foodcritic
bbc505f
added maintainers task
83c074d
added MAINTAINERS.toml
c2902d5
generate MAINTAINERS.md
c9091c6
update Issues and Sources
1fa98be
separate build for Unit and Linter
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
~FC057 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
--- | ||
driver: | ||
name: dokken | ||
chef_version: latest | ||
privileged: true # because Docker and SystemD/Upstart | ||
|
||
transport: | ||
name: dokken | ||
|
||
provisioner: | ||
name: dokken | ||
|
||
verifier: | ||
name: inspec | ||
|
||
platforms: | ||
- name: centos-6 | ||
driver: | ||
image: centos:6 | ||
platform: rhel | ||
pid_one_command: /sbin/init | ||
intermediate_instructions: | ||
- RUN yum -y install which initscripts | ||
|
||
- name: centos-7 | ||
driver: | ||
image: centos:7 | ||
platform: rhel | ||
pid_one_command: /usr/lib/systemd/systemd | ||
intermediate_instructions: | ||
- RUN yum -y install lsof which systemd-sysv initscripts | ||
|
||
- name: ubuntu-14.04 | ||
driver: | ||
image: ubuntu-upstart:14.04 | ||
pid_one_command: /sbin/init | ||
intermediate_instructions: | ||
- RUN /usr/bin/apt-get update | ||
|
||
- name: ubuntu-16.04 | ||
driver: | ||
image: ubuntu:16.04 | ||
pid_one_command: /bin/systemd | ||
intermediate_instructions: | ||
- RUN /usr/bin/apt-get update | ||
|
||
suites: | ||
- name: default | ||
driver: | ||
vm_hostname: mongo3 | ||
run_list: | ||
- recipe[mongodb3::default] | ||
attributes: | ||
chef_client: | ||
config: | ||
force_logger: true | ||
log_level: info | ||
build-essential: | ||
compile_time: false | ||
mongodb3: | ||
mongod: | ||
disable-transparent-hugepages: true | ||
provisioner: | ||
client_rb: | ||
environment: dev | ||
excludes: | ||
- oel-6.6 | ||
- ami-2014.03 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,47 @@ | ||
language: ruby | ||
rvm: | ||
- 2.1.0 | ||
bundler_args: --without integration | ||
gemfile: | ||
- Gemfile | ||
# NOTE: we used ChefDK so we are not stick to which Ruby version. | ||
sudo: required | ||
dist: trusty | ||
|
||
# install the pre-release chef-dk. Use chef-stable-trusty to install the stable release | ||
addons: | ||
apt: | ||
sources: | ||
- chef-current-trusty | ||
packages: | ||
- chefdk | ||
|
||
# Don't `bundle install` which takes about 1.5 mins | ||
install: echo "skip bundle install" | ||
|
||
branches: | ||
only: | ||
- master | ||
- develop | ||
|
||
services: docker | ||
|
||
env: | ||
matrix: | ||
- INSTANCE=default-centos-6 | ||
- INSTANCE=default-centos-7 | ||
- INSTANCE=default-ubuntu-1404 | ||
- INSTANCE=default-ubuntu-1604 | ||
|
||
before_script: | ||
- bundle exec berks | ||
script: | ||
- bundle exec foodcritic . | ||
- bundle exec rspec test/libraries | ||
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER ) | ||
- eval "$(/opt/chefdk/bin/chef shell-init bash)" | ||
|
||
script: KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE} | ||
|
||
# NOTE: we include a separate build for Unit test and Linter | ||
# MIGHT NOT KNOW the purpose of `UNIT_AND_LINT=1`. | ||
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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- This is a generated file. Please do not edit directly --> | ||
|
||
# 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 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) for details on the process and how to become a maintainer or the project lead. | ||
|
||
# Project Maintainer | ||
* [Sunggun Yu](https://github.com/sunggun-yu) | ||
|
||
# Maintainers | ||
* [Sunggun Yu](https://github.com/sunggun-yu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# | ||
# This file is structured to be consumed by both humans and computers. | ||
# It is a TOML document containing Markdown | ||
# | ||
[Preamble] | ||
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 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) for details on the process and how to become a maintainer or the project lead. | ||
""" | ||
|
||
[Org] | ||
[Org.Components] | ||
[Org.Components.Core] | ||
title = "Project Maintainer" | ||
|
||
lieutenant = 'sunggun' | ||
|
||
maintainers = [ | ||
'sunggun' | ||
] | ||
|
||
[people] | ||
[people.sunggun] | ||
name = "Sunggun Yu" | ||
github = "sunggun-yu" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/usr/bin/env rake | ||
|
||
require_relative 'tasks/maintainers' | ||
|
||
# Style tests. cookstyle (rubocop) and Foodcritic | ||
namespace :style do | ||
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'] | ||
|
||
# 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 | ||
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 | ||
|
||
# Default | ||
task default: %w(style spec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# | ||
# Copyright:: Copyright (c) 2015-2016 Chef Software, Inc. | ||
# License:: Apache License, Version 2.0 | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
require 'rake' | ||
|
||
SOURCE = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.toml') | ||
TARGET = File.join(File.dirname(__FILE__), '..', 'MAINTAINERS.md') | ||
|
||
begin | ||
require 'tomlrb' | ||
task default: 'maintainers:generate' | ||
|
||
namespace :maintainers do | ||
desc 'Generate MarkDown version of MAINTAINERS file' | ||
task :generate do | ||
@toml = Tomlrb.load_file SOURCE | ||
out = "<!-- This is a generated file. Please do not edit directly -->\n\n" | ||
|
||
out << preamble | ||
out << project_lieutenant | ||
out << all_maintainers | ||
|
||
File.open(TARGET, 'w') do |fn| | ||
fn.write out | ||
end | ||
end | ||
end | ||
|
||
rescue LoadError | ||
STDERR.puts "\n*** TomlRb not available. Skipping the Maintainers Rake task\n\n" | ||
end | ||
|
||
private | ||
|
||
def preamble | ||
<<-EOL | ||
# #{@toml['Preamble']['title']} | ||
#{@toml['Preamble']['text']} | ||
EOL | ||
end | ||
|
||
def project_lieutenant | ||
<<-EOL | ||
# #{@toml['Org']['Components']['Core']['title']} | ||
#{github_link(@toml['Org']['Components']['Core']['lieutenant'])} | ||
|
||
EOL | ||
end | ||
|
||
def all_maintainers | ||
text = "# Maintainers\n" | ||
@toml['Org']['Components']['Core']['maintainers'].each do |m| | ||
text << "#{github_link(m)}\n" | ||
end | ||
text | ||
end | ||
|
||
def github_link(person) | ||
name = @toml['people'][person]['name'] | ||
github = @toml['people'][person]['github'] | ||
"* [#{name}](https://github.com/#{github})" | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where do these 2 come from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is not from me, it is from the original master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you don't define then, there is no need for them here