Add missing files from ipfs cookbook

This commit is contained in:
Greg Karékinian 2017-03-03 14:24:42 +01:00
parent 8ae1b04ad6
commit 70f86b1191
4 changed files with 185 additions and 0 deletions

View File

@ -0,0 +1,44 @@
me: dokken
privileged: true # because Docker and SystemD/Upstart
chef_image: chef/chef
chef_version: current
transport:
name: dokken
provisioner:
name: dokken
platforms:
- name: debian-7
driver:
image: debian:7
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- name: debian-8
driver:
image: debian:8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- 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
run_list:
- recipe[ipfs]

View File

@ -0,0 +1,50 @@
sudo: required
dist: trusty
# install the pre-release chef-dk. Use chef-stable-trusty to install the stable release
addons:
apt:
sources:
- chef-stable-trusty
packages:
- chefdk
# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"
branches:
only:
- master
services: docker
env:
matrix:
# - INSTANCE=default-centos-5 times out for no reason
- INSTANCE=default-centos-6
- INSTANCE=default-centos-7
- INSTANCE=default-debian-7
- INSTANCE=default-debian-8
- INSTANCE=default-fedora-latest
- INSTANCE=default-opensuse-132
- INSTANCE=default-opensuse-421
- INSTANCE=default-ubuntu-1204
- INSTANCE=default-ubuntu-1404
- INSTANCE=default-ubuntu-1604
before_script:
- 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}
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

View File

@ -0,0 +1,65 @@
#!/usr/bin/env rake
# 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 #{task.name}" 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 #{task.name}" unless ENV['CI']
end
end
desc 'Run all style checks'
task style: ['style:chef', 'style:ruby']
# ChefSpec
begin
desc 'Run ChefSpec examples'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
rescue LoadError => e
puts ">>> Gem load error: #{e}, omitting #{task.name}" 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 ">>> Gem load error: #{e}, omitting #{task.name}" unless ENV['CI']
end
end
namespace :supermarket do
begin
desc 'Publish cookbook to Supermarket with Stove'
require 'stove/rake_task'
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)

View File

@ -0,0 +1,26 @@
require 'serverspec'
# Required by serverspec
set :backend, :exec
describe "IPFS" do
# It is in the PATH
describe command("which ipfs") do
its(:exit_status) { should eq 0 }
end
it "is listening on port 4001" do
expect(port(4001)).to be_listening
end
it "is listening on port 9090 (gateway)" do
expect(port(9090)).to be_listening
end
it "has a running service of ipfs" do
expect(service("ipfs")).to be_running
expect(service("ipfs")).to be_enabled
end
end