Jira (FACT-2370) Unreliable unit tests on facter-ng

2 views
Skip to first unread message

Gheorghe Popescu (JIRA)

unread,
Feb 18, 2020, 7:50:04 AM2/18/20
to puppe...@googlegroups.com
Gheorghe Popescu created an issue
 
Facter / Task FACT-2370
Unreliable unit tests on facter-ng
Issue Type: Task Task
Assignee: Unassigned
Created: 2020/02/18 4:49 AM
Priority: Normal Normal
Reporter: Gheorghe Popescu

The facts in `rspec spec/facter/facter_spec.rb` are coupled and depend on each other

running rspec spec/facter/facter_spec.rb all the tests pass but with an error messaged logged:

 
❯ rspec spec/facter/facter_spec.rb
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
 
Facter
 #to_hash
 returns one resolved fact
 return no resolved facts
 #to_user_output
 returns one fact and status 0
 returns no facts and status 0
 --strict
[2020-02-18 14:47:51.327079 ] ERROR Module - fact "os.name" does not exist.
 returns no fact and status 1
 returns one fact and status 0
 #value
 returns a value
 return no value
 #fact
 returns a fact
 return no value
 #[]
 returns a fact
 return no value
 #core_value
 searched in core facts and returns a value
 searches ion core facts and return no value
 #clear
 sends call to LegacyFacter
 #search
 sends call to LegacyFacter
 #search_path
 sends call to LegacyFacter
 #search_external
 sends call to LegacyFacter
 #search_external_path
 sends call to LegacyFacter
 #reset
 sends call to LegacyFacter
 #trace
 sends call to LegacyFacter
 #trace?
 sends call to LegacyFacter
 #debug
 when log level is debug
 logs a debug message
 when log level is not debug
 doesn't log anything
 #debugging
 sets log level to debug
 #debugging?
 returns that log_level is not debug
 
Finished in 0.07146 seconds (files took 0.49457 seconds to load)
26 examples, 0 failures

running a subset of tests, eg rspec spec/facter/facter_spec.rb:71 tests will fail

 
❯ rspec spec/facter/facter_spec.rb:71
[Coveralls] Set up the SimpleCov formatter.
[Coveralls] Using SimpleCov's default settings.
Run options: include \{:locations=>{"./spec/facter/facter_spec.rb"=>[71]}}
 
Facter
 #to_user_output
 --strict
 returns no fact and status 1 (FAILED - 1)
 returns one fact and status 0 (FAILED - 2)
 
Failures:
 
1) Facter #to_user_output --strict returns no fact and status 1
 Failure/Error: @block_list = ConfigReader.new(options[:config]).block_list || {}
 
#<Facter::Options:0x00007fe3128212f0 @options=\{:debug=>false, :trace=>true, :verbose=>false, :log_level=>:warn, :show_legacy=>false, :custom_facts=>false, :custom_dir=>["./custom-facts", "./custom-facts2"], :external_facts=>true, :external_dir=>["./external-facts"], :ruby=>true, :config=>nil}, @priority_options={}, @user_query=["os.name"]> received :[] with unexpected arguments
 expected: (:strict)
 got: (:config)
 Diff:
 @@ -1,2 +1,2 @@
 -[:strict]
 +[:config]
 
Please stub a default value first if message might be received with other args as well.
 # ./lib/framework/config/block_list.rb:32:in `load_block_groups'
 # ./lib/framework/config/block_list.rb:11:in `initialize'
 # ./lib/framework/core/options/config_file_options.rb:59:in `augment_facts'
 # ./lib/framework/core/options/config_file_options.rb:14:in `augment_with_config_file_options!'
 # ./lib/framework/core/options.rb:63:in `initialize_options'
 # ./lib/framework/core/options.rb:21:in `refresh'
 # ./lib/facter.rb:112:in `to_user_output'
 # ./spec/facter/facter_spec.rb:85:in `block (4 levels) in <top (required)>'
 
2) Facter #to_user_output --strict returns one fact and status 0
 Failure/Error: @block_list = ConfigReader.new(options[:config]).block_list || {}
 
#<Facter::Options:0x00007fe3128212f0 @options=\{:debug=>false, :trace=>true, :verbose=>false, :log_level=>:warn, :show_legacy=>false, :custom_facts=>false, :custom_dir=>["./custom-facts", "./custom-facts2"], :external_facts=>true, :external_dir=>["./external-facts"], :ruby=>true, :config=>nil}, @priority_options={}, @user_query=["os.name"]> received :[] with unexpected arguments
 expected: (:strict)
 got: (:config)
 Diff:
 @@ -1,2 +1,2 @@
 -[:strict]
 +[:config]
 
Please stub a default value first if message might be received with other args as well.
 # ./lib/framework/config/block_list.rb:32:in `load_block_groups'
 # ./lib/framework/config/block_list.rb:11:in `initialize'
 # ./lib/framework/core/options/config_file_options.rb:59:in `augment_facts'
 # ./lib/framework/core/options/config_file_options.rb:14:in `augment_with_config_file_options!'
 # ./lib/framework/core/options.rb:63:in `initialize_options'
 # ./lib/framework/core/options.rb:21:in `refresh'
 # ./lib/facter.rb:112:in `to_user_output'
 # ./spec/facter/facter_spec.rb:101:in `block (4 levels) in <top (required)>'
 
Finished in 0.02915 seconds (files took 0.4897 seconds to load)
2 examples, 2 failures
 
Failed examples:
 
rspec ./spec/facter/facter_spec.rb:72 # Facter #to_user_output --strict returns no fact and status 1
rspec ./spec/facter/facter_spec.rb:89 # Facter #to_user_output --strict returns one fact and status 0

 

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages