summaryrefslogtreecommitdiff
path: root/kitchen-tests
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2018-08-10 12:17:04 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2018-08-10 12:17:04 -0700
commitb7493fd0855e7575b91f695b28ef3af1b47f0276 (patch)
tree6c5925790995c4e0e734439e27861f3f93c48244 /kitchen-tests
parent7c9178e5dd4ec7b5a75993c148b087bac6e5b53d (diff)
downloadchef-b7493fd0855e7575b91f695b28ef3af1b47f0276.tar.gz
add centos-7 rspec testing
running rspec inside a test-kitchen provisioned centos-7 docker container Signed-off-by: Lamont Granquist <lamont@scriptkiddie.org>
Diffstat (limited to 'kitchen-tests')
-rw-r--r--kitchen-tests/Berksfile1
-rw-r--r--kitchen-tests/cookbooks/rspec/metadata.rb8
-rw-r--r--kitchen-tests/cookbooks/rspec/recipes/default.rb13
-rw-r--r--kitchen-tests/cookbooks/rspec/templates/run-chef-rspec11
-rw-r--r--kitchen-tests/kitchen.travis.yml9
5 files changed, 42 insertions, 0 deletions
diff --git a/kitchen-tests/Berksfile b/kitchen-tests/Berksfile
index 50e09ebf3b..d699452ebe 100644
--- a/kitchen-tests/Berksfile
+++ b/kitchen-tests/Berksfile
@@ -1,3 +1,4 @@
source "https://supermarket.chef.io"
cookbook "end_to_end", path: "cookbooks/end_to_end"
+cookbook "rspec", path: "cookbooks/rspec"
diff --git a/kitchen-tests/cookbooks/rspec/metadata.rb b/kitchen-tests/cookbooks/rspec/metadata.rb
new file mode 100644
index 0000000000..f0b5bfba75
--- /dev/null
+++ b/kitchen-tests/cookbooks/rspec/metadata.rb
@@ -0,0 +1,8 @@
+name "rspec"
+license "Apache-2.0"
+description "Runs nothing"
+version "1.0.0"
+
+chef_version ">= 14"
+issues_url "https://github.com/chef/chef/issues"
+source_url "https://github.com/chef/chef"
diff --git a/kitchen-tests/cookbooks/rspec/recipes/default.rb b/kitchen-tests/cookbooks/rspec/recipes/default.rb
new file mode 100644
index 0000000000..4dc1c10d99
--- /dev/null
+++ b/kitchen-tests/cookbooks/rspec/recipes/default.rb
@@ -0,0 +1,13 @@
+# we're using chef-client now as a glorified way to push a file to the remote host
+# if we had a way to turn off chef-client converge and push arbitrary files to the
+# remote this complexity could be removed.
+template "/usr/local/bin/run-chef-rspec" do
+ source "run-chef-rspec"
+ mode 0755
+end
+
+# do NOT even think of trying to add an execute resource here to launch rspec.
+# chefception is proven to be a bad idea, and the rspec tests that really launch
+# chef-client will likely break due to the outer chef-client run. i also do not
+# want to debug rspec's output being filtered through chef-client's logger -- fuck
+# all of that noise.
diff --git a/kitchen-tests/cookbooks/rspec/templates/run-chef-rspec b/kitchen-tests/cookbooks/rspec/templates/run-chef-rspec
new file mode 100644
index 0000000000..54c4297479
--- /dev/null
+++ b/kitchen-tests/cookbooks/rspec/templates/run-chef-rspec
@@ -0,0 +1,11 @@
+#!/bin/bash
+
+# remove ip6 entries for docker
+egrep -v "ip6" /etc/hosts > /etc/hosts.new
+cp /etc/hosts.new /etc/hosts
+
+export PATH=/opt/chef/embedded/bin:$PATH
+cd /opt/chef/embedded/apps/chef
+
+/opt/chef/embedded/bin/bundle install
+/opt/chef/embedded/bin/bundle exec /opt/chef/embedded/bin/rspec --format progress
diff --git a/kitchen-tests/kitchen.travis.yml b/kitchen-tests/kitchen.travis.yml
index 3736fb2fab..9efbf243ca 100644
--- a/kitchen-tests/kitchen.travis.yml
+++ b/kitchen-tests/kitchen.travis.yml
@@ -69,6 +69,9 @@ platforms:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
+ - RUN yum -y install cronie util-linux e2fsprogs
+ - RUN egrep -v '::1' /etc/hosts > /etc/hosts.new
+ - RUN cp /etc/hosts.new /etc/hosts
- RUN sed -i -e "s/Defaults.*requiretty.*/Defaults !requiretty/g" /etc/sudoers
- name: fedora-latest
@@ -108,3 +111,9 @@ suites:
- name: end-to-end
run_list:
- recipe[end_to_end::default]
+ - name: rspec
+ run_list:
+ - recipe[rspec]
+ lifecycle:
+ post_converge:
+ - remote: /usr/local/bin/run-chef-rspec