summaryrefslogtreecommitdiff
path: root/kitchen-tests
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-10-12 20:59:49 -0700
committerTim Smith <tsmith84@gmail.com>2020-10-12 21:06:49 -0700
commitc30554c2e59cb80623b6d5db4614cabc14ef2dd9 (patch)
treedbdbfc242aa417b48d7c616547ba6ae7c7dcbdd0 /kitchen-tests
parentb93860e919d2fa2c6a878ac78140c1ef25036942 (diff)
downloadchef-c30554c2e59cb80623b6d5db4614cabc14ef2dd9.tar.gz
Dry up testing a bit
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'kitchen-tests')
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_config.rb11
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/linux.rb13
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/macos.rb13
-rw-r--r--kitchen-tests/cookbooks/end_to_end/recipes/windows.rb13
-rw-r--r--kitchen-tests/test/integration/end-to-end/_chef_client_config.rb (renamed from kitchen-tests/test/integration/end-to-end/default_spec.rb)2
5 files changed, 15 insertions, 37 deletions
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_config.rb b/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_config.rb
new file mode 100644
index 0000000000..0e68582af0
--- /dev/null
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/_chef_client_config.rb
@@ -0,0 +1,11 @@
+chef_client_config "Create chef-client's client.rb" do
+ chef_server_url "https://localhost"
+ chef_license "accept"
+ additional_config <<~CONFIG
+ begin
+ require 'aws-sdk'
+ rescue LoadError
+ Chef::Log.warn "Failed to load aws-sdk."
+ end
+ CONFIG
+end
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
index 4e096b1daa..0d560b09bd 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/linux.rb
@@ -83,20 +83,9 @@ user_ulimit "tomcat" do
rtprio_hard_limit 60
end
+include_recipe "::_chef_client_config"
include_recipe "::_chef_client_trusted_certificate"
-chef_client_config "Create chef-client's client.rb" do
- chef_server_url "https://localhost"
- chef_license "accept"
- additional_config <<~CONFIG
- begin
- require 'aws-sdk'
- rescue LoadError
- Chef::Log.warn "Failed to load aws-sdk."
- end
- CONFIG
-end
-
chef_client_cron "Run chef-client as a cron job"
chef_client_cron "Run chef-client with base recipe" do
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
index 8307351ad7..ff68021a81 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/macos.rb
@@ -39,20 +39,9 @@ end
ssh_known_hosts_entry "github.com"
+include_recipe "::_chef_client_config"
include_recipe "::_chef_client_trusted_certificate"
-chef_client_config "Create chef-client's client.rb" do
- chef_server_url "https://localhost"
- chef_license "accept"
- additional_config <<~CONFIG
- begin
- require 'aws-sdk'
- rescue LoadError
- Chef::Log.warn "Failed to load aws-sdk."
- end
- CONFIG
-end
-
chef_client_launchd "Every 30 mins Infra Client run" do
interval 30
action :enable
diff --git a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
index 486d680a3f..58ccec9b26 100644
--- a/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
+++ b/kitchen-tests/cookbooks/end_to_end/recipes/windows.rb
@@ -79,18 +79,7 @@ users_manage "create sysadmin" do
action [:create]
end
-chef_client_config "Create chef-client's client.rb" do
- chef_server_url "https://localhost"
- chef_license "accept"
- additional_config <<~CONFIG
- begin
- require 'aws-sdk'
- rescue LoadError
- Chef::Log.warn "Failed to load aws-sdk."
- end
- CONFIG
-end
-
+include_recipe "::_chef_client_config"
include_recipe "::_chef_client_trusted_certificate"
include_recipe "git"
diff --git a/kitchen-tests/test/integration/end-to-end/default_spec.rb b/kitchen-tests/test/integration/end-to-end/_chef_client_config.rb
index 3a0848a7e9..7e0cc3fd15 100644
--- a/kitchen-tests/test/integration/end-to-end/default_spec.rb
+++ b/kitchen-tests/test/integration/end-to-end/_chef_client_config.rb
@@ -8,4 +8,4 @@ describe file(client_rb) do
its("content") { should match(%r{chef_server_url = "https://localhost"}) }
its("content") { should match(/chef_license = "accept"/) }
its("content") { should match(/require 'aws-sdk'/) }
-endx
+end