summaryrefslogtreecommitdiff
path: root/kitchen-tests
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2016-05-24 13:50:05 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2016-05-24 13:50:05 -0700
commit040e7473b458d1c917291d9857c15848a647e126 (patch)
tree4f97d2561899e9ff854a66facb763658a36949e4 /kitchen-tests
parent37668e4b9a96b60c0a7ea5e7f9843c935163974a (diff)
downloadchef-040e7473b458d1c917291d9857c15848a647e126.tar.gz
convert kitchen tests to docker + other fixes
- use kitchen-dokken instead of kitchen-ec2 - add tests for gem metadata + chef-sugar - convert to inspec and add some tests this disables the webapp stuff completely and its testing for now, that needs to be updated to more modern httpd/mysql cookbooks and have its testing converted to inspec. more O/S distros are also in the pipeline.
Diffstat (limited to 'kitchen-tests')
-rw-r--r--kitchen-tests/.kitchen.travis.yml106
-rw-r--r--kitchen-tests/.kitchen.yml13
-rw-r--r--kitchen-tests/Berksfile6
-rw-r--r--kitchen-tests/Berksfile.lock35
-rw-r--r--kitchen-tests/Gemfile17
-rw-r--r--kitchen-tests/Gemfile.lock122
-rw-r--r--kitchen-tests/cookbooks/base/attributes/default.rb13
-rw-r--r--kitchen-tests/cookbooks/base/libraries/chef-sugar.rb4
-rw-r--r--kitchen-tests/cookbooks/base/metadata.rb4
-rw-r--r--kitchen-tests/cookbooks/base/recipes/default.rb6
-rw-r--r--kitchen-tests/cookbooks/base/recipes/packages.rb2
-rw-r--r--kitchen-tests/test/integration/webapp/default_spec.rb125
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/Gemfile4
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/Gemfile.lock19
-rw-r--r--kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb127
15 files changed, 367 insertions, 236 deletions
diff --git a/kitchen-tests/.kitchen.travis.yml b/kitchen-tests/.kitchen.travis.yml
index 682a1a5f68..0c7580be04 100644
--- a/kitchen-tests/.kitchen.travis.yml
+++ b/kitchen-tests/.kitchen.travis.yml
@@ -1,14 +1,16 @@
---
driver:
- name: ec2
- aws_ssh_key_id: <%= ENV['AWS_KEYPAIR_NAME'] %>
- region: "us-west-2"
- availability_zone: "us-west-2a"
- security_group_ids: ["travis-ci"]
- instance_type: "m3.medium"
+ name: dokken
+ privileged: true
+ chef_version: latest
+
+transport:
+ name: dokken
provisioner:
name: chef_github
+ root_path: /opt/kitchen
+ chef_version: latest
chef_omnibus_url: "https://omnitruck.chef.io/install.sh"
chef_omnibus_install_options: "-c current"
github_owner: "chef"
@@ -20,22 +22,90 @@ provisioner:
client_rb:
diff_disabled: true
-transport:
- ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
+verifier:
+ name: inspec
platforms:
- - name: ubuntu-14.04
- driver:
- # http://cloud-images.ubuntu.com/locator/ec2/
- # 14.04 amd64 us-west-2 hvm:ebs-ssd
- image_id: ami-63ac5803
- - name: centos-6
- driver:
- image_id: ami-05cf2265
+- 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 -y install zlib1g-dev sudo net-tools
+
+- 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 -y install zlib1g-dev sudo net-tools
+
+- name: centos-5
+ driver:
+ image: centos:5
+ platform: rhel
+ run_command: /sbin/init
+ provision_command:
+ - RUN yum clean all
+ - RUN yum install -y which initscripts net-tools sudo
+
+- name: centos-6
+ driver:
+ image: centos:6
+ intermediate_instructions:
+ - RUN yum clean all
+ - RUN yum -y install which initscripts net-tools sudo
+
+- name: centos-7
+ driver:
+ image: centos:7
+ pid_one_command: /usr/lib/systemd/systemd
+ intermediate_instructions:
+ - RUN yum clean all
+ - RUN yum -y install which initscripts net-tools sudo
+
+- name: fedora-23
+ driver:
+ image: fedora:23
+ pid_one_command: /usr/lib/systemd/systemd
+ intermediate_instructions:
+ - RUN dnf -y install yum which initscripts net-tools
+
+- name: ubuntu-12.04
+ driver:
+ image: ubuntu-upstart:12.04
+ pid_one_command: /sbin/init
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+ - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools
+
+- name: ubuntu-14.04
+ driver:
+ image: ubuntu-upstart:14.04
+ pid_one_command: /sbin/init
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+ - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools
+
+- name: ubuntu-16.04
+ driver:
+ image: ubuntu:16.04
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN /usr/bin/apt-get update
+ - RUN /usr/bin/apt-get -y install zlib1g-dev sudo net-tools
+
+- name: opensuse-13.2
+ driver:
+ image: opensuse:13.2
+ pid_one_command: /bin/systemd
+ intermediate_instructions:
+ - RUN zypper refresh
suites:
- name: webapp
run_list:
- recipe[base::default]
- - recipe[webapp::default]
- attributes:
+# - recipe[webapp::default]
diff --git a/kitchen-tests/.kitchen.yml b/kitchen-tests/.kitchen.yml
index af7ac3cde5..c02ea55a02 100644
--- a/kitchen-tests/.kitchen.yml
+++ b/kitchen-tests/.kitchen.yml
@@ -5,6 +5,9 @@ driver:
cpus: 4
memory: 2048
+verifier:
+ name: inspec
+
provisioner:
name: chef_github
chef_omnibus_url: "https://omnitruck.chef.io/install.sh"
@@ -19,17 +22,15 @@ provisioner:
platforms:
- name: ubuntu-12.04
- name: ubuntu-14.04
- # needs updates for 16.04
- #- name: ubuntu-16.04
- # needs updates for 7.2
- #- name: centos-7.2
+ - name: ubuntu-16.04
+ - name: centos-7.2
- name: centos-6.7
# needs fixing for 5.11
- #- name: centos-5.11
+ # - name: centos-5.11
suites:
- name: webapp
run_list:
- recipe[base::default]
- - recipe[webapp::default]
+# - recipe[webapp::default]
attributes:
diff --git a/kitchen-tests/Berksfile b/kitchen-tests/Berksfile
index 23c72d5394..31e49b3e18 100644
--- a/kitchen-tests/Berksfile
+++ b/kitchen-tests/Berksfile
@@ -1,6 +1,8 @@
source "https://supermarket.getchef.com"
-cookbook "webapp", :path => "cookbooks/webapp"
-cookbook "base", :path => "cookbooks/base"
+cookbook "webapp", path: "cookbooks/webapp"
+cookbook "base", path: "cookbooks/base"
cookbook "php", "~> 1.5.0"
+
+cookbook "resolver", github: "chef-cookbooks/resolver", branch: "lcg/docker"
diff --git a/kitchen-tests/Berksfile.lock b/kitchen-tests/Berksfile.lock
index b5fa7aba13..f4a9de89e2 100644
--- a/kitchen-tests/Berksfile.lock
+++ b/kitchen-tests/Berksfile.lock
@@ -2,6 +2,10 @@ DEPENDENCIES
base
path: cookbooks/base
php (~> 1.5.0)
+ resolver
+ git: git://github.com/chef-cookbooks/resolver.git
+ revision: dd65ab8e2346cc0739c13682c74868f5b939b06a
+ branch: lcg/docker
webapp
path: cookbooks/webapp
@@ -14,7 +18,7 @@ GRAPH
apt (>= 0.0.0)
build-essential (>= 0.0.0)
chef-client (>= 0.0.0)
- fail2ban (>= 0.0.0)
+ chef_hostname (>= 0.0.0)
logrotate (>= 0.0.0)
multipackage (>= 0.0.0)
nscd (>= 0.0.0)
@@ -26,15 +30,18 @@ GRAPH
ubuntu (>= 0.0.0)
users (>= 0.0.0)
yum-epel (>= 0.0.0)
- build-essential (3.2.0)
+ build-essential (4.0.0)
+ mingw (>= 0.0.0)
seven_zip (>= 0.0.0)
- chef-client (4.5.0)
+ chef-client (4.5.2)
cron (>= 1.7.0)
logrotate (>= 1.9.0)
windows (>= 1.39.0)
chef-sugar (3.3.0)
- chef_handler (1.3.0)
- compat_resource (12.9.1)
+ chef_handler (1.4.0)
+ chef_hostname (0.4.1)
+ compat_resource (>= 0.0.0)
+ compat_resource (12.10.4)
cron (1.7.6)
database (2.3.1)
aws (>= 0.0.0)
@@ -42,12 +49,13 @@ GRAPH
mysql-chef_gem (~> 0.0)
postgresql (>= 1.0.0)
xfs (>= 0.0.0)
- fail2ban (2.3.0)
- yum-epel (>= 0.0.0)
iis (4.1.7)
windows (>= 1.34.6)
iptables (2.2.0)
logrotate (1.9.2)
+ mingw (1.0.0)
+ compat_resource (>= 0.0.0)
+ seven_zip (>= 0.0.0)
multipackage (3.0.28)
compat_resource (>= 0.0.0)
mysql (5.6.3)
@@ -55,11 +63,12 @@ GRAPH
mysql-chef_gem (0.0.5)
build-essential (>= 0.0.0)
mysql (>= 0.0.0)
- nscd (2.0.0)
+ nscd (4.0.0)
compat_resource (>= 0.0.0)
- ntp (1.11.0)
+ ntp (2.0.0)
windows (>= 1.38.0)
- ohai (3.0.1)
+ ohai (4.0.2)
+ compat_resource (>= 12.9.0)
openssh (2.0.0)
iptables (>= 1.0)
openssl (4.4.0)
@@ -75,9 +84,9 @@ GRAPH
apt (>= 1.9.0)
build-essential (>= 0.0.0)
openssl (~> 4.0)
- resolver (1.3.0)
+ resolver (1.3.1)
selinux (0.9.0)
- seven_zip (2.0.0)
+ seven_zip (2.0.1)
windows (>= 1.2.2)
sudo (2.9.0)
ubuntu (1.2.0)
@@ -88,7 +97,7 @@ GRAPH
database (~> 2.3.1)
mysql (~> 5.6.3)
php (~> 1.5.0)
- windows (1.40.0)
+ windows (1.41.0)
chef_handler (>= 0.0.0)
xfs (2.0.1)
xml (2.0.0)
diff --git a/kitchen-tests/Gemfile b/kitchen-tests/Gemfile
index acc62156ae..ad89269a75 100644
--- a/kitchen-tests/Gemfile
+++ b/kitchen-tests/Gemfile
@@ -1,10 +1,11 @@
source "https://rubygems.org"
-group :end_to_end do
- gem "berkshelf"
- gem "test-kitchen", "~> 1.4"
- gem "kitchen-appbundle-updater"
- gem "kitchen-vagrant", "~> 0.17"
- gem "kitchen-ec2", github: "test-kitchen/kitchen-ec2"
- gem "vagrant-wrapper"
-end
+gem "berkshelf"
+gem "kitchen-appbundle-updater"
+gem "kitchen-dokken"
+gem "kitchen-ec2"
+gem "kitchen-inspec"
+gem "kitchen-vagrant"
+gem "ridley"
+gem "test-kitchen"
+gem "vagrant-wrapper"
diff --git a/kitchen-tests/Gemfile.lock b/kitchen-tests/Gemfile.lock
index 69c23ad156..3f59bf90fe 100644
--- a/kitchen-tests/Gemfile.lock
+++ b/kitchen-tests/Gemfile.lock
@@ -1,26 +1,15 @@
-GIT
- remote: git://github.com/test-kitchen/kitchen-ec2.git
- revision: fec3f199a646980dc289ac6db9f90e9a9e4b0f6b
- specs:
- kitchen-ec2 (1.0.0)
- aws-sdk (~> 2)
- excon
- multi_json
- retryable (~> 2.0)
- test-kitchen (~> 1.4, >= 1.4.1)
-
GEM
remote: https://rubygems.org/
specs:
addressable (2.4.0)
artifactory (2.3.2)
- aws-sdk (2.3.2)
- aws-sdk-resources (= 2.3.2)
- aws-sdk-core (2.3.2)
+ aws-sdk (2.3.8)
+ aws-sdk-resources (= 2.3.8)
+ aws-sdk-core (2.3.8)
jmespath (~> 1.0)
- aws-sdk-resources (2.3.2)
- aws-sdk-core (= 2.3.2)
- berkshelf (4.3.2)
+ aws-sdk-resources (2.3.8)
+ aws-sdk-core (= 2.3.8)
+ berkshelf (4.3.3)
addressable (~> 2.3, >= 2.3.4)
berkshelf-api-client (~> 2.0, >= 2.0.2)
buff-config (~> 1.0)
@@ -49,34 +38,70 @@ GEM
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
buff-ruby_engine (~> 0.1.0)
+ builder (3.2.2)
celluloid (0.16.0)
timers (~> 4.0.0)
celluloid-io (0.16.2)
celluloid (>= 0.16.0)
nio4r (>= 1.1.0)
- chef-config (12.9.41)
+ chef-config (12.10.24)
fuzzyurl (~> 0.8.0)
mixlib-config (~> 2.0)
mixlib-shellout (~> 2.0)
cleanroom (1.0.0)
+ coderay (1.1.1)
diff-lcs (1.2.5)
+ docker-api (1.26.2)
+ excon (>= 0.38.0)
+ json
erubis (2.7.0)
excon (0.49.0)
faraday (0.9.2)
multipart-post (>= 1.2, < 3)
- ffi (1.9.10-x86-mingw32)
+ ffi (1.9.10)
fuzzyurl (0.8.0)
+ gssapi (1.2.0)
+ ffi (>= 1.0.1)
+ gyoku (1.3.1)
+ builder (>= 2.1.2)
hashie (3.4.4)
hitimes (1.2.4)
- hitimes (1.2.4-x86-mingw32)
httpclient (2.7.2)
+ inspec (0.22.1)
+ hashie (~> 3.4)
+ json (~> 1.8)
+ method_source (~> 0.8)
+ pry (~> 0)
+ r-train (~> 0.12)
+ rainbow (~> 2)
+ rspec (~> 3)
+ rspec-its (~> 1.2)
+ rubyzip (~> 1.1)
+ thor (~> 0.19)
jmespath (1.2.4)
json_pure (>= 1.8.1)
json (1.8.3)
json_pure (1.8.3)
kitchen-appbundle-updater (0.1.2)
+ kitchen-dokken (0.0.29)
+ docker-api (~> 1.26.2)
+ test-kitchen (~> 1.5)
+ kitchen-ec2 (1.0.0)
+ aws-sdk (~> 2)
+ excon
+ multi_json
+ retryable (~> 2.0)
+ test-kitchen (~> 1.4, >= 1.4.1)
+ kitchen-inspec (0.13.0)
+ inspec (>= 0.20.0, < 1.0.0)
+ test-kitchen (~> 1.6)
kitchen-vagrant (0.20.0)
test-kitchen (~> 1.4)
+ little-plugger (1.1.4)
+ logging (2.1.0)
+ little-plugger (~> 1.1)
+ multi_json (~> 1.10)
+ method_source (0.8.2)
minitar (0.5.4)
mixlib-authentication (1.4.0)
mixlib-log
@@ -90,21 +115,32 @@ GEM
mixlib-versioning
mixlib-log (1.6.0)
mixlib-shellout (2.2.6)
- mixlib-shellout (2.2.6-universal-mingw32)
- win32-process (~> 0.8.2)
- wmi-lite (~> 1.0)
mixlib-versioning (1.1.0)
molinillo (0.4.5)
- multi_json (1.12.0)
+ multi_json (1.12.1)
multipart-post (2.0.0)
net-scp (1.2.1)
net-ssh (>= 2.6.5)
net-ssh (3.1.1)
nio4r (1.2.1)
+ nori (2.6.0)
octokit (4.3.0)
sawyer (~> 0.7.0, >= 0.5.3)
+ pry (0.10.3)
+ coderay (~> 1.1.0)
+ method_source (~> 0.8.1)
+ slop (~> 3.4)
+ r-train (0.12.1)
+ docker-api (~> 1.26)
+ json (~> 1.8)
+ mixlib-shellout (~> 2.0)
+ net-scp (~> 1.2)
+ net-ssh (>= 2.9, < 4.0)
+ winrm (~> 1.6)
+ winrm-fs (~> 0.3)
+ rainbow (2.1.0)
retryable (2.0.3)
- ridley (4.5.0)
+ ridley (4.5.1)
addressable
buff-config (~> 1.0)
buff-extensions (~> 1.0)
@@ -122,20 +158,30 @@ GEM
retryable (~> 2.0)
semverse (~> 1.1)
varia_model (~> 0.4.0)
+ rspec (3.4.0)
+ rspec-core (~> 3.4.0)
+ rspec-expectations (~> 3.4.0)
+ rspec-mocks (~> 3.4.0)
rspec-core (3.4.4)
rspec-support (~> 3.4.0)
rspec-expectations (3.4.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
+ rspec-its (1.2.0)
+ rspec-core (>= 3.0.0)
+ rspec-expectations (>= 3.0.0)
rspec-mocks (3.4.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0)
rspec-support (3.4.1)
+ rubyntlm (0.6.0)
+ rubyzip (1.2.0)
safe_yaml (1.0.4)
sawyer (0.7.0)
addressable (>= 2.3.5, < 2.5)
faraday (~> 0.8, < 0.10)
semverse (1.2.1)
+ slop (3.6.0)
solve (2.0.3)
molinillo (~> 0.4.2)
semverse (~> 1.1)
@@ -153,20 +199,32 @@ GEM
varia_model (0.4.1)
buff-extensions (~> 1.0)
hashie (>= 2.0.2, < 4.0.0)
- win32-process (0.8.3)
- ffi (>= 1.0.0)
- wmi-lite (1.0.0)
+ winrm (1.8.1)
+ builder (>= 2.1.2)
+ gssapi (~> 1.2)
+ gyoku (~> 1.0)
+ httpclient (~> 2.2, >= 2.2.0.2)
+ logging (>= 1.6.1, < 3.0)
+ nori (~> 2.0)
+ rubyntlm (~> 0.6.0)
+ winrm-fs (0.4.2)
+ erubis (~> 2.7)
+ logging (>= 1.6.1, < 3.0)
+ rubyzip (~> 1.1)
+ winrm (~> 1.5)
PLATFORMS
ruby
- x86-mingw32
DEPENDENCIES
berkshelf
kitchen-appbundle-updater
- kitchen-ec2!
- kitchen-vagrant (~> 0.17)
- test-kitchen (~> 1.4)
+ kitchen-dokken
+ kitchen-ec2
+ kitchen-inspec
+ kitchen-vagrant
+ ridley
+ test-kitchen
vagrant-wrapper
BUNDLED WITH
diff --git a/kitchen-tests/cookbooks/base/attributes/default.rb b/kitchen-tests/cookbooks/base/attributes/default.rb
index d4e5d1ee5a..f3bcb4f21a 100644
--- a/kitchen-tests/cookbooks/base/attributes/default.rb
+++ b/kitchen-tests/cookbooks/base/attributes/default.rb
@@ -1,9 +1,12 @@
+puts "CHEF SUGAR THINKS WE ARE ON UBUNTU" if ubuntu?
+puts "CHEF SUGAR THINKS WE ARE ON RHEL" if rhel?
+
#
# ubuntu cookbook overrides
#
-default["ubuntu"]["archive_url"] = "mirror://mirrors.ubuntu.com/mirrors.txt"
-default["ubuntu"]["security_url"] = "mirror://mirrors.ubuntu.com/mirrors.txt"
+default["ubuntu"]["archive_url"] = "http://us-west-2.ec2.archive.ubuntu.com/ubuntu"
+default["ubuntu"]["security_url"] = "http://us-west-2.ec2.archive.ubuntu.com/ubuntu"
default["ubuntu"]["include_source_packages"] = true
default["ubuntu"]["components"] = "main restricted universe multiverse"
@@ -78,3 +81,9 @@ default["resolver"]["search"] = "chef.io"
default["authorization"]["sudo"]["passwordless"] = true
default["authorization"]["sudo"]["users"] = %w{vagrant centos ubuntu}
+
+#
+# nscd cookbook overrides
+#
+
+default["nscd"]["server_user"] = "nobody"
diff --git a/kitchen-tests/cookbooks/base/libraries/chef-sugar.rb b/kitchen-tests/cookbooks/base/libraries/chef-sugar.rb
new file mode 100644
index 0000000000..90d02a361f
--- /dev/null
+++ b/kitchen-tests/cookbooks/base/libraries/chef-sugar.rb
@@ -0,0 +1,4 @@
+require "chef/sugar"
+
+# hack until this gets baked into chef-sugar so we can use chef-sugar in attributes files
+Chef::Node.send(:include, Chef::Sugar::DSL)
diff --git a/kitchen-tests/cookbooks/base/metadata.rb b/kitchen-tests/cookbooks/base/metadata.rb
index 9e5e792f89..3811fe914d 100644
--- a/kitchen-tests/cookbooks/base/metadata.rb
+++ b/kitchen-tests/cookbooks/base/metadata.rb
@@ -6,10 +6,12 @@ description "Installs/Configures base"
long_description "Installs/Configures base"
version "0.1.0"
+gem "chef-sugar"
+
depends "apt"
depends "build-essential"
depends "chef-client"
-depends "fail2ban"
+depends "chef_hostname"
depends "logrotate"
depends "multipackage"
depends "nscd"
diff --git a/kitchen-tests/cookbooks/base/recipes/default.rb b/kitchen-tests/cookbooks/base/recipes/default.rb
index 4ddd7a7b04..be939b78e6 100644
--- a/kitchen-tests/cookbooks/base/recipes/default.rb
+++ b/kitchen-tests/cookbooks/base/recipes/default.rb
@@ -5,9 +5,11 @@
# Copyright (C) 2014
#
+hostname "chef-travis-ci.chef.io"
+
if node[:platform_family] == "debian"
- include_recipe "apt"
include_recipe "ubuntu"
+ apt_update "packages"
end
if %w{rhel fedora}.include?(node[:platform_family])
@@ -33,8 +35,6 @@ include_recipe "chef-client"
include_recipe "openssh"
-include_recipe "fail2ban"
-
include_recipe "nscd"
include_recipe "logrotate"
diff --git a/kitchen-tests/cookbooks/base/recipes/packages.rb b/kitchen-tests/cookbooks/base/recipes/packages.rb
index f242951a4c..c3a552b05c 100644
--- a/kitchen-tests/cookbooks/base/recipes/packages.rb
+++ b/kitchen-tests/cookbooks/base/recipes/packages.rb
@@ -1,6 +1,6 @@
-pkgs = %w{lsof tcpdump strace zsh dmidecode ltrace bc curl wget telnet subversion git traceroute htop iptraf tmux s3cmd sysbench }
+pkgs = %w{lsof tcpdump strace zsh dmidecode ltrace bc curl wget telnet subversion git traceroute htop tmux s3cmd sysbench }
# this deliberately calls the multipackage API N times in order to do one package installation in order to exercise the
# multipackage cookbook.
diff --git a/kitchen-tests/test/integration/webapp/default_spec.rb b/kitchen-tests/test/integration/webapp/default_spec.rb
new file mode 100644
index 0000000000..fbd1e0e782
--- /dev/null
+++ b/kitchen-tests/test/integration/webapp/default_spec.rb
@@ -0,0 +1,125 @@
+#describe port(80) do
+# it { should be_listening }
+# its('processes') {should include 'http'}
+#end
+#
+#describe command("curl http://localhost/index.html") do
+# its("stdout") { should match /Hello, World!/ }
+#end
+
+case os[:family]
+when "debian", "ubuntu"
+ ssh_package = "openssh-client"
+ ssh_service = "ssh"
+ ntp_service = "ntp"
+when "centos", "redhat", "fedora"
+ ssh_package = "openssh-clients"
+ ssh_service = "sshd"
+ ntp_service = "ntpd"
+else
+ raise "i don't know the family #{os[:family]}"
+end
+
+describe package("nscd") do
+ it { should be_installed }
+end
+
+describe service("nscd") do
+ # broken?
+ # it { should be_enabled }
+ it { should be_installed }
+ it { should be_running }
+end
+
+describe package(ssh_package) do
+ it { should be_installed }
+end
+
+describe service(ssh_service) do
+ it { should be_enabled }
+ it { should be_installed }
+ it { should be_running }
+end
+
+describe sshd_config do
+ its("Protocol") { should cmp 2 }
+ its("GssapiAuthentication") { should cmp "no" }
+ its("UseDns") { should cmp "no" }
+end
+
+describe ssh_config do
+ its("StrictHostKeyChecking") { should cmp "no" }
+ its("GssapiAuthentication") { should cmp "no" }
+end
+
+describe package("ntp") do
+ it { should be_installed }
+end
+
+describe service(ntp_service) do
+ # broken?
+ # it { should be_enabled }
+ it { should be_installed }
+ it { should be_running }
+end
+
+describe service("chef-client") do
+ it { should be_enabled }
+ it { should be_installed }
+ it { should be_running }
+end
+
+describe file("/etc/resolv.conf") do
+ its("content") { should match /search\s+chef.io/ }
+ its("content") { should match /nameserver\s+8.8.8.8/ }
+ its("content") { should match /nameserver\s+8.8.4.4/ }
+end
+
+describe package("gcc") do
+ it { should be_installed }
+end
+
+describe package("flex") do
+ it { should be_installed }
+end
+
+describe package("bison") do
+ it { should be_installed }
+end
+
+describe package("autoconf") do
+ it { should be_installed }
+end
+
+%w{lsof tcpdump strace zsh dmidecode ltrace bc curl wget telnet subversion git traceroute htop tmux s3cmd sysbench }.each do |pkg|
+ describe package pkg do
+ it { should be_installed }
+ end
+end
+
+if %w{debian ubuntu}.include?(os[:family])
+ describe apt("http://us-west-2.ec2.archive.ubuntu.com/ubuntu") do
+ it { should be_enabled }
+ it { should exist }
+ end
+end
+
+describe etc_group.where(group_name: "sysadmin") do
+ its("users") { should include "adam" }
+ its("gids") { should eq [2300] }
+end
+
+describe passwd.users("adam") do
+ its("uids") { should eq ["666"] }
+end
+
+describe ntp_conf do
+ its("server") { should_not eq nil }
+end
+
+# busted inside of docker containers?
+describe port(22) do
+ it { should be_listening }
+ its("protocols") { should include "tcp" }
+ its("processes") { should eq ["sshd"] }
+end
diff --git a/kitchen-tests/test/integration/webapp/serverspec/Gemfile b/kitchen-tests/test/integration/webapp/serverspec/Gemfile
deleted file mode 100644
index eef1450f7a..0000000000
--- a/kitchen-tests/test/integration/webapp/serverspec/Gemfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# This Gemfile is only needed so that busser will install gems it needs for serverspec_helper.rb to work
-source "https://rubygems.org"
-
-gem "ffi-yajl", "~> 1.1" # Go away, JSON gem
diff --git a/kitchen-tests/test/integration/webapp/serverspec/Gemfile.lock b/kitchen-tests/test/integration/webapp/serverspec/Gemfile.lock
deleted file mode 100644
index ac6c11f28c..0000000000
--- a/kitchen-tests/test/integration/webapp/serverspec/Gemfile.lock
+++ /dev/null
@@ -1,19 +0,0 @@
-GEM
- remote: https://rubygems.org/
- specs:
- ffi (1.9.10)
- ffi (1.9.10-x86-mingw32)
- ffi-yajl (1.4.0)
- ffi (~> 1.5)
- libyajl2 (~> 1.2)
- libyajl2 (1.2.0)
-
-PLATFORMS
- ruby
- x86-mingw32
-
-DEPENDENCIES
- ffi-yajl (~> 1.1)
-
-BUNDLED WITH
- 1.11.2
diff --git a/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb b/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb
deleted file mode 100644
index 992e4f7683..0000000000
--- a/kitchen-tests/test/integration/webapp/serverspec/localhost/default_spec.rb
+++ /dev/null
@@ -1,127 +0,0 @@
-
-require "net/http"
-require "uri"
-
-require "#{ENV['BUSSER_ROOT']}/../kitchen/data/serverspec_helper"
-
-describe "webapp::default", :end_to_end => true do
-
- describe "installed packages" do
- shared_examples_for "a package" do
- it "is installed" do
- expect(package(package_name)).to be_installed
- end
- end
-
- describe "#{property[:apache][:package]} package" do
- include_examples "a package" do
- let(:package_name) { property[:apache][:package] }
- end
- end
-
- describe "#{property[:mysql][:server_package]} package" do
- include_examples "a package" do
- let(:package_name) { property[:mysql][:server_package] }
- end
- end
-
- describe "#{property[:mysql][:client_package]} package" do
- include_examples "a package" do
- let(:package_name) { property[:mysql][:client_package] }
- end
- end
-
- describe "php package" do
- include_examples "a package" do
- let(:package_name) { property[:php][:package] }
- end
- end
- end
-
- describe "enabled/running services" do
- shared_examples_for "a service" do
- it "is enabled" do
- expect(service(service_name)).to be_enabled
- end
-
- it "is running" do
- expect(service(service_name)).to be_enabled
- end
- end
-
- describe "#{property[:apache][:service_name]} service" do
- include_examples "a service" do
- let(:service_name) { property[:apache][:service_name] }
- end
- end
-
- describe "mysql service" do
- include_examples "a service" do
- let(:service_name) { property[:mysql][:service_name] }
- end
- end
-
- end
-
- describe "mysql database" do
- let(:db_query) { "mysql -u root -pilikerandompasswordstoo -e \"#{statement}\"" }
- let(:statement) { "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='webapp'" }
- it "creates a database called 'webapp'" do
- expect(command(db_query).stdout).to match /webapp/
- end
-
- describe "mysql database user 'webapp'" do
- let(:statement) { "SELECT Host, Db FROM mysql.db WHERE User='webapp'\\G" }
- it "adds user 'webapp' to database 'webapp@localhost'" do
- expect(command(db_query).stdout).to match /Host: localhost\n Db: webapp/
- end
-
- describe "grants" do
- shared_examples_for "a privilege" do |priv|
- let(:statement) {
- "SELECT #{priv_query}" \
- " FROM mysql.db" \
- " WHERE Host='localhost' AND Db='webapp' AND User='webapp'\\G"
- }
- let(:priv_query) { "#{priv.capitalize}_priv" }
-
- it "has privilege #{priv} on 'webapp@localhost'" do
- expect(command(db_query).stdout).to match /#{priv_query}: Y/
- end
- end
-
- %w{select update insert delete create}.each do |priv|
- include_examples "a privilege", priv do
- end
- end
- end
- end
- end
-
- describe "generated webpages" do
- let(:get_response) { Net::HTTP.get_response(uri) }
- shared_examples_for "a webpage" do
- it "exists" do
- expect(get_response).to be_kind_of(Net::HTTPSuccess)
- end
-
- it "displays content" do
- expect(get_response.body).to include(content)
- end
- end
-
- describe "http://localhost/index.html" do
- include_examples "a webpage" do
- let(:uri) { URI.parse("http://localhost/index.html") }
- let(:content) { "Hello, World!" }
- end
- end
-
- describe "http://localhost/index.php" do
- include_examples "a webpage" do
- let(:uri) { URI.parse("http://localhost/index.php") }
- let(:content) { "Hello, World!" }
- end
- end
- end
-end