fuel-library/deployment/puppet/osnailyfacter/modular/heat/heat_post.rb
Dmitry Ilyin 4296519bf6 Refactor pre/post modular tests
* Use common library for tests

Related blueprint: fuel-library-modularization
Fuel-CI: disable

Change-Id: I8769748ae79d5a1597eb0f320e0a0ed9581d5a0b
2015-03-24 22:40:32 +03:00

72 lines
2.2 KiB
Ruby

require File.join File.dirname(__FILE__), '../test_common.rb'
PROCESSES = %w(
heat-api
heat-api-cfn
heat-api-cloudwatch
heat-engine
)
BACKENDS = %w(
heat-api
heat-api-cfn
heat-api-cloudwatch
)
HOSTS = {
'public' => TestCommon::Settings.public_vip,
'management' => TestCommon::Settings.management_vip,
}
PORTS = {
'api' => 8004,
'api-cfn' => 8003,
'api-cloudwatch' => 8000,
}
class HeatPostTest < Test::Unit::TestCase
def self.create_tests
PROCESSES.each do |process|
method_name = "test_process_#{process}_running"
define_method method_name do
assert TestCommon::Process.running?(process), "Process '#{process}' is not running!"
end
end
BACKENDS.each do |backend|
method_name = "test_backend_#{backend}_online"
define_method method_name do
assert TestCommon::HAProxy.backend_up?(backend), "HAProxy backend '#{backend}' is not online!"
end
end
HOSTS.each do |host_type, ip|
PORTS.each do |port_type, port|
method_name = "test_#{host_type}_heat_#{port_type}_accessible"
define_method method_name do
url = "http://#{ip}:#{port}"
assert TestCommon::Network.url_accessible?(url), "URL '#{url}' is unaccessible?"
end
end
end
def test_heat_stack_list_run
assert TestCommon::Process.run_successful?('. /root/openrc && heat stack-list'), 'Could not run heat-stack list!'
end
def test_heat_trusts_present
assert TestCommon::Config.value?('/etc/heat/heat.conf', 'deferred_auth_method', 'trusts'), 'deferred_auth_method is not found in heat.conf'
assert TestCommon::Config.value?('/etc/heat/heat.conf', 'trusts_delegated_roles', ''), 'trusts_delegated_roles is not found in heat.conf'
end
def test_heat_domain_present
password = TestCommon::Settings.heat['user_password']
assert TestCommon::Config.value?('/etc/heat/heat.conf', 'stack_domain_admin', 'heat_admin'), 'stack_domain_admin is not found in heat.conf'
assert TestCommon::Config.value?('/etc/heat/heat.conf', 'stack_domain_admin_password', password), 'stack_domain_admin_password is not found in heat.conf'
end
end
end
HeatPostTest.create_tests