foreman/test/unit/orchestration/dns_test.rb @ 21e07e92
90b83222 | Ohad Levy | require 'test_helper'
|
|
class DnsOrchestrationTest < ActiveSupport::TestCase
|
|||
acb50a39 | Ohad Levy | def setup
|
|
disable_orchestration
|
|||
end
|
|||
90b83222 | Ohad Levy | def test_host_should_have_dns
|
|
e895706f | Paul Kelly | if unattended?
|
|
h = hosts(:one)
|
|||
assert h.valid?
|
|||
assert h.dns?
|
|||
dd42df0a | Ohad Levy | assert h.reverse_dns?
|
|
acb50a39 | Ohad Levy | assert_not_nil h.dns_a_record
|
|
assert_not_nil h.dns_ptr_record
|
|||
e895706f | Paul Kelly | end
|
|
90b83222 | Ohad Levy | end
|
|
dd42df0a | Ohad Levy | def test_host_should_have_dns_but_not_ptr
|
|
if unattended?
|
|||
h = hosts(:one)
|
|||
h.subnet = nil
|
|||
assert h.valid?
|
|||
assert h.dns?
|
|||
assert !h.reverse_dns?
|
|||
assert_not_nil h.dns_a_record
|
|||
assert_nil h.dns_ptr_record
|
|||
end
|
|||
end
|
|||
90b83222 | Ohad Levy | def test_host_should_not_have_dns
|
|
e895706f | Paul Kelly | if unattended?
|
|
h = hosts(:minimal)
|
|||
assert h.valid?
|
|||
dd42df0a | Ohad Levy | assert !h.dns?
|
|
assert !h.reverse_dns?
|
|||
acb50a39 | Ohad Levy | assert_equal nil, h.dns_a_record
|
|
assert_equal nil, h.dns_ptr_record
|
|||
e895706f | Paul Kelly | end
|
|
90b83222 | Ohad Levy | end
|
|
dd42df0a | Ohad Levy | ||
def test_host_should_not_have_dns_but_should_have_ptr
|
|||
if unattended?
|
|||
h = hosts(:minimal)
|
|||
h.subnet = subnets(:one)
|
|||
h.managed = true
|
|||
assert h.valid?
|
|||
assert !h.dns?
|
|||
assert h.reverse_dns?
|
|||
assert_equal nil, h.dns_a_record
|
|||
assert_not_nil h.dns_ptr_record
|
|||
end
|
|||
end
|
|||
21e07e92 | Trey Dockendorf | ||
def test_bmc_should_have_valid_dns_records
|
|||
if unattended?
|
|||
b = nics(:bmc)
|
|||
b.domain = domains(:mydomain)
|
|||
b.subnet = subnets(:five)
|
|||
assert b.dns?
|
|||
assert b.reverse_dns?
|
|||
assert_equal "#{b.name}.#{b.domain.name}/#{b.ip}", b.dns_a_record.to_s
|
|||
assert_equal "#{b.ip}/#{b.name}.#{b.domain.name}", b.dns_ptr_record.to_s
|
|||
end
|
|||
end
|
|||
90b83222 | Ohad Levy | end
|