8a1cd803f7
Based on the change in Keystone Install Guide [1], this patch replace port 35357 with 5000 for "auth_url". For more details, please check similar changes which have been done on other projects: Nova [2], Neutron [3], Cinder [4], Glance [5]. [1] https://review.openstack.org/#/c/541857 [2] https://review.openstack.org/#/c/562812 [3] https://review.openstack.org/#/c/566491 [4] https://review.openstack.org/#/c/565464 [5] https://review.openstack.org/#/c/558932 Change-Id: Icc0060e5df9dc3d0bc6a29fc8249ed3b37435b9d
72 lines
2.4 KiB
Ruby
72 lines
2.4 KiB
Ruby
require 'puppet'
|
|
require 'spec_helper'
|
|
require 'puppet/provider/neutron_security_group/openstack'
|
|
|
|
provider_class = Puppet::Type.type(:neutron_security_group).provider(:openstack)
|
|
|
|
describe provider_class do
|
|
|
|
let(:set_env) do
|
|
ENV['OS_USERNAME'] = 'admin'
|
|
ENV['OS_PASSWORD'] = 'password'
|
|
ENV['OS_PROJECT_NAME'] = 'admin_tenant'
|
|
ENV['OS_AUTH_URL'] = 'https://192.168.56.210:5000/v2.0/'
|
|
end
|
|
|
|
before(:each) do
|
|
set_env
|
|
end
|
|
|
|
describe 'managing security group' do
|
|
let(:sec_group_attrs) do
|
|
{
|
|
:name => 'example',
|
|
:id => '593db854-a47d-411e-a894-66bf90959768',
|
|
:description => 'test',
|
|
:project => '1a2b3c',
|
|
:project_domain => 'Default',
|
|
:ensure => 'present',
|
|
}
|
|
end
|
|
|
|
let :resource do
|
|
Puppet::Type::Neutron_security_group.new(sec_group_attrs)
|
|
end
|
|
|
|
let(:provider) do
|
|
provider_class.new(resource)
|
|
end
|
|
|
|
describe '#create' do
|
|
it 'creates security group' do
|
|
provider.class.stubs(:openstack)
|
|
.with('security group', 'list', ['--all'])
|
|
.returns('"ID", "Name", "Description", "Project"')
|
|
provider.class.stubs(:openstack)
|
|
.with('security group', 'create', 'shell', ['example', 'description', 'test', 'project', '1a2b3c', 'project_domain', 'Default'])
|
|
.returns('created_at="2017-03-15T09:32:03Z"
|
|
description="test"
|
|
headers=""
|
|
id="593db854-a47d-411e-a894-66bf90959768"
|
|
name="example"
|
|
project_id="1a2b3c"
|
|
project_id="1a2b3c"
|
|
revision_number="1"
|
|
rules="created_at=\'2017-03-15T09:32:03Z\', direction=\'egress\', ethertype=\'IPv4\', id=\'cf462eac-821e-4583-8e91-3294d5be5cce\', project_id=\'1a2b3c\', revision_number=\'1\', updated_at=\'2017-03-15T09:32:03Z\'
|
|
created_at=\'2017-03-15T09:32:03Z\', direction=\'egress\', ethertype=\'IPv6\', id=\'afac00e8-4fec-4a1e-8faa-43e2278a0d79\', project_id=\'1a2b3c\', revision_number=\'1\', updated_at=\'2017-03-15T09:32:03Z\'"
|
|
updated_at="2017-03-15T09:32:03Z"')
|
|
end
|
|
end
|
|
|
|
describe '#destroy' do
|
|
it 'removes security group' do
|
|
provider_class.expects(:openstack)
|
|
.with('security group', 'delete', '593db854-a47d-411e-a894-66bf90959768')
|
|
provider.instance_variable_set(:@property_hash, sec_group_attrs)
|
|
provider.destroy
|
|
expect(provider.exists?).to be_falsey
|
|
end
|
|
end
|
|
end
|
|
end
|