cookbook-openstack-network/spec/dhcp_agent-centos_spec.rb
Jan Klare 2ec770de11 refactoring final step
* added new logic to render plugin templates
* refactored recipe names to be more consistence
* moved version up to 13.0.0 for mitaka release
* removed suse as supported platform
* added verisionbumb for refactored os-identity and common
* adapted optimized endpoint logic
* added endpoint attributes to fit new endpoint logic
* adapted the specs (unit tests) to work again
* refactored attributes throughout all recipes that were connected to the
  attributes used for the neutron.conf.erb template to adapt the new template
  attribute syntax
* removed some attributes that were set to non default values, since the
  defaults from neutron cloud and should be used instead
* moved all attributes form attributes/default.rb that were used in
  neutron.conf.erb to attributes/neutron_conf.rb
* refactored attributes to fit new template logic
* refactored recipes/default.rb to fit new template logic
* removed all attributes set to default values in attribtues/default and
  template
* replaced static plugin logic and templates with new config logic, following
  the same principles as for neutron.conf
* renamed recipes to fit attributes and actual service names
* added recipes for ml2_core_plugin, ml2_openvswitch and ml2_linuxbridge as well
  as a recipe for the creation of all plugin configs (plugin_conf) like plugin.ini

Change-Id: I9cc1b5cc069987ac83e064322c2291772505ff5f
Implements: blueprint cookbook-refactoring
Depends-On: I0547182085eed91d05384fdd7734408a839a9a2c
Depends-On: I3262b2e6f792f37c32a446e6567790b82bdd4613
2016-02-08 10:44:13 +01:00

72 lines
2.3 KiB
Ruby

# Encoding: utf-8
require_relative 'spec_helper'
describe 'openstack-network::dhcp_agent' do
describe 'centos' do
let(:runner) { ChefSpec::SoloRunner.new(CENTOS_OPTS) }
let(:node) { runner.node }
cached(:chef_run) do
node.set['openstack']['compute']['network']['service_type'] = 'neutron'
runner.converge(described_recipe)
end
let(:file_cache_path) { Chef::Config[:file_cache_path] }
include_context 'neutron-stubs'
it 'upgrades neutron dhcp package' do
expect(chef_run).to upgrade_package('openstack-neutron')
end
it 'upgrades plugin packages' do
expect(chef_run).not_to upgrade_package(/openvswitch/)
expect(chef_run).not_to upgrade_package(/plugin/)
end
it 'starts the dhcp agent on boot' do
expect(chef_run).to enable_service('neutron-dhcp-agent')
end
it 'should have the correct dnsmasq remote file' do
expect(chef_run).to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64").with(source: 'http://pkgs.repoforge.org/dnsmasq/dnsmasq-2.65-1.el6.rfx.x86_64.rpm')
end
it 'should install the corrcet dnsmasq rpm' do
expect(chef_run).to install_rpm_package('dnsmasq').with(source: "#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64")
end
it 'should notify dhcp agent to restart immediately' do
expect(chef_run.rpm_package('dnsmasq')).to notify('service[neutron-dhcp-agent]').to(:restart).delayed
end
it 'should not have the correct dnsmasq remote file when no version' do
node.set['openstack']['network']['dnsmasq']['rpm_version'] = ''
expect(chef_run).not_to create_remote_file("#{Chef::Config[:file_cache_path]}/2.65-1.el6.rfx.x86_64")
end
describe '/etc/neutron/dhcp_agent.ini' do
let(:file) { chef_run.template('/etc/neutron/dhcp_agent.ini') }
it 'creates dhcp_agent.ini' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
end
describe '/etc/neutron/dnsmasq.conf' do
let(:file) { chef_run.template('/etc/neutron/dnsmasq.conf') }
it 'creates dnsmasq.conf' do
expect(chef_run).to create_template(file.name).with(
user: 'neutron',
group: 'neutron',
mode: 0644
)
end
end
end
end