puppet-manila/spec/defines/manila_service_instance_spec.rb
Gael Chamoulaud d60db0c73e Spec: updates for rspec-puppet 2.x and rspec 3.x
This patch aim to update our specs test in order to work with the new
rspec-puppet release 2.0.0, in the mean time, we update rspec syntax
in order to be prepared for rspec 3.x move.

In details:

* Convert 'should' keyword to 'is_expected.to' (prepare rspec 3.x)
* Upgrade and pin rspec-puppet from 1.0.1 to 2.0.0
* Clean Gemfile (remove over-specificication of runtime deps of puppetlabs_spec_helper)

Change-Id: I062afe69fea8acb4785c537df7400d9c5d7034b4
Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2015-03-15 17:24:02 +01:00

53 lines
1.9 KiB
Ruby

require 'spec_helper'
describe 'manila::service_instance' do
let(:title) {'DEFAULT'}
let :params do
{
:service_instance_name_template => 'manila_service_instance_%s',
:service_instance_user => 'user1',
:service_instance_password => 'pass1',
:manila_service_keypair_name => 'manila-service',
:path_to_public_key => '~/.ssh/id_rsa.pub',
:path_to_private_key => '~/.ssh/id_rsa',
:max_time_to_build_instance => 300,
:service_instance_security_group => 'manila-service',
:service_instance_flavor_id => 1,
:service_network_name => 'manila_service_network',
:service_network_cidr => '10.254.0.0/16',
:service_network_division_mask => 28,
:interface_driver => 'manila.network.linux.interface.OVSInterfaceDriver',
:connect_share_server_to_tenant_network => false,
}
end
context 'with default parameters' do
it 'configures service instance' do
expect {
params.each_pair do |config,value|
is_expected.to contain_manila_config("DEFAULT/#{config}").with_value( value )
end
}.to raise_error(Puppet::Error, /Missing required parameter service_image_location/)
end
end
context 'with service image provided' do
let (:req_params) { params.merge!({
:service_image_name => 'manila-service-image',
:service_image_location => 'http://example.com/manila_service_image.iso',
}) }
it 'creates Glance image' do
is_expected.to contain_glance_image(req_params[:service_image_name]).with(
:ensure => 'present',
:is_public => 'yes',
:container_format => 'bare',
:disk_format => 'qcow2',
:source => req_params[:service_image_location]
)
end
end
end