Skip to content

Commit

Permalink
Merge pull request #158 from jpogran/MODULES-6744-add-testmode-switcher
Browse files Browse the repository at this point in the history
(MODULES-6744) Add testmode switcher
  • Loading branch information
Iristyle authored Mar 15, 2018
2 parents 4edaf0e + 30c34ca commit ef2f83e
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 19 deletions.
6 changes: 6 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
---
Rakefile:
unmanaged: true
Gemfile:
optional:
':system_tests':
- gem: beaker-testmode_switcher
version: '~> 0.4'
- gem: master_manipulator
spec/spec_helper.rb:
unmanaged: true
appveyor.yml:
Expand Down
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,9 @@ group :system_tests do
gem "beaker-pe", :require => false
gem "beaker-rspec", *location_for(ENV['BEAKER_RSPEC_VERSION'])
gem "beaker-hostgenerator", *location_for(ENV['BEAKER_HOSTGENERATOR_VERSION'])
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-abs", *location_for(ENV['BEAKER_ABS_VERSION'] || '~> 0.1')
gem "beaker-testmode_switcher", '~> 0.4', :require => false
gem 'master_manipulator', :require => false
gem "puppet-blacksmith", '~> 3.4', :require => false
end

Expand Down
14 changes: 7 additions & 7 deletions spec/acceptance/should_create_key_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@
]

windows_agents.each do |agent|
keys_created = keys_created_native + (is_x64(agent) ? keys_created_wow : [])
values_purged = values_purged_native + (is_x64(agent) ? values_purged_wow : [])
agent_is_x64 = is_x64(agent)
keys_created = keys_created_native + (agent_is_x64 ? keys_created_wow : [])
values_purged = values_purged_native + (agent_is_x64 ? values_purged_wow : [])

it 'Registry - Phase 1.a - Create some keys' do
apply_manifest_on(agent, phase1, get_apply_opts) do
execute_manifest_on(agent, phase1, get_apply_opts) do
keys_created.each do |key_re|
assert_match(key_re, @result.stdout, "Expected #{key_re.inspect} to match the output. (First Run)")
end
Expand All @@ -116,7 +117,7 @@

it 'Registry - Phase 1.b - Make sure Puppet is idempotent' do
# Do a second run and make sure the key isn't created a second time.
apply_manifest_on(agent, phase1, get_apply_opts) do
execute_manifest_on(agent, phase1, get_apply_opts) do
keys_created.each do |key_re|
assert_no_match(key_re, @result.stdout,
"Expected #{key_re.inspect} NOT to match the output. (First Run)")
Expand All @@ -126,7 +127,7 @@
end

it 'Registry - Phase 2 - Make sure purge_values works' do
apply_manifest_on(agent, phase2, get_apply_opts({'FACTER_FACT_PHASE' => '2'})) do
execute_manifest_on(agent, phase2, get_apply_opts({'FACTER_FACT_PHASE' => '2'})) do
values_purged.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -135,11 +136,10 @@
end

it 'Registry - Phase 3 - Should clean up' do
apply_manifest_on(agent, phase3, get_apply_opts({'FACTER_FACT_PHASE' => '3'})) do
execute_manifest_on(agent, phase3, get_apply_opts({'FACTER_FACT_PHASE' => '3'})) do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
end
end
end
end
end

9 changes: 4 additions & 5 deletions spec/acceptance/should_have_defined_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]
windows_agents.each do |agent|
it 'Phase 1.a - Create some values' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
phase1_resources_created.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -60,7 +60,7 @@
end

it 'Phase 1.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do
phase1_resources_created.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output not to contain #{val_re.inspect}.")
end
Expand All @@ -69,7 +69,7 @@
end

it 'Phase 2.a - Change some values' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
phase2_resources_changed.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -78,7 +78,7 @@
end

it 'Phase 2.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
execute_manifest_on agent, manifest, get_apply_opts({'FACTER_FACT_PHASE' => '2'}) do
(phase1_resources_created + phase2_resources_changed).each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output not to contain #{val_re.inspect}.")
end
Expand All @@ -88,4 +88,3 @@
end
end
end

9 changes: 4 additions & 5 deletions spec/acceptance/should_manage_values_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ def getManifest(keypath, vendor_path, phase)


it 'Registry Values - Phase 1.a - Create some values' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
phase1_resources_created.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
Expand All @@ -278,7 +278,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 1.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '1'), get_apply_opts do
phase1_resources_created.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -287,7 +287,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 2.a - Change some values' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
assert_no_match(/err:/, @result.stdout, 'Expected no error messages.')
phase2_resources_changed.each do |val_re|
assert_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
Expand All @@ -296,7 +296,7 @@ def getManifest(keypath, vendor_path, phase)
end

it 'Registry Values - Phase 2.b - Make sure Puppet is idempotent' do
apply_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
execute_manifest_on agent, getManifest(keypath, vendor_path, '2'), get_apply_opts do
phase2_resources_changed.each do |val_re|
assert_no_match(val_re, @result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand All @@ -321,4 +321,3 @@ def getManifest(keypath, vendor_path, phase)
end
end
end

2 changes: 1 addition & 1 deletion spec/acceptance/should_tolerate_mixed_case_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
end

it "Registry Tolerate Mixed Case Values - Phase 1.a - Create some values" do
apply_manifest_on agent, phase1, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do |result|
execute_manifest_on agent, phase1, get_apply_opts({'FACTER_FACT_PHASE' => '1'}) do |result|
phase1_resources_created.each do |val_re|
assert_match(val_re, result.stdout, "Expected output to contain #{val_re.inspect}.")
end
Expand Down
2 changes: 2 additions & 0 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
require 'beaker-rspec'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'
require 'beaker/testmode_switcher'
require 'beaker/testmode_switcher/dsl'

run_puppet_install_helper

Expand Down

0 comments on commit ef2f83e

Please sign in to comment.