Skip to content

Commit

Permalink
Convert to inspec, kitchen-dokken, apt_update
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <tsmith@chef.io>
  • Loading branch information
tas50 committed Mar 27, 2017
1 parent 8796acc commit a4a7bca
Show file tree
Hide file tree
Showing 9 changed files with 116 additions and 55 deletions.
101 changes: 86 additions & 15 deletions .kitchen.docker.yml
@@ -1,28 +1,99 @@
settings:
parallel: true

driver:
name: docker
# privileged is required otherwise the container doesn't boot right
privileged: true
name: dokken
chef_version: latest
privileged: true # because Docker and SystemD/Upstart

transport:
name: dokken

provisioner:
name: dokken

verifier:
name: inspec

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
driver:
image: centos:5
platform: rhel
pid_one_command: /sbin/init
intermediate_instructions:
- RUN yum install -y which initscripts

- 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
run_command: /usr/lib/systemd/systemd
provision_command:
- /bin/yum install -y initscripts net-tools wget
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- 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
driver:
image: ubuntu-upstart:12.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
platform: ubuntu
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install apt-transport-https net-tools -y
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

- 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:
- name: default
Expand Down
6 changes: 4 additions & 2 deletions .kitchen.yml
Expand Up @@ -7,13 +7,15 @@ driver:
provisioner:
name: chef_zero

verifier:
name: inspec

platforms:
- name: centos-6.8
- name: centos-7.2
- name: ubuntu-12.04
run_list: apt::default
- name: ubuntu-14.04
run_list: apt::default
- name: ubuntu-16.04

suites:
- name: default
Expand Down
38 changes: 22 additions & 16 deletions .travis.yml
@@ -1,14 +1,21 @@
sudo: required
dist: trusty

# install the pre-release chef-dk. Use chef-stable-precise to install the stable release
# install the pre-release chef-dk. Use chef-stable-trusty to install the stable release
addons:
apt:
sources:
- chef-stable-precise
- chef-current-trusty
packages:
- chefdk

# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"

branches:
only:
- master

services: docker

env:
Expand All @@ -18,20 +25,19 @@ env:
- INSTANCE=add-ons-no-fqdn-ubuntu-1404
- INSTANCE=add-ons-no-fqdn-centos-7

# Don't `bundle install`
install: echo "skip bundle install"

# Ensure we make ChefDK's Ruby the default
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 )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/embedded/bin/chef gem install kitchen-docker
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
1 change: 0 additions & 1 deletion Berksfile
Expand Up @@ -3,6 +3,5 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'apt'
cookbook 'test', path: './test/fixtures/cookbooks/test'
end
12 changes: 1 addition & 11 deletions test/fixtures/cookbooks/test/recipes/default.rb
@@ -1,11 +1 @@
# This test recipe is used within test kitchen to perform additional
# setup, or to configure custom resources in the main cookbook.

# workaround for https://github.com/chef/bento/issues/325
remote_file '/etc/pki/tls/certs/ca-bundle.crt' do
source 'http://opscode-omnibus-cache.s3.amazonaws.com/cacerts-2014.07.15-fd48275847fa10a8007008379ee902f1'
checksum 'a9cce49cec92304d29d05794c9b576899d8a285659b3f987dd7ed784ab3e0621'
sensitive true
only_if { platform_family?('rhel') }
only_if { node['platform_version'].to_i == 5 }
end
apt_update 'update' if platform_family?('debian')
@@ -1,6 +1,4 @@
require_relative './spec_helper'

describe 'chef-server' do
control 'chef-server' do
describe package('chef-server-core') do
it { should be_installed }
end
Expand Down
@@ -1,7 +1,6 @@
require_relative './spec_helper'
require 'resolv'

describe 'chef-server' do
control 'chef-server' do
describe package('chef-server-core') do
it { should be_installed }
end
Expand Down
3 changes: 0 additions & 3 deletions test/integration/helpers/serverspec/spec_helper.rb

This file was deleted.

@@ -1,7 +1,6 @@
require_relative './spec_helper'
require 'resolv'

describe 'chef-server-no-fqdn' do
control 'chef-server-no-fqdn' do
describe file('/etc/opscode/chef-server.rb') do
its(:content) { should_not match(/^api_fqdn.*$/) }
end
Expand Down

0 comments on commit a4a7bca

Please sign in to comment.