Skip to content

Commit

Permalink
Revamp testing
Browse files Browse the repository at this point in the history
  • Loading branch information
martinisoft committed Aug 31, 2017
1 parent a4d9496 commit f3b6d9e
Show file tree
Hide file tree
Showing 14 changed files with 84 additions and 86 deletions.
39 changes: 0 additions & 39 deletions .kitchen.docker.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .kitchen.dokken.yml
@@ -0,0 +1,26 @@
driver:
name: dokken
privileged: true # because Docker and SystemD/Upstart
chef_version: current

transport:
name: dokken

provisioner:
name: dokken
deprecations_as_errors: true

platforms:
- name: ubuntu-14.04
driver:
image: dokken/ubuntu-14.04
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update

- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
21 changes: 15 additions & 6 deletions .kitchen.yml
@@ -1,21 +1,30 @@
---
driver_plugin: vagrant
driver_config:
require_chef_omnibus: 12.7.2
require_chef_omnibus: 12

provisioner:
name: chef_solo
name: chef_zero

verifier:
name: inspec

platforms:
- name: ubuntu-12.04
- name: ubuntu-14.04
- name: ubuntu-16.04

suites:
- name: default
- name: package
run_list:
- recipe[exabgp::default]
- recipe[test::package]
verifier:
inspec_tests:
- test/smoke/package
attributes:
- name: source
run_list:
- recipe[exabgp::source]
- recipe[test::source]
verifier:
inspec_tests:
- test/smoke/source
attributes:
34 changes: 16 additions & 18 deletions .travis.yml
@@ -1,39 +1,37 @@
sudo: required
services: docker

dist: trusty

addons:
apt:
sources:
- chef-stable-precise
- chef-stable-trusty
packages:
- chefdk

env:
global:
- KITCHEN_LOCAL_YAML=.kitchen.dokken.yml
matrix:
- INSTANCE=default-ubuntu-1404
# - INSTANCE=default-ubuntu-1204
# - INSTANCE=source-ubuntu-1404
# - INSTANCE=source-ubuntu-1204
- KITCHEN_REGEXP=package-ubuntu-1404
- KITCHEN_REGEXP=source-ubuntu-1404
- KITCHEN_REGEXP=package-ubuntu-1604
- KITCHEN_REGEXP=source-ubuntu-1604

matrix:
fast_finish: true

# Don't `bundle install` because we're using ChefDK
install: echo "skip bundle install"

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
- chef gem install kitchen-dokken
- chef gem install stove

script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/rubocop --version
- /opt/chefdk/embedded/bin/rubocop
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec
- /opt/chefdk/embedded/bin/rspec
# - KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
script: chef exec rake

notifications:
email: false
slack:
secure: PTV/w6y8Rl7X0DYAt1p0Ez0FzT8y45HK785P0JYFpoOpjKM54682fDULuFL8LZGzXsyGt8A2btj+lVOo/HMWpFD7ho+K0+5tXolJ4f7GobNz+eKKrGRoOpGgfgKjDqzF44MEqa/W5kFBVLH7t6wW4OpwcaYAlGT4bgw3WONuAkI=
secure: "cNz3S0Iw6IWQOzP4IIwSbqMjhPYNOwb6w/9/G1G6YcRTUDEtBY/BwJMdOyMsI568GU+D94oQa7OXswW/XQlb7pWMl4sPQt1VJt7WARsJ0F+Z8ScJtsyn/Tp2gbily2/5VH6paOjw86anrrjhH9cTvBMwROlzLpdYvuszdKpb4dU="
2 changes: 1 addition & 1 deletion Berksfile
Expand Up @@ -3,5 +3,5 @@ source 'https://supermarket.chef.io'
metadata

group :test do
cookbook 'exabgp_test', path: 'test/fixtures/cookbooks/exabgp_test'
cookbook 'test', path: 'test/cookbooks/test'
end
16 changes: 0 additions & 16 deletions Gemfile

This file was deleted.

9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -5,10 +5,10 @@ the swiss-army knife of networking.

## Supported Chef and Platforms

* Chef 12.1 and newer
* Chef 12.6 and newer

* Ubuntu 12.04
* Ubuntu 14.04
* Ubuntu 16.04

## Dependencies

Expand All @@ -27,15 +27,16 @@ the swiss-army knife of networking.

## Recipes

* `exabgp::default` - Includes the `exabgp_config` and `exabgp_service` resources
* `exabgp::default` - Intentionally left blank, see resource usage below

## Resources

### `exabgp`

The `exabgp` resource installs and configures ExaBGP. It _does not_ create
an ExaBGP service. You will need to handle this separately via your service
resource of choice.
resource of choice. If you want an example of such a service setup, look at
the `test/cookbooks` folder for some example recipes.

#### Actions

Expand Down
File renamed without changes.
@@ -1,6 +1,6 @@
name 'exabgp_test'
name 'test'
version '0.0.1'

depends 'exabgp'
depends 'poise-python'
depends 'runit'
depends 'poise-service-runit'
Expand Up @@ -35,3 +35,9 @@
cookbook 'exabgp-test'
variables(description: 'A test')
end

poise_service 'exabgp' do
provider :runit
command '/usr/local/bin/exabgp /etc/exabgp/exabgp.conf'
reload_signal 'USR1'
end
3 changes: 3 additions & 0 deletions test/cookbooks/test/recipes/source.rb
@@ -0,0 +1,3 @@
exabgp 'default' do
install_type :source
end
7 changes: 7 additions & 0 deletions test/smoke/package/package_test.rb
@@ -0,0 +1,7 @@
describe processes('/usr/bin/python2.7 /usr/local/bin/exabgp') do
it { should exist }
end

describe file('/etc/exabgp/exabgp.conf') do
it { should exist }
end
3 changes: 3 additions & 0 deletions test/smoke/package/source_test.rb
@@ -0,0 +1,3 @@
describe processes('exabgp') do
it { should exist }
end

0 comments on commit f3b6d9e

Please sign in to comment.