Setting up repo for master Juno branch
* Update metadata versions * Updates for icehouse specific attributes * Removing Strainer file * Updating Gems * chef (11.12.0) * chefspec (4.0.0) * rspec (3.0.0) * Cleanup specs for 4.x Change-Id: I9a495cdb90feaf7508a5b861557856dd19340272 Partial-Bug: 1349865
This commit is contained in:
parent
50d11569ad
commit
abd313ac8d
@ -1,6 +1,8 @@
|
|||||||
# CHANGELOG for cookbook-openstack-common
|
# CHANGELOG for cookbook-openstack-common
|
||||||
|
|
||||||
This file is used to list changes made in each version of cookbook-openstack-common.
|
This file is used to list changes made in each version of cookbook-openstack-common.
|
||||||
|
## 10.0.0
|
||||||
|
* Upgrading to Juno
|
||||||
|
|
||||||
## 9.7.0
|
## 9.7.0
|
||||||
* Add new network_uuid cli library method for obtaining ID from various neutron resources
|
* Add new network_uuid cli library method for obtaining ID from various neutron resources
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
# Strainerfile
|
|
||||||
rubocop: rubocop $SANDBOX/$COOKBOOK
|
|
||||||
knife test: knife cookbook test $COOKBOOK
|
|
||||||
foodcritic: foodcritic -f any -t ~FC003 -t ~FC023 $SANDBOX/$COOKBOOK
|
|
||||||
chefspec: rspec --format documentation $SANDBOX/$COOKBOOK/spec
|
|
@ -97,7 +97,7 @@ default['openstack']['secret']['user_passwords_data_bag'] = 'user_passwords'
|
|||||||
# needs.
|
# needs.
|
||||||
|
|
||||||
# The coordinated release of OpenStack codename
|
# The coordinated release of OpenStack codename
|
||||||
default['openstack']['release'] = 'icehouse'
|
default['openstack']['release'] = 'juno'
|
||||||
|
|
||||||
# The Ubuntu Cloud Archive has packages for multiple Ubuntu releases. For
|
# The Ubuntu Cloud Archive has packages for multiple Ubuntu releases. For
|
||||||
# more information, see: https://wiki.ubuntu.com/ServerTeam/CloudArchive.
|
# more information, see: https://wiki.ubuntu.com/ServerTeam/CloudArchive.
|
||||||
@ -114,8 +114,8 @@ default['openstack']['zypp']['repo-key'] = 'd85f9316' # 32 bit key ID
|
|||||||
default['openstack']['zypp']['uri'] = 'http://download.opensuse.org/repositories/Cloud:/OpenStack:/%release%/%suse-release%/'
|
default['openstack']['zypp']['uri'] = 'http://download.opensuse.org/repositories/Cloud:/OpenStack:/%release%/%suse-release%/'
|
||||||
|
|
||||||
default['openstack']['yum']['rdo_enabled'] = true
|
default['openstack']['yum']['rdo_enabled'] = true
|
||||||
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-icehouse/epel-6'
|
default['openstack']['yum']['uri'] = 'http://repos.fedorapeople.org/repos/openstack/openstack-juno/epel-6'
|
||||||
default['openstack']['yum']['repo-key'] = 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/master/RPM-GPG-KEY-RDO-Icehouse'
|
default['openstack']['yum']['repo-key'] = 'https://raw.githubusercontent.com/redhat-openstack/rdo-release/master/RPM-GPG-KEY-RDO-Juno'
|
||||||
|
|
||||||
# ======================== OpenStack Endpoints ================================
|
# ======================== OpenStack Endpoints ================================
|
||||||
#
|
#
|
||||||
|
@ -4,7 +4,7 @@ maintainer_email 'cookbooks@lists.tfoundry.com'
|
|||||||
license 'Apache 2.0'
|
license 'Apache 2.0'
|
||||||
description 'Common OpenStack attributes, libraries and recipes.'
|
description 'Common OpenStack attributes, libraries and recipes.'
|
||||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||||
version '9.7.0'
|
version '10.0.0'
|
||||||
|
|
||||||
recipe 'openstack-common', 'Installs/Configures common recipes'
|
recipe 'openstack-common', 'Installs/Configures common recipes'
|
||||||
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'
|
recipe 'openstack-common::set_endpoints_by_interface', 'Set endpoints by interface'
|
||||||
|
@ -15,7 +15,7 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
describe 'openstack_command_env' do
|
describe 'openstack_command_env' do
|
||||||
it 'returns cli enviroment' do
|
it 'returns cli enviroment' do
|
||||||
subject.stub(:get_password)
|
allow(subject).to receive(:get_password)
|
||||||
.with('user', 'name')
|
.with('user', 'name')
|
||||||
.and_return('pass')
|
.and_return('pass')
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ describe 'openstack-common::default' do
|
|||||||
'OS_TENANT_NAME' => 'tenant',
|
'OS_TENANT_NAME' => 'tenant',
|
||||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
subject.stub(:shell_out).with(
|
allow(subject).to receive(:shell_out).with(
|
||||||
['keystone', 'user-list'],
|
['keystone', 'user-list'],
|
||||||
env: env
|
env: env
|
||||||
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
||||||
@ -56,7 +56,7 @@ describe 'openstack-common::default' do
|
|||||||
'OS_TENANT_NAME' => 'tenant',
|
'OS_TENANT_NAME' => 'tenant',
|
||||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
subject.stub(:shell_out).with(
|
allow(subject).to receive(:shell_out).with(
|
||||||
%w(keystone user-list --key1 value1 --key2 value2),
|
%w(keystone user-list --key1 value1 --key2 value2),
|
||||||
env: env
|
env: env
|
||||||
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
||||||
@ -73,7 +73,7 @@ describe 'openstack-common::default' do
|
|||||||
'OS_TENANT_NAME' => 'tenant',
|
'OS_TENANT_NAME' => 'tenant',
|
||||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
subject.stub(:shell_out).with(
|
allow(subject).to receive(:shell_out).with(
|
||||||
['keystone', 'user-list'],
|
['keystone', 'user-list'],
|
||||||
env: env
|
env: env
|
||||||
).and_return double('shell_out', exitstatus: 123, stdout: 'fail', stderr: '')
|
).and_return double('shell_out', exitstatus: 123, stdout: 'fail', stderr: '')
|
||||||
@ -92,8 +92,8 @@ describe 'openstack-common::default' do
|
|||||||
'OS_TENANT_NAME' => 'tenant',
|
'OS_TENANT_NAME' => 'tenant',
|
||||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
subject.stub(:openstack_command).with('keystone', 'user-list', env, {})
|
allow(subject).to receive(:openstack_command).with('keystone', 'user-list', env, {})
|
||||||
subject.stub(:prettytable_to_array)
|
allow(subject).to receive(:prettytable_to_array)
|
||||||
.and_return([{ 'name' => 'user1', 'id' => '1234567890ABCDEFGH' }])
|
.and_return([{ 'name' => 'user1', 'id' => '1234567890ABCDEFGH' }])
|
||||||
|
|
||||||
result = subject.identity_uuid('user', 'name', 'user1', env)
|
result = subject.identity_uuid('user', 'name', 'user1', env)
|
||||||
@ -112,8 +112,8 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'runs glance command to query valid id' do
|
it 'runs glance command to query valid id' do
|
||||||
subject.stub(:openstack_command).with('glance', 'image-list', :env, {})
|
allow(subject).to receive(:openstack_command).with('glance', 'image-list', :env, {})
|
||||||
subject.stub(:prettytable_to_array)
|
allow(subject).to receive(:prettytable_to_array)
|
||||||
.and_return([{ 'ID' => '87f38e15-9737-46cc-a612-7c67ee29a24f', 'Name' => 'cirros' }])
|
.and_return([{ 'ID' => '87f38e15-9737-46cc-a612-7c67ee29a24f', 'Name' => 'cirros' }])
|
||||||
|
|
||||||
result = subject.image_id('cirros', :env)
|
result = subject.image_id('cirros', :env)
|
||||||
@ -121,7 +121,7 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'runs glance command to query invalid id' do
|
it 'runs glance command to query invalid id' do
|
||||||
subject.stub(:openstack_command).with('glance', 'image-list', :env, {})
|
allow(subject).to receive(:openstack_command).with('glance', 'image-list', :env, {})
|
||||||
.and_raise("No image with a name or ID of 'test' exists. (1)")
|
.and_raise("No image with a name or ID of 'test' exists. (1)")
|
||||||
|
|
||||||
expect { subject.image_id('test', :env) }.to raise_error
|
expect { subject.image_id('test', :env) }.to raise_error
|
||||||
@ -137,8 +137,8 @@ describe 'openstack-common::default' do
|
|||||||
'OS_TENANT_NAME' => 'tenant',
|
'OS_TENANT_NAME' => 'tenant',
|
||||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
subject.stub(:openstack_command).with('neutron', 'net-list', env, {})
|
allow(subject).to receive(:openstack_command).with('neutron', 'net-list', env, {})
|
||||||
subject.stub(:prettytable_to_array)
|
allow(subject).to receive(:prettytable_to_array)
|
||||||
.and_return([{ 'name' => 'net1', 'id' => '1234567890ABCDEFGH' }])
|
.and_return([{ 'name' => 'net1', 'id' => '1234567890ABCDEFGH' }])
|
||||||
|
|
||||||
result = subject.network_uuid('net', 'name', 'net1', env)
|
result = subject.network_uuid('net', 'name', 'net1', env)
|
||||||
|
@ -13,7 +13,7 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
describe '#db_create_with_user' do
|
describe '#db_create_with_user' do
|
||||||
before do
|
before do
|
||||||
subject.stub(:include_recipe)
|
allow(subject).to receive(:include_recipe)
|
||||||
.with('database::mysql')
|
.with('database::mysql')
|
||||||
.and_return('')
|
.and_return('')
|
||||||
end
|
end
|
||||||
@ -25,8 +25,8 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'returns db info and creates database with user when service found' do
|
it 'returns db info and creates database with user when service found' do
|
||||||
subject.stub(:database).and_return({})
|
allow(subject).to receive(:database).and_return({})
|
||||||
subject.stub(:database_user).and_return({})
|
allow(subject).to receive(:database_user).and_return({})
|
||||||
result = subject.db_create_with_user('compute', 'user', 'pass')
|
result = subject.db_create_with_user('compute', 'user', 'pass')
|
||||||
expect(result['host']).to eq('127.0.0.1')
|
expect(result['host']).to eq('127.0.0.1')
|
||||||
expect(result['port']).to eq('3306')
|
expect(result['port']).to eq('3306')
|
||||||
|
@ -33,7 +33,7 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'removes RDO yum repository' do
|
it 'removes RDO yum repository' do
|
||||||
::FileTest.stub(:exist?).with('/etc/yum.repos.d/RDO-testrelease.repo').and_return(true)
|
allow(FileTest).to receive(:exist?).with('/etc/yum.repos.d/RDO-testrelease.repo').and_return(true)
|
||||||
|
|
||||||
# Using cookbook(yum) LWRP custom matcher
|
# Using cookbook(yum) LWRP custom matcher
|
||||||
# https://github.com/sethvargo/chefspec#packaging-custom-matchers
|
# https://github.com/sethvargo/chefspec#packaging-custom-matchers
|
||||||
|
@ -12,17 +12,17 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'adds the openstack repository key, but not the repository' do
|
it 'adds the openstack repository key, but not the repository' do
|
||||||
Mixlib::ShellOut.stub_chain(
|
allow(Mixlib::ShellOut).to receive_message_chain(
|
||||||
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
||||||
new: 'zypper repos --export -').and_return(
|
new: 'zypper repos --export -').and_return(
|
||||||
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Icehouse/SLE_11_SP3/')
|
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Juno/SLE_11_SP3/')
|
||||||
|
|
||||||
expect(chef_run).to run_bash('add repository key')
|
expect(chef_run).to run_bash('add repository key')
|
||||||
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
|
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'adds the repository and the key' do
|
it 'adds the repository and the key' do
|
||||||
Mixlib::ShellOut.stub_chain(
|
allow(Mixlib::ShellOut).to receive_message_chain(
|
||||||
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
||||||
new: 'zypper repos --export -').and_return('')
|
new: 'zypper repos --export -').and_return('')
|
||||||
|
|
||||||
@ -30,15 +30,15 @@ describe 'openstack-common::default' do
|
|||||||
expect(chef_run).to run_execute('add repository').with(
|
expect(chef_run).to run_execute('add repository').with(
|
||||||
command: 'zypper addrepo --check '\
|
command: 'zypper addrepo --check '\
|
||||||
"http://download.opensuse.org/repositories/Cloud:/OpenStack:/#{node['openstack']['release'].capitalize}/SLE_11_SP3/ "\
|
"http://download.opensuse.org/repositories/Cloud:/OpenStack:/#{node['openstack']['release'].capitalize}/SLE_11_SP3/ "\
|
||||||
'Cloud:OpenStack:Icehouse')
|
'Cloud:OpenStack:Juno')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not add the repository nor the key' do
|
it 'does not add the repository nor the key' do
|
||||||
Mixlib::ShellOut.stub_chain(
|
allow(Mixlib::ShellOut).to receive_message_chain(
|
||||||
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
new: 'rpm -qa gpg-pubkey', run_command: nil, stdout: nil,
|
||||||
new: 'zypper repos --export -').and_return(
|
new: 'zypper repos --export -').and_return(
|
||||||
'd85f9316',
|
'd85f9316',
|
||||||
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Icehouse/SLE_11_SP3/')
|
'http://download.opensuse.org/repositories/Cloud:/OpenStack:/Juno/SLE_11_SP3/')
|
||||||
expect(chef_run).not_to run_bash('add repository key')
|
expect(chef_run).not_to run_bash('add repository key')
|
||||||
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
|
expect(chef_run).not_to run_execute('add repository').with(command: /zypper addrepo/)
|
||||||
end
|
end
|
||||||
|
@ -21,14 +21,14 @@ describe 'openstack-common::default' do
|
|||||||
node.set['openstack']['apt']['live_updates_enabled'] = true
|
node.set['openstack']['apt']['live_updates_enabled'] = true
|
||||||
expect(chef_run).to add_apt_repository('openstack-ppa').with(
|
expect(chef_run).to add_apt_repository('openstack-ppa').with(
|
||||||
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
||||||
components: ['precise-updates/icehouse', 'main'])
|
components: ['precise-updates/juno', 'main'])
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'disables openstack live updates' do
|
it 'disables openstack live updates' do
|
||||||
node.set['openstack']['apt']['live_updates_enabled'] = false
|
node.set['openstack']['apt']['live_updates_enabled'] = false
|
||||||
expect(chef_run).to_not add_apt_repository('openstack-ppa').with(
|
expect(chef_run).to_not add_apt_repository('openstack-ppa').with(
|
||||||
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
uri: 'http://ubuntu-cloud.archive.canonical.com/ubuntu',
|
||||||
components: ['precise-updates/icehouse', 'main'])
|
components: ['precise-updates/juno', 'main'])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -12,14 +12,14 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
|
|
||||||
describe '#endpoint' do
|
describe '#endpoint' do
|
||||||
it 'returns nil when no openstack.endpoints not in node attrs' do
|
it 'returns nil when no openstack.endpoints not in node attrs' do
|
||||||
subject.stub(:node).and_return({})
|
allow(subject).to receive(:node).and_return({})
|
||||||
expect(
|
expect(
|
||||||
subject.endpoint('nonexisting')
|
subject.endpoint('nonexisting')
|
||||||
).to be_nil
|
).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns nil when no such endpoint was found' do
|
it 'returns nil when no such endpoint was found' do
|
||||||
subject.stub(:node).and_return(node)
|
allow(subject).to receive(:node).and_return(node)
|
||||||
expect(
|
expect(
|
||||||
subject.endpoint('nonexisting')
|
subject.endpoint('nonexisting')
|
||||||
).to be_nil
|
).to be_nil
|
||||||
@ -35,7 +35,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(uri_hash)
|
allow(subject).to receive(:node).and_return(uri_hash)
|
||||||
expect(
|
expect(
|
||||||
subject.endpoint('compute-api').path
|
subject.endpoint('compute-api').path
|
||||||
).to eq('/v2/%25(tenant_id)s')
|
).to eq('/v2/%25(tenant_id)s')
|
||||||
@ -51,7 +51,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(uri_hash)
|
allow(subject).to receive(:node).and_return(uri_hash)
|
||||||
expect(
|
expect(
|
||||||
subject.endpoint('compute-api').port
|
subject.endpoint('compute-api').port
|
||||||
).to eq(8080)
|
).to eq(8080)
|
||||||
@ -68,7 +68,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(uri_hash)
|
allow(subject).to receive(:node).and_return(uri_hash)
|
||||||
expect(subject.endpoint('compute-api').to_s).to eq('http://localhost')
|
expect(subject.endpoint('compute-api').to_s).to eq('http://localhost')
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(uri_hash)
|
allow(subject).to receive(:node).and_return(uri_hash)
|
||||||
subject.endpoint 'compute-api'
|
subject.endpoint 'compute-api'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub('address_for').and_return('10.0.0.100')
|
allow(subject).to receive('address_for').and_return('10.0.0.100')
|
||||||
expect(
|
expect(
|
||||||
chef_run.node['openstack']['endpoints']['identity-api']['host']
|
chef_run.node['openstack']['endpoints']['identity-api']['host']
|
||||||
).to eq('10.0.0.100')
|
).to eq('10.0.0.100')
|
||||||
@ -122,12 +122,12 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
|
|
||||||
describe '#endpoints' do
|
describe '#endpoints' do
|
||||||
it 'does nothing when no endpoints' do
|
it 'does nothing when no endpoints' do
|
||||||
subject.stub(:node).and_return({})
|
allow(subject).to receive(:node).and_return({})
|
||||||
expect(subject.endpoints).to be_nil
|
expect(subject.endpoints).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does nothing when empty endpoints' do
|
it 'does nothing when empty endpoints' do
|
||||||
subject.stub(:node).and_return('openstack' => { 'endpoints' => {} })
|
allow(subject).to receive(:node).and_return('openstack' => { 'endpoints' => {} })
|
||||||
count = 0
|
count = 0
|
||||||
subject.endpoints do | ep |
|
subject.endpoints do | ep |
|
||||||
count += 1
|
count += 1
|
||||||
@ -136,7 +136,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'executes block count when have endpoints' do
|
it 'executes block count when have endpoints' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
count = 0
|
count = 0
|
||||||
subject.endpoints do |ep|
|
subject.endpoints do |ep|
|
||||||
count += 1
|
count += 1
|
||||||
@ -147,17 +147,17 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
|
|
||||||
describe '#db' do
|
describe '#db' do
|
||||||
it 'returns nil when no openstack.db not in node attrs' do
|
it 'returns nil when no openstack.db not in node attrs' do
|
||||||
subject.stub(:node).and_return({})
|
allow(subject).to receive(:node).and_return({})
|
||||||
expect(subject.db('nonexisting')).to be_nil
|
expect(subject.db('nonexisting')).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns nil when no such service was found' do
|
it 'returns nil when no such service was found' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expect(subject.db('nonexisting')).to be_nil
|
expect(subject.db('nonexisting')).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns db info hash when service found' do
|
it 'returns db info hash when service found' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expect(subject.db('compute')['host']).to eq('127.0.0.1')
|
expect(subject.db('compute')['host']).to eq('127.0.0.1')
|
||||||
expect(subject.db('compute').key?('uri')).to be_falsey
|
expect(subject.db('compute').key?('uri')).to be_falsey
|
||||||
end
|
end
|
||||||
@ -165,19 +165,19 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
|
|
||||||
describe '#db_uri' do
|
describe '#db_uri' do
|
||||||
it 'returns nil when no openstack.db not in node attrs' do
|
it 'returns nil when no openstack.db not in node attrs' do
|
||||||
subject.stub(:node).and_return({})
|
allow(subject).to receive(:node).and_return({})
|
||||||
expect(subject.db_uri('nonexisting', 'user', 'pass')).to be_nil
|
expect(subject.db_uri('nonexisting', 'user', 'pass')).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns nil when no such service was found' do
|
it 'returns nil when no such service was found' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('nonexisting', 'user', 'pass')
|
subject.db_uri('nonexisting', 'user', 'pass')
|
||||||
).to be_nil
|
).to be_nil
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns compute db info hash when service found for default mysql' do
|
it 'returns compute db info hash when service found for default mysql' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expected = 'mysql://user:pass@127.0.0.1:3306/nova?charset=utf8'
|
expected = 'mysql://user:pass@127.0.0.1:3306/nova?charset=utf8'
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('compute', 'user', 'pass')
|
subject.db_uri('compute', 'user', 'pass')
|
||||||
@ -188,7 +188,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
node.set['openstack']['db']['service_type'] = 'sqlite'
|
node.set['openstack']['db']['service_type'] = 'sqlite'
|
||||||
node.set['openstack']['db']['options'] = { 'sqlite' => '?options' }
|
node.set['openstack']['db']['options'] = { 'sqlite' => '?options' }
|
||||||
node.set['openstack']['db']['network']['path'] = 'path'
|
node.set['openstack']['db']['network']['path'] = 'path'
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expected = 'sqlite:///path?options'
|
expected = 'sqlite:///path?options'
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('network', 'user', 'pass')
|
subject.db_uri('network', 'user', 'pass')
|
||||||
@ -198,7 +198,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
it 'returns block-storage db info hash when service found for db2 with options' do
|
it 'returns block-storage db info hash when service found for db2 with options' do
|
||||||
node.set['openstack']['db']['service_type'] = 'db2'
|
node.set['openstack']['db']['service_type'] = 'db2'
|
||||||
node.set['openstack']['db']['options'] = { 'db2' => '?options' }
|
node.set['openstack']['db']['options'] = { 'db2' => '?options' }
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expected = 'ibm_db_sa://user:pass@127.0.0.1:3306/cinder?options'
|
expected = 'ibm_db_sa://user:pass@127.0.0.1:3306/cinder?options'
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('block-storage', 'user', 'pass')
|
subject.db_uri('block-storage', 'user', 'pass')
|
||||||
@ -208,7 +208,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
it 'returns telemetry db info hash when service found for db2' do
|
it 'returns telemetry db info hash when service found for db2' do
|
||||||
node.set['openstack']['db']['service_type'] = 'db2'
|
node.set['openstack']['db']['service_type'] = 'db2'
|
||||||
node.set['openstack']['db']['telemetry']['nosql']['used'] = true
|
node.set['openstack']['db']['telemetry']['nosql']['used'] = true
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expected = 'db2://user:pass@127.0.0.1:27017/ceilometer'
|
expected = 'db2://user:pass@127.0.0.1:27017/ceilometer'
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('telemetry', 'user', 'pass')
|
subject.db_uri('telemetry', 'user', 'pass')
|
||||||
@ -219,7 +219,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
node.set['openstack']['db']['service_type'] = 'db2'
|
node.set['openstack']['db']['service_type'] = 'db2'
|
||||||
node.set['openstack']['db']['options'] = { 'nosql' => '?options' }
|
node.set['openstack']['db']['options'] = { 'nosql' => '?options' }
|
||||||
node.set['openstack']['db']['telemetry']['nosql']['used'] = true
|
node.set['openstack']['db']['telemetry']['nosql']['used'] = true
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expected = 'db2://user:pass@127.0.0.1:27017/ceilometer?options'
|
expected = 'db2://user:pass@127.0.0.1:27017/ceilometer?options'
|
||||||
expect(
|
expect(
|
||||||
subject.db_uri('telemetry', 'user', 'pass')
|
subject.db_uri('telemetry', 'user', 'pass')
|
||||||
@ -233,7 +233,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
'bind_interface' => 'eth0',
|
'bind_interface' => 'eth0',
|
||||||
'host' => '5.6.7.8'
|
'host' => '5.6.7.8'
|
||||||
}
|
}
|
||||||
subject.stub('address_for').and_return('1.2.3.4')
|
allow(subject).to receive('address_for').and_return('1.2.3.4')
|
||||||
expect(
|
expect(
|
||||||
subject.address(ep_hash)
|
subject.address(ep_hash)
|
||||||
).to eq('1.2.3.4')
|
).to eq('1.2.3.4')
|
||||||
@ -243,7 +243,7 @@ describe 'openstack-common::set_endpoints_by_interface' do
|
|||||||
'bind_interface' => nil,
|
'bind_interface' => nil,
|
||||||
'host' => '5.6.7.8'
|
'host' => '5.6.7.8'
|
||||||
}
|
}
|
||||||
subject.stub('address_for').and_return('1.2.3.4')
|
allow(subject).to receive('address_for').and_return('1.2.3.4')
|
||||||
expect(
|
expect(
|
||||||
subject.address(ep_hash)
|
subject.address(ep_hash)
|
||||||
).to eq('5.6.7.8')
|
).to eq('5.6.7.8')
|
||||||
|
@ -15,8 +15,8 @@ describe 'openstack-common::default' do
|
|||||||
describe '#secret' do
|
describe '#secret' do
|
||||||
it 'returns databag' do
|
it 'returns databag' do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::EncryptedDataBagItem.stub(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
allow(Chef::EncryptedDataBagItem).to receive(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
||||||
::Chef::EncryptedDataBagItem.stub(:load).with('passwords', 'nova', 'secret').and_return(value)
|
allow(Chef::EncryptedDataBagItem).to receive(:load).with('passwords', 'nova', 'secret').and_return(value)
|
||||||
expect(subject.secret('passwords', 'nova')).to eq('this')
|
expect(subject.secret('passwords', 'nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -24,16 +24,16 @@ describe 'openstack-common::default' do
|
|||||||
describe '#get_secret' do
|
describe '#get_secret' do
|
||||||
it 'returns databag value' do
|
it 'returns databag value' do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::EncryptedDataBagItem.stub(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
allow(Chef::EncryptedDataBagItem).to receive(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
||||||
::Chef::EncryptedDataBagItem.stub(:load).with('secrets', 'nova', 'secret').and_return(value)
|
allow(Chef::EncryptedDataBagItem).to receive(:load).with('secrets', 'nova', 'secret').and_return(value)
|
||||||
expect(subject.get_secret('nova')).to eq('this')
|
expect(subject.get_secret('nova')).to eq('this')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns secret from an alternate databag when secrets_data_bag set' do
|
it 'returns secret from an alternate databag when secrets_data_bag set' do
|
||||||
node.set['openstack']['secret']['secrets_data_bag'] = 'myothersecrets'
|
node.set['openstack']['secret']['secrets_data_bag'] = 'myothersecrets'
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::EncryptedDataBagItem.stub(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
allow(Chef::EncryptedDataBagItem).to receive(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
||||||
::Chef::EncryptedDataBagItem.stub(:load).with('myothersecrets', 'nova', 'secret').and_return(value)
|
allow(Chef::EncryptedDataBagItem).to receive(:load).with('myothersecrets', 'nova', 'secret').and_return(value)
|
||||||
expect(subject.get_secret('nova')).to eq('this')
|
expect(subject.get_secret('nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -42,8 +42,8 @@ describe 'openstack-common::default' do
|
|||||||
['service', 'db', 'user'].each do |type|
|
['service', 'db', 'user'].each do |type|
|
||||||
it "returns databag value for #{type}" do
|
it "returns databag value for #{type}" do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::EncryptedDataBagItem.stub(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
allow(Chef::EncryptedDataBagItem).to receive(:load_secret).with('/etc/chef/openstack_data_bag_secret').and_return('secret')
|
||||||
::Chef::EncryptedDataBagItem.stub(:load).with("#{type}_passwords", 'nova', 'secret').and_return(value)
|
allow(Chef::EncryptedDataBagItem).to receive(:load).with("#{type}_passwords", 'nova', 'secret').and_return(value)
|
||||||
expect(subject.get_password(type, 'nova')).to eq('this')
|
expect(subject.get_password(type, 'nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -54,9 +54,9 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
it 'returns tokens from the secrets_data_bag' do
|
it 'returns tokens from the secrets_data_bag' do
|
||||||
bag_content = { 'nova' => 'mysecret' }
|
bag_content = { 'nova' => 'mysecret' }
|
||||||
::Chef::EncryptedDataBagItem.stub(:load_secret).with(
|
allow(Chef::EncryptedDataBagItem).to receive(:load_secret).with(
|
||||||
'/etc/chef/openstack_data_bag_secret').and_return('secret')
|
'/etc/chef/openstack_data_bag_secret').and_return('secret')
|
||||||
::Chef::EncryptedDataBagItem.stub(:load).with(
|
allow(Chef::EncryptedDataBagItem).to receive(:load).with(
|
||||||
'secrets', 'nova', 'secret').and_return(bag_content)
|
'secrets', 'nova', 'secret').and_return(bag_content)
|
||||||
expect(subject.get_password('token', 'nova')).to eq('mysecret')
|
expect(subject.get_password('token', 'nova')).to eq('mysecret')
|
||||||
end
|
end
|
||||||
@ -68,7 +68,7 @@ describe 'openstack-common::default' do
|
|||||||
describe '#secret' do
|
describe '#secret' do
|
||||||
it 'returns databag' do
|
it 'returns databag' do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::DataBagItem.stub(:load).with('passwords', 'nova').and_return(value)
|
allow(Chef::DataBagItem).to receive(:load).with('passwords', 'nova').and_return(value)
|
||||||
expect(subject.secret('passwords', 'nova')).to eq('this')
|
expect(subject.secret('passwords', 'nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -76,14 +76,14 @@ describe 'openstack-common::default' do
|
|||||||
describe '#get_secret' do
|
describe '#get_secret' do
|
||||||
it 'returns databag value' do
|
it 'returns databag value' do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::DataBagItem.stub(:load).with('secrets', 'nova').and_return(value)
|
allow(Chef::DataBagItem).to receive(:load).with('secrets', 'nova').and_return(value)
|
||||||
expect(subject.get_secret('nova')).to eq('this')
|
expect(subject.get_secret('nova')).to eq('this')
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns secret from an alternate databag when secrets_data_bag set' do
|
it 'returns secret from an alternate databag when secrets_data_bag set' do
|
||||||
node.set['openstack']['secret']['secrets_data_bag'] = 'myothersecrets'
|
node.set['openstack']['secret']['secrets_data_bag'] = 'myothersecrets'
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::DataBagItem.stub(:load).with('myothersecrets', 'nova').and_return(value)
|
allow(Chef::DataBagItem).to receive(:load).with('myothersecrets', 'nova').and_return(value)
|
||||||
expect(subject.get_secret('nova')).to eq('this')
|
expect(subject.get_secret('nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -92,7 +92,7 @@ describe 'openstack-common::default' do
|
|||||||
['service', 'db', 'user'].each do |type|
|
['service', 'db', 'user'].each do |type|
|
||||||
it "returns databag value for #{type}" do
|
it "returns databag value for #{type}" do
|
||||||
value = { 'nova' => 'this' }
|
value = { 'nova' => 'this' }
|
||||||
::Chef::DataBagItem.stub(:load).with("#{type}_passwords", 'nova').and_return(value)
|
allow(Chef::DataBagItem).to receive(:load).with("#{type}_passwords", 'nova').and_return(value)
|
||||||
expect(subject.get_password(type, 'nova')).to eq('this')
|
expect(subject.get_password(type, 'nova')).to eq('this')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -103,7 +103,7 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
it 'returns tokens from the secrets_data_bag' do
|
it 'returns tokens from the secrets_data_bag' do
|
||||||
bag_content = { 'nova' => 'mysecret' }
|
bag_content = { 'nova' => 'mysecret' }
|
||||||
::Chef::DataBagItem.stub(:load).with(
|
allow(Chef::DataBagItem).to receive(:load).with(
|
||||||
'secrets', 'nova').and_return(bag_content)
|
'secrets', 'nova').and_return(bag_content)
|
||||||
expect(subject.get_password('token', 'nova')).to eq('mysecret')
|
expect(subject.get_password('token', 'nova')).to eq('mysecret')
|
||||||
end
|
end
|
||||||
|
@ -16,8 +16,8 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
describe '#search_for' do
|
describe '#search_for' do
|
||||||
it 'returns results' do
|
it 'returns results' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search)
|
allow(subject).to receive(:search)
|
||||||
.with(:node, '(chef_environment:_default AND roles:role) OR (chef_environment:_default AND recipes:role)')
|
.with(:node, '(chef_environment:_default AND roles:role) OR (chef_environment:_default AND recipes:role)')
|
||||||
.and_return([chef_run.node])
|
.and_return([chef_run.node])
|
||||||
resp = subject.search_for('role')
|
resp = subject.search_for('role')
|
||||||
@ -25,8 +25,8 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'returns empty results' do
|
it 'returns empty results' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search)
|
allow(subject).to receive(:search)
|
||||||
.with(:node, '(chef_environment:_default AND roles:empty-role) OR (chef_environment:_default AND recipes:empty-role)')
|
.with(:node, '(chef_environment:_default AND roles:empty-role) OR (chef_environment:_default AND recipes:empty-role)')
|
||||||
.and_return([])
|
.and_return([])
|
||||||
expect(
|
expect(
|
||||||
@ -35,8 +35,8 @@ describe 'openstack-common::default' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'always returns empty results' do
|
it 'always returns empty results' do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search)
|
allow(subject).to receive(:search)
|
||||||
.with(:node, '(chef_environment:_default AND roles:empty-role) OR (chef_environment:_default AND recipes:empty-role)')
|
.with(:node, '(chef_environment:_default AND roles:empty-role) OR (chef_environment:_default AND recipes:empty-role)')
|
||||||
.and_return(nil)
|
.and_return(nil)
|
||||||
expect(
|
expect(
|
||||||
@ -51,8 +51,8 @@ describe 'openstack-common::default' do
|
|||||||
{ 'memcached' => { 'listen' => '1.1.1.1', 'port' => '11211' } },
|
{ 'memcached' => { 'listen' => '1.1.1.1', 'port' => '11211' } },
|
||||||
{ 'memcached' => { 'listen' => '2.2.2.2', 'port' => '11211' } }
|
{ 'memcached' => { 'listen' => '2.2.2.2', 'port' => '11211' } }
|
||||||
]
|
]
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search_for)
|
allow(subject).to receive(:search_for)
|
||||||
.with('role')
|
.with('role')
|
||||||
.and_return(nodes)
|
.and_return(nodes)
|
||||||
expect(
|
expect(
|
||||||
@ -66,8 +66,8 @@ describe 'openstack-common::default' do
|
|||||||
{ 'memcached' => { 'listen' => '1.1.1.1', 'port' => '11211' } },
|
{ 'memcached' => { 'listen' => '1.1.1.1', 'port' => '11211' } },
|
||||||
{ 'memcached' => { 'listen' => '2.2.2.2', 'port' => '11211' } }
|
{ 'memcached' => { 'listen' => '2.2.2.2', 'port' => '11211' } }
|
||||||
]
|
]
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search_for)
|
allow(subject).to receive(:search_for)
|
||||||
.with('role')
|
.with('role')
|
||||||
.and_return(nodes)
|
.and_return(nodes)
|
||||||
expect(
|
expect(
|
||||||
@ -81,7 +81,7 @@ describe 'openstack-common::default' do
|
|||||||
'memcached_servers' => ['1.1.1.1:11211', '2.2.2.2:11211']
|
'memcached_servers' => ['1.1.1.1:11211', '2.2.2.2:11211']
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(chef_run.node.merge(nodes))
|
allow(subject).to receive(:node).and_return(chef_run.node.merge(nodes))
|
||||||
expect(
|
expect(
|
||||||
subject.memcached_servers('role')
|
subject.memcached_servers('role')
|
||||||
).to eq(['1.1.1.1:11211', '2.2.2.2:11211'])
|
).to eq(['1.1.1.1:11211', '2.2.2.2:11211'])
|
||||||
@ -93,7 +93,7 @@ describe 'openstack-common::default' do
|
|||||||
'memcached_servers' => []
|
'memcached_servers' => []
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
subject.stub(:node).and_return(chef_run.node.merge(nodes))
|
allow(subject).to receive(:node).and_return(chef_run.node.merge(nodes))
|
||||||
expect(
|
expect(
|
||||||
subject.memcached_servers('empty-role')
|
subject.memcached_servers('empty-role')
|
||||||
).to eq([])
|
).to eq([])
|
||||||
@ -106,8 +106,8 @@ describe 'openstack-common::default' do
|
|||||||
{ 'openstack' => { 'mq' => { 'listen' => '1.1.1.1' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } },
|
{ 'openstack' => { 'mq' => { 'listen' => '1.1.1.1' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } },
|
||||||
{ 'openstack' => { 'mq' => { 'listen' => '2.2.2.2' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } }
|
{ 'openstack' => { 'mq' => { 'listen' => '2.2.2.2' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } }
|
||||||
]
|
]
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search_for)
|
allow(subject).to receive(:search_for)
|
||||||
.and_return(nodes)
|
.and_return(nodes)
|
||||||
expect(
|
expect(
|
||||||
subject.rabbit_servers).to eq('1.1.1.1:5672,2.2.2.2:5672')
|
subject.rabbit_servers).to eq('1.1.1.1:5672,2.2.2.2:5672')
|
||||||
@ -119,8 +119,8 @@ describe 'openstack-common::default' do
|
|||||||
{ 'openstack' => { 'mq' => { 'listen' => '1.1.1.1' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } },
|
{ 'openstack' => { 'mq' => { 'listen' => '1.1.1.1' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } },
|
||||||
{ 'openstack' => { 'mq' => { 'listen' => '2.2.2.2' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } }
|
{ 'openstack' => { 'mq' => { 'listen' => '2.2.2.2' }, 'endpoints' => { 'mq' => { 'port' => '5672' } } } }
|
||||||
]
|
]
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
subject.stub(:search_for)
|
allow(subject).to receive(:search_for)
|
||||||
.and_return(nodes)
|
.and_return(nodes)
|
||||||
expect(
|
expect(
|
||||||
subject.rabbit_servers
|
subject.rabbit_servers
|
||||||
@ -129,7 +129,7 @@ describe 'openstack-common::default' do
|
|||||||
|
|
||||||
it 'returns rabbit servers when not searching' do
|
it 'returns rabbit servers when not searching' do
|
||||||
chef_run.node.set['openstack']['mq']['servers'] = ['1.1.1.1', '2.2.2.2']
|
chef_run.node.set['openstack']['mq']['servers'] = ['1.1.1.1', '2.2.2.2']
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
expect(
|
expect(
|
||||||
subject.rabbit_servers
|
subject.rabbit_servers
|
||||||
).to eq('1.1.1.1:5672,2.2.2.2:5672')
|
).to eq('1.1.1.1:5672,2.2.2.2:5672')
|
||||||
|
@ -31,13 +31,13 @@ end
|
|||||||
|
|
||||||
shared_context 'library-stubs' do
|
shared_context 'library-stubs' do
|
||||||
before do
|
before do
|
||||||
subject.stub(:node).and_return(chef_run.node)
|
allow(subject).to receive(:node).and_return(chef_run.node)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
shared_context 'common-stubs' do
|
shared_context 'common-stubs' do
|
||||||
before do
|
before do
|
||||||
Chef::Recipe.any_instance.stub(:search_for)
|
allow_any_instance_of(Chef::Recipe).to receive(:search_for)
|
||||||
.with('os-identity').and_return(
|
.with('os-identity').and_return(
|
||||||
[{
|
[{
|
||||||
'openstack' => {
|
'openstack' => {
|
||||||
@ -48,10 +48,10 @@ shared_context 'common-stubs' do
|
|||||||
}
|
}
|
||||||
}]
|
}]
|
||||||
)
|
)
|
||||||
Chef::Recipe.any_instance.stub(:get_password)
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
.with('user', 'admin')
|
.with('user', 'admin')
|
||||||
.and_return('admin')
|
.and_return('admin')
|
||||||
Chef::Recipe.any_instance.stub(:get_password)
|
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
|
||||||
.with('user', 'admin-user-override')
|
.with('user', 'admin-user-override')
|
||||||
.and_return('admin-user-override')
|
.and_return('admin-user-override')
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user