Deprecation cleanups

tentant to project changes.
minor unit test cleanups.

Change-Id: I0f7da600b6ae78fee8545d1559e0c789215a3b81
This commit is contained in:
Mark Vanderwiel 2016-04-14 13:46:35 -05:00
parent 5a86f23c2a
commit f73e592744
5 changed files with 61 additions and 69 deletions

View File

@ -21,32 +21,31 @@
default['openstack']['integration-test'] = {
'branch' => nil,
'disable_ssl_validation' => false,
'tenant_isolation' => true,
'tenant_reuse' => true,
'use_dynamic_credentials' => true,
'alt_ssh_user' => 'cirros',
'ssh_user' => 'cirros',
'fixed_network' => 'local_net',
'user1' => {
'user_name' => 'tempest_user1',
'password' => 'tempest_user1_pass',
'tenant_name' => 'tempest_tenant1'
'project_name' => 'tempest_project1'
},
'user2' => {
'user_name' => 'tempest_user2',
'password' => 'tempest_user2_pass',
'tenant_name' => 'tempest_tenant2'
'project_name' => 'tempest_project2'
},
'image1' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 99,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
'source' => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img'
},
'image2' => {
'name' => 'cirros',
'id' => nil,
'flavor' => 99,
'source' => 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
'source' => 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img'
}
}

View File

@ -48,11 +48,11 @@ admin_pass = get_password 'user', node['openstack']['identity']['ad
%w(user1 user2).each_with_index do |user, i|
i += 1
openstack_identity_register "Register tempest tenant #{i}" do
openstack_identity_register "Register tempest project #{i}" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
tenant_description "Tempest tenant #{i}"
tenant_name node['openstack']['integration-test'][user]['project_name']
tenant_description "Tempest project #{i}"
action :create_tenant
end
@ -60,7 +60,7 @@ admin_pass = get_password 'user', node['openstack']['identity']['ad
openstack_identity_register "Register tempest user #{i}" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
tenant_name node['openstack']['integration-test'][user]['project_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
@ -70,7 +70,7 @@ admin_pass = get_password 'user', node['openstack']['identity']['ad
openstack_identity_register "Create tempest role #{i}" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
tenant_name node['openstack']['integration-test'][user]['project_name']
user_name node['openstack']['integration-test'][user]['user_name']
user_pass node['openstack']['integration-test'][user]['password']
role_name 'Member'
@ -78,10 +78,10 @@ admin_pass = get_password 'user', node['openstack']['identity']['ad
action :create_role
end
openstack_identity_register "Grant 'member' Role to tempest user for tempest tenant ##{i}" do
openstack_identity_register "Grant 'member' Role to tempest user for tempest project ##{i}" do
auth_uri auth_uri
bootstrap_token bootstrap_token
tenant_name node['openstack']['integration-test'][user]['tenant_name']
tenant_name node['openstack']['integration-test'][user]['project_name']
user_name node['openstack']['integration-test'][user]['user_name']
role_name 'Member'
@ -97,14 +97,14 @@ git '/opt/tempest' do
end
admin_user = node['openstack']['identity']['admin_user']
admin_tenant = node['openstack']['identity']['admin_tenant_name']
admin_project = node['openstack']['identity']['admin_tenant_name']
%w(image1 image2).each do |img|
image_name = node['openstack']['integration-test'][img]['name']
openstack_image_image img do
identity_user admin_user
identity_pass admin_pass
identity_tenant admin_tenant
identity_tenant admin_project
identity_uri auth_uri
image_name image_name
image_url node['openstack']['integration-test'][img]['source']
@ -115,7 +115,7 @@ admin_tenant = node['openstack']['identity']['admin_tenant_name']
ruby_block "Get and set #{img}'s ID" do
block do
begin
env = openstack_command_env admin_user, admin_tenant
env = openstack_command_env admin_user, admin_project
id = image_id image_name, env
node.set['openstack']['integration-test'][img]['id'] = id
rescue RuntimeError => e
@ -131,7 +131,7 @@ end
ruby_block 'Create nano flavor 99' do
block do
begin
env = openstack_command_env(admin_user, admin_tenant)
env = openstack_command_env(admin_user, admin_project)
output = openstack_command('nova', 'flavor-list', env)
unless output.include? 'm1.nano'
openstack_command('nova', 'flavor-create m1.nano 99 64 0 1', env)
@ -155,21 +155,20 @@ template '/opt/tempest/etc/tempest.conf' do
'tempest_disable_ssl_validation' => node['openstack']['integration-test']['disable_ssl_validation'],
'identity_endpoint_host' => identity_api_endpoint.host,
'identity_endpoint_port' => identity_api_endpoint.port,
'tempest_tenant_isolation' => node['openstack']['integration-test']['tenant_isolation'],
'tempest_tenant_reuse' => node['openstack']['integration-test']['tenant_reuse'],
'tempest_use_dynamic_credentials' => node['openstack']['integration-test']['use_dynamic_credentials'],
'tempest_user1' => node['openstack']['integration-test']['user1']['user_name'],
'tempest_user1_pass' => node['openstack']['integration-test']['user1']['password'],
'tempest_user1_tenant' => node['openstack']['integration-test']['user1']['tenant_name'],
'tempest_user1_project' => node['openstack']['integration-test']['user1']['project_name'],
'tempest_img_flavor1' => node['openstack']['integration-test']['image1']['flavor'],
'tempest_img_flavor2' => node['openstack']['integration-test']['image2']['flavor'],
'tempest_admin' => node['openstack']['identity']['admin_user'],
'tempest_admin_tenant' => node['openstack']['identity']['admin_tenant_name'],
'tempest_admin_project' => admin_project,
'tempest_admin_pass' => admin_pass,
'tempest_alt_ssh_user' => node['openstack']['integration-test']['alt_ssh_user'],
'tempest_ssh_user' => node['openstack']['integration-test']['ssh_user'],
'tempest_user2' => node['openstack']['integration-test']['user2']['user_name'],
'tempest_user2_pass' => node['openstack']['integration-test']['user2']['password'],
'tempest_user2_tenant' => node['openstack']['integration-test']['user2']['tenant_name'],
'tempest_user2_tenant' => node['openstack']['integration-test']['user2']['project_name'],
'tempest_fixed_network' => node['openstack']['integration-test']['fixed_network']
)
end

View File

@ -20,14 +20,14 @@ describe 'openstack-integration-test::setup' do
end
end
it 'registers tenant tempest_tenant1' do
it 'registers project tempest_project1' do
expect(chef_run).to create_tenant_openstack_identity_register(
'Register tempest tenant 1'
'Register tempest project 1'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant1',
tenant_description: 'Tempest tenant 1'
tenant_name: 'tempest_project1',
tenant_description: 'Tempest project 1'
)
end
@ -37,45 +37,45 @@ describe 'openstack-integration-test::setup' do
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant1',
tenant_name: 'tempest_project1',
user_name: 'tempest_user1',
user_pass: 'tempest_user1_pass'
)
end
it 'creates member role to tempest_user1 for tempest_tenant1' do
it 'creates member role to tempest_user1 for tempest_project1' do
expect(chef_run).to create_role_openstack_identity_register(
'Create tempest role 1'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant1',
tenant_name: 'tempest_project1',
user_name: 'tempest_user1',
user_pass: 'tempest_user1_pass',
role_name: 'Member'
)
end
it 'grants member role to tempest_user1 for tempest_tenant1' do
it 'grants member role to tempest_user1 for tempest_project1' do
expect(chef_run).to grant_role_openstack_identity_register(
"Grant 'member' Role to tempest user for tempest tenant #1"
"Grant 'member' Role to tempest user for tempest project #1"
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant1',
tenant_name: 'tempest_project1',
user_name: 'tempest_user1',
role_name: 'Member'
)
end
it 'registers tenant tempest_tenant2' do
it 'registers project tempest_project2' do
expect(chef_run).to create_tenant_openstack_identity_register(
'Register tempest tenant 2'
'Register tempest project 2'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant2',
tenant_description: 'Tempest tenant 2'
tenant_name: 'tempest_project2',
tenant_description: 'Tempest project 2'
)
end
@ -85,32 +85,32 @@ describe 'openstack-integration-test::setup' do
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant2',
tenant_name: 'tempest_project2',
user_name: 'tempest_user2',
user_pass: 'tempest_user2_pass'
)
end
it 'creates member role to tempest_user2 for tempest_tenant2' do
it 'creates member role to tempest_user2 for tempest_project2' do
expect(chef_run).to create_role_openstack_identity_register(
'Create tempest role 2'
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant2',
tenant_name: 'tempest_project2',
user_name: 'tempest_user2',
user_pass: 'tempest_user2_pass',
role_name: 'Member'
)
end
it 'grants member role to tempest_user2 for tempest_tenant2' do
it 'grants member role to tempest_user2 for tempest_project2' do
expect(chef_run).to grant_role_openstack_identity_register(
"Grant 'member' Role to tempest user for tempest tenant #2"
"Grant 'member' Role to tempest user for tempest project #2"
).with(
auth_uri: 'http://127.0.0.1:35357/v2.0',
bootstrap_token: 'bootstrap-token',
tenant_name: 'tempest_tenant2',
tenant_name: 'tempest_project2',
user_name: 'tempest_user2',
role_name: 'Member'
)
@ -133,7 +133,7 @@ describe 'openstack-integration-test::setup' do
identity_tenant: 'admin',
identity_uri: 'http://127.0.0.1:35357/v2.0',
image_name: 'cirros',
image_url: 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img'
)
end
@ -144,7 +144,7 @@ describe 'openstack-integration-test::setup' do
identity_tenant: 'admin',
identity_uri: 'http://127.0.0.1:35357/v2.0',
image_name: 'cirros',
image_url: 'http://download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img'
image_url: 'http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img'
)
end

View File

@ -28,19 +28,18 @@ shared_context 'tempest-stubs' do
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
}
Chef::Recipe.any_instance.stub(:get_password)
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('token', 'openstack_identity_bootstrap_token')
.and_return('bootstrap-token')
Chef::Recipe.any_instance.stub(:get_password)
allow_any_instance_of(Chef::Recipe).to receive(:get_password)
.with('user', 'admin')
.and_return('admin')
Chef::Resource::RubyBlock.any_instance.stub(:image_id)
allow_any_instance_of(Chef::Resource::RubyBlock).to receive(:image_id)
.with('cirros', env)
.and_return('5d1ff378-e9c1-4db7-97c1-d35f07824595')
Chef::Resource::RubyBlock.any_instance.stub(:openstack_command_env)
allow_any_instance_of(Chef::Resource::RubyBlock).to receive(:openstack_command_env)
.with('admin', 'admin')
.and_return(env)
Chef::Application.stub(:fatal!)
allow(Chef::Application).to receive(:fatal!)
end
end

View File

@ -1,3 +1,10 @@
[auth]
use_dynamic_credentials = <%= @tempest_use_dynamic_credentials %>
admin_username = <%= @tempest_admin %>
admin_password = <%= @tempest_admin_pass %>
admin_project_name = <%= @tempest_admin_project %>
[identity]
catalog_type = identity
@ -13,24 +20,17 @@ region = RegionOne
username = <%= @tempest_user1 %>
password = <%= @tempest_user1_pass %>
tenant_name = <%= @tempest_user1_tenant %>
project_name = <%= @tempest_user1_project %>
alt_username = <%= @tempest_user2 %>
alt_password = <%= @tempest_user2_pass %>
alt_tenant_name = <%= @tempest_user2_tenant %>
alt_project_name = <%= @tempest_user2_project %>
admin_username = <%= @tempest_admin %>
admin_password = <%= @tempest_admin_pass %>
admin_tenant_name = <%= @tempest_admin_tenant %>
[compute]
[validation]
image_alt_ssh_user = <%= @tempest_alt_ssh_user %>
image_ssh_user = <%= @tempest_ssh_user %>
allow_tenant_isolation = <%= @tempest_tenant_isolation %>
allow_tenant_reuse = <%= @tempest_tenant_reuse %>
[compute]
image_ref = <%= node['openstack']['integration-test']['image1']['id'] %>
image_ref_alt = <%= node['openstack']['integration-test']['image2']['id'] %>
flavor_ref = <%= @tempest_img_flavor1 %>
@ -85,11 +85,6 @@ path_to_private_key =
db_uri =
[compute-admin]
username = <%= @tempest_admin %>
password = <%= @tempest_admin_pass %>
tenant_name = <%= @tempest_admin_tenant %>
[compute-feature-enabled]
api_v3 = false
@ -103,11 +98,11 @@ api_version = 1
api_version = 2.0
catalog_type = network
tenant_network_cidr = 10.100.0.0/16
project_network_cidr = 10.100.0.0/16
tenant_network_mask_bits = 28
project_network_mask_bits = 28
tenant_networks_reachable = false
project_networks_reachable = false
public_network_id =