Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(FACT-2826) Added Facter.flush #2140

Merged
merged 1 commit into from
Oct 20, 2020

Conversation

sebastian-miclea
Copy link
Contributor

Facter flush sets the resolved value to nil without restarting the resolution. Besides that flushing can be hooked using on_flush in custom facts.

@sebastian-miclea sebastian-miclea added the maintenance Maintenance chores are excluded from changelogs label Oct 14, 2020
@sebastian-miclea sebastian-miclea requested review from a team October 14, 2020 20:02
@puppetcla
Copy link

CLA signed by all contributors.

@sebastian-miclea
Copy link
Contributor Author

Jenkins please test this on all

@sebastian-miclea sebastian-miclea force-pushed the FACT-2826 branch 2 times, most recently from debfc2c to 5d225e6 Compare October 18, 2020 19:33

Facter.flush

puts "Fact1: \#\{Facter.value(:fact)\}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are asking for a fact that doesn't exist

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, missed that. Thanks

@@ -403,6 +403,20 @@ def mock_collection(method, os_name = nil, error = nil)
end
end

describe '#flush' do
it 'sends call to LegacyFacter' do
allow(LegacyFacter).to receive(:flush)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unit test should be separated according to the AAA pattern (Arrange, Act, Assert).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. Thanks!

@Filipovici-Andrei Filipovici-Andrei merged commit 8fdf1b5 into puppetlabs:main Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance Maintenance chores are excluded from changelogs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants