Skip to content

Commit

Permalink
(MODULES-6744) Add testmode to tests
Browse files Browse the repository at this point in the history
This commit converts the tests to use beaker-testmode-switcher.
  • Loading branch information
jpogran committed Mar 15, 2018
1 parent 3cd9954 commit 30c34ca
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
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

0 comments on commit 30c34ca

Please sign in to comment.