Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul testing for kitchen-dokken #201

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: ruby
rvm:
- 2.5.1
- 2.7.1
cache: bundler
sudo: required
group: edge
dist: xenial
os: linux
git:
depth: false

services: docker

Expand All @@ -19,28 +23,28 @@ env:
- INSTANCE=default-fedora
- CHEF_LICENSE="accept-no-persist"

before_install:
- sudo apt-get -qq update
- sudo apt-get install -y nmap

before_script:
- sudo nmap -p- localhost
- sudo iptables -S
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- docker run --privileged -d -p 4444:4444 -e PORT=4444 jpetazzo/dind

script:
# - DOCKER_HOST="tcp://localhost:4444" KITCHEN_YAML=.kitchen.yml time bundle exec kitchen test ${INSTANCE} -l debug
- time bundle exec kitchen test ${INSTANCE} -l debug

after_script: |
sudo nmap -p- localhost
sudo iptables -S
docker --version ;
docker ps -a ;
docker network ls ;
docker images ;
/bin/bash -c "docker inspect `docker ps -a | grep default-fedora: | awk '{ print $1 }'`" ;
ls -laR ~/.dokken
cat .kitchen/logs/kitchen.log ;
cat Gemfile.lock ;
# before_install:
# - sudo apt-get -qq update
# - sudo apt-get install -y nmap

# before_script:
# - sudo nmap -p- localhost
# - sudo iptables -S
# - sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
# - docker run --privileged -d -p 4444:4444 -e PORT=4444 jpetazzo/dind

# script:
# # - DOCKER_HOST="tcp://localhost:4444" KITCHEN_YAML=.kitchen.yml time bundle exec kitchen test ${INSTANCE} -l debug
# - time bundle exec kitchen test ${INSTANCE} -l debug

# after_script: |
# sudo nmap -p- localhost
# sudo iptables -S
# docker --version ;
# docker ps -a ;
# docker network ls ;
# docker images ;
# /bin/bash -c "docker inspect `docker ps -a | grep default-fedora: | awk '{ print $1 }'`" ;
# ls -laR ~/.dokken
# cat .kitchen/logs/kitchen.log ;
# cat Gemfile.lock ;
4 changes: 2 additions & 2 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://supermarket.chef.io'
source "https://supermarket.chef.io"

cookbook 'dokken_test', path: 'test/cookbooks/dokken_test'
cookbook "dokken_test", path: "test/cookbooks/dokken_test"
14 changes: 5 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
source 'https://rubygems.org'
source "https://rubygems.org"

gemspec

gem 'berkshelf'
gem 'kitchen-inspec'
gem 'test-kitchen'

group :development do
gem 'pry'
gem 'pry-byebug'
end
# These should be gems we need for functional testing
# Unit testing gems should go into the gemspec.
gem "berkshelf"
gem "kitchen-inspec"
30 changes: 29 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
# release tooling
require 'bundler/gem_tasks'
require "bundler/gem_tasks"

require "rspec/core/rake_task"
desc "Run all specs in spec directory"
RSpec::Core::RakeTask.new(:spec) do |t|
t.pattern = "spec/**/*_spec.rb"
end

desc "Run all test suites"
task test: [:spec]

require "chefstyle"
require "rubocop/rake_task"
RuboCop::RakeTask.new(:style) do |task|
task.options << "--display-cop-names"
end

desc "Display LOC stats"
task :stats do
puts "\n## Production Code Stats"
sh "countloc -r lib/kitchen"
puts "\n## Test Code Stats"
sh "countloc -r spec"
end

desc "Run all quality tasks"
task quality: %i{style stats}

task default: %i{test quality}
33 changes: 20 additions & 13 deletions kitchen-dokken.gemspec
Original file line number Diff line number Diff line change
@@ -1,21 +1,28 @@
lib = File.expand_path('lib', __dir__)
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'kitchen/driver/dokken_version'
require "kitchen/driver/dokken_version"

Gem::Specification.new do |spec|
spec.name = 'kitchen-dokken'
spec.name = "kitchen-dokken"
spec.version = Kitchen::Driver::DOKKEN_VERSION
spec.authors = ['Sean OMeara']
spec.email = ['[email protected]']
spec.description = 'A Test Kitchen Driver for Dokken'
spec.summary = 'A Test Kitchen Driver that talks to the Docker Remote API and uses Volumes to produce sparse container images'
spec.homepage = 'https://github.com/someara/kitchen-dokken'
spec.license = 'Apache-2.0'
spec.authors = ["Sean OMeara"]
spec.email = ["[email protected]"]
spec.description = "A Test Kitchen Driver for Dokken"
spec.summary = "A Test Kitchen Driver that talks to the Docker Remote API and uses Volumes to produce sparse container images"
spec.homepage = "https://github.com/someara/kitchen-dokken"
spec.license = "Apache-2.0"

spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR).grep(/LICENSE|^lib/)
spec.require_paths = ['lib']
spec.require_paths = ["lib"]

spec.add_dependency 'docker-api', '~> 1.33'
spec.add_dependency 'lockfile', '~> 2.1'
spec.add_dependency 'test-kitchen', '>= 1.15', '< 3'
spec.add_dependency "docker-api", "~> 1.33"
spec.add_dependency "lockfile", "~> 2.1"
spec.add_dependency "test-kitchen", ">= 1.15", "< 3"

spec.add_development_dependency "chefstyle", "= 1.2.1"
spec.add_development_dependency "climate_control", "~> 0.2.0"
spec.add_development_dependency "countloc", "~> 0.4.0"
spec.add_development_dependency "pry-byebug", "~> 3.9"
spec.add_development_dependency "rake", "~> 13.0", ">= 13.0.1"
spec.add_development_dependency "simplecov", "~> 0.18.5"
end
Loading