-
Notifications
You must be signed in to change notification settings - Fork 495
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(FACT-2817) Add acceptance test for session cache.
- Loading branch information
BogdanIrimie
committed
Oct 8, 2020
1 parent
a8b1a27
commit bb6357e
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
acceptance/tests/session_cached_is_not_refershed_in_session.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
test_name 'facter should not update it`s session cache in same session' do | ||
tag 'risk:high' | ||
|
||
fact_content = <<-EOM | ||
require 'facter' | ||
seconds_before = Facter.value('system_uptime.seconds') | ||
sleep(3) | ||
seconds_after = Facter.value('system_uptime.seconds') | ||
puts seconds_before == seconds_after | ||
EOM | ||
|
||
agents.each do |agent| | ||
fact_dir = agent.tmpdir('test_scripts') | ||
script_path = File.join(fact_dir, 'session_test.rb') | ||
create_remote_file(agent, script_path, fact_content) | ||
|
||
teardown do | ||
agent.rm_rf(script_path) | ||
end | ||
|
||
on(agent, "#{ruby_command(agent)} #{script_path}") do |ruby_result| | ||
assert_equal('true', ruby_result.stdout.chomp, 'Expect the session cache is not reset in same session') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,6 @@ | |
Facter.add(:my_custom_fact) do | ||
has_weight(10_000) | ||
setcode do | ||
# 'my_custom_fact' | ||
Facter.value('os') | ||
end | ||
end |