Weidong Shao 486c596323 Replace cookbooks for IceHouse release
Change-Id: Ibb6bdd3ed7795b86f773f9cb6ce1dfffb9b79faf
2014-08-07 08:36:02 +00:00

68 lines
2.0 KiB
Ruby

# encoding: UTF-8
require 'chefspec'
require 'chefspec/berkshelf'
ChefSpec::Coverage.start! { add_filter 'openstack-dashboard' }
LOG_LEVEL = :fatal
FEDORA_OPTS = {
platform: 'fedora',
version: '18',
log_level: LOG_LEVEL
}
REDHAT_OPTS = {
platform: 'redhat',
version: '6.5',
log_level: LOG_LEVEL
}
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '12.04',
log_level: LOG_LEVEL
}
SUSE_OPTS = {
platform: 'suse',
version: '11.03',
log_level: LOG_LEVEL
}
shared_context 'dashboard_stubs' do
before do
Chef::Recipe.any_instance.stub(:memcached_servers)
.and_return ['hostA:port', 'hostB:port']
Chef::Recipe.any_instance.stub(:get_password)
.with('db', 'horizon')
.and_return('test-passes')
end
end
shared_context 'redhat_stubs' do
before do
stub_command("[ ! -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*enforcing') -eq 1 ]").and_return(true)
stub_command("[ -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*permissive') -eq 1 ] && [ $(/sbin/sestatus | grep -c '^Mode from config file:.*enforcing') -eq 1 ]").and_return(true)
end
end
shared_context 'non_redhat_stubs' do
before do
stub_command("[ ! -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*enforcing') -eq 1 ]").and_return(false)
stub_command("[ -e /etc/httpd/conf/httpd.conf ] && [ -e /etc/redhat-release ] && [ $(/sbin/sestatus | grep -c '^Current mode:.*permissive') -eq 1 ] && [ $(/sbin/sestatus | grep -c '^Mode from config file:.*enforcing') -eq 1 ]").and_return(false)
end
end
shared_context 'postgresql_backend' do
before do
Chef::Recipe.any_instance.stub(:db)
.with('dashboard')
.and_return('service_type' => 'postgresql', 'db_name' => 'flying_elephant')
end
end
shared_context 'mysql_backend' do
before do
Chef::Recipe.any_instance.stub(:db)
.with('dashboard')
.and_return('service_type' => 'mysql', 'db_name' => 'flying_dolphin')
end
end