summaryrefslogtreecommitdiff
path: root/acceptance/windows-service
diff options
context:
space:
mode:
authorSalim Alam <salam@chef.io>2016-01-19 19:21:52 -0800
committerSalim Alam <salam@chef.io>2016-01-19 19:21:52 -0800
commitec20fece3ccee347804492dfec14798a47d10477 (patch)
treef9f0542863f7a7299796e085264ea59bd6ba490b /acceptance/windows-service
parent25b2c0559caaf29872d6cfe3ab146cb63c496d00 (diff)
downloadchef-ec20fece3ccee347804492dfec14798a47d10477.tar.gz
Chef running as a Windows service acceptance test
Diffstat (limited to 'acceptance/windows-service')
-rw-r--r--acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb1
-rw-r--r--acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb3
-rw-r--r--acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb3
-rw-r--r--acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb3
-rw-r--r--acceptance/windows-service/.kitchen.yml26
-rw-r--r--acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb55
6 files changed, 91 insertions, 0 deletions
diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb
new file mode 100644
index 0000000000..4c7c42d9bd
--- /dev/null
+++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/metadata.rb
@@ -0,0 +1 @@
+name 'acceptance-cookbook'
diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb
new file mode 100644
index 0000000000..f226ea2d10
--- /dev/null
+++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/destroy.rb
@@ -0,0 +1,3 @@
+execute 'bundle exec kitchen destroy' do
+ cwd node['chef-acceptance']['suite-dir']
+end
diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb
new file mode 100644
index 0000000000..2763aba70c
--- /dev/null
+++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/provision.rb
@@ -0,0 +1,3 @@
+execute 'bundle exec kitchen converge' do
+ cwd node['chef-acceptance']['suite-dir']
+end
diff --git a/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb
new file mode 100644
index 0000000000..c0b67bf500
--- /dev/null
+++ b/acceptance/windows-service/.acceptance/acceptance-cookbook/recipes/verify.rb
@@ -0,0 +1,3 @@
+execute 'bundle exec kitchen verify' do
+ cwd node['chef-acceptance']['suite-dir']
+end
diff --git a/acceptance/windows-service/.kitchen.yml b/acceptance/windows-service/.kitchen.yml
new file mode 100644
index 0000000000..4f269f9aa9
--- /dev/null
+++ b/acceptance/windows-service/.kitchen.yml
@@ -0,0 +1,26 @@
+driver:
+ name: vagrant
+ forward_agent: yes
+ customize:
+ cpus: 2
+ memory: 1024
+
+provisioner:
+ name: chef_zero
+
+verifier:
+ name: inspec
+
+platforms:
+ - name: windows-server-2012r2-standard
+ driver:
+ box: chef/windows-server-2012r2-standard # private
+ run_list:
+
+suites:
+ - name: chef-windows-service
+ provisioner:
+ product_name: chef
+ product_version: latest
+ channel: current
+ run_list:
diff --git a/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb b/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb
new file mode 100644
index 0000000000..a7d650ec79
--- /dev/null
+++ b/acceptance/windows-service/test/integration/chef-windows-service/inspec/chef_windows_service_spec.rb
@@ -0,0 +1,55 @@
+describe command("chef-service-manager") do
+ it { should exist }
+ its('exit_status') { should eq 0 }
+end
+
+
+describe service('chef-client') do
+ it { should_not be_enabled }
+ it { should_not be_installed }
+ it { should_not be_running }
+end
+
+describe command("chef-service-manager -a install") do
+ its('exit_status') { should eq 0 }
+ its(:stdout) { should match /Service 'chef-client' has successfully been installed./}
+end
+
+describe service('chef-client') do
+ it { should be_enabled }
+ it { should be_installed }
+ it { should_not be_running }
+end
+
+describe command("chef-service-manager -a start") do
+ its('exit_status') { should eq 0 }
+ its(:stdout) { should match /Service 'chef-client' is now 'running'/}
+end
+
+describe service('chef-client') do
+ it { should be_enabled }
+ it { should be_installed }
+ it { should be_running }
+end
+
+describe command("chef-service-manager -a stop") do
+ its('exit_status') { should eq 0 }
+ its(:stdout) { should match /Service 'chef-client' is now 'stopped'/}
+end
+
+describe service('chef-client') do
+ it { should be_enabled }
+ it { should be_installed }
+ it { should_not be_running }
+end
+
+describe command("chef-service-manager -a uninstall") do
+ its('exit_status') { should eq 0 }
+ its(:stdout) { should match /Service chef-client deleted/}
+end
+
+describe service('chef-client') do
+ it { should_not be_enabled }
+ it { should_not be_installed }
+ it { should_not be_running }
+end