Project

General

Profile

Download (1.28 KB) Statistics
| Branch: | Tag: | Revision:
90b83222 Ohad Levy
require 'test_helper'

class TFTPOrchestrationTest < ActiveSupport::TestCase
c6cd4b70 Dominic Cleal
setup :disable_orchestration

90b83222 Ohad Levy
def test_host_should_have_tftp
e895706f Paul Kelly
if unattended?
h = hosts(:one)
assert h.tftp?
6285a614 Ohad Levy
assert_not_nil h.tftp
e895706f Paul Kelly
end
90b83222 Ohad Levy
end

def test_host_should_not_have_tftp
e895706f Paul Kelly
if unattended?
h = hosts(:minimal)
6285a614 Ohad Levy
assert_equal false, h.tftp?
assert_equal nil, h.tftp
e895706f Paul Kelly
end
90b83222 Ohad Levy
end

1a68aea8 Greg Sutcliffe
def test_generate_pxe_template_for_build
e895706f Paul Kelly
if unattended?
h = hosts(:one)
c6cd4b70 Dominic Cleal
as_admin do
h.setBuild
0fa5d146 Dominic Cleal
h.update_attribute :operatingsystem, operatingsystems(:redhat)
c6cd4b70 Dominic Cleal
end
8c618ae8 Greg Sutcliffe
Setting[:unattended_url] = "http://ahost.com:3000"
b8c81182 Paul Kelly
017e1049 Ohad Levy
template = h.send(:generate_pxe_template).split("~")
b8c81182 Paul Kelly
expected = File.open(Pathname.new(__FILE__).parent + "pxe_template").readlines.map(&:strip)
assert_equal template,expected
1a68aea8 Greg Sutcliffe
assert h.build
end
end

def test_generate_pxe_template_for_localboot
if unattended?
h = hosts(:one)
as_admin { h.update_attribute :operatingsystem, operatingsystems(:centos5_3) }
assert !h.build

template = h.send(:generate_pxe_template).split("~")
expected = File.open(Pathname.new(__FILE__).parent + "pxe_local_template").readlines.map(&:strip)
assert_equal template,expected
80e0157c Paul Kelly
end
end
90b83222 Ohad Levy
end