Revision 16701e6b
Added by Dominik Matoulek over 2 years ago
test/unit/foreman_salt/salt_fact_parser_test.rb | ||
---|---|---|
class SaltFactsParserTest < ActiveSupport::TestCase
|
||
def setup
|
||
grains = JSON.parse(File.read(File.join(Rails.root, 'test', 'static_fixtures', 'facts', 'grains_centos.json')))
|
||
@facts_parser = FactParser.new grains["facts"]
|
||
@facts_parser = ForemanSalt::FactParser.new grains["facts"]
|
||
User.current = users :admin
|
||
end
|
||
|
||
... | ... | |
assert_equal 'CentOS 6.5', os.title
|
||
end
|
||
|
||
test "should identify CentOS Stream correctly" do
|
||
facts = HashWithIndifferentAccess.new(read_json_fixture("facts/salt_centos_stream.json"))
|
||
parser = ForemanSalt::FactParser.new(facts)
|
||
os = parser.operatingsystem
|
||
|
||
assert os.present?
|
||
assert_equal 'CentOS_Stream', os.name
|
||
assert_equal '8', os.major
|
||
assert_empty os.minor
|
||
end
|
||
|
||
test "should identify CentOS 8 correctly" do
|
||
facts = HashWithIndifferentAccess.new(read_json_fixture("facts/salt_centos_8.json"))
|
||
parser = ForemanSalt::FactParser.new(facts)
|
||
os = parser.operatingsystem
|
||
|
||
assert os.present?
|
||
assert_equal 'CentOS', os.name
|
||
assert_equal '8', os.major
|
||
assert_equal '4.2105', os.minor
|
||
end
|
||
|
||
test "should set domain correctly" do
|
||
domain = @facts_parser.domain
|
||
assert domain.present?
|
Also available in: Unified diff
Fixes #33470 - Adding support for CentOS Stream
The facts from Stream has not yet supported in Foreman. This PR adds correct recognition for all parsers.