From bd109dbd1bab0954796f24a8b4a72e3c19edbd3d Mon Sep 17 00:00:00 2001 From: JJ Asghar Date: Mon, 16 Mar 2015 15:24:16 -0500 Subject: [PATCH] This creates the role it doesn't by default This allows integration tests to run. Partial-Bug: 1433808 Change-Id: Id9cdca2f8718f0f000a82cab1ba8fd70462d6329 --- Berksfile | 4 +++- recipes/setup.rb | 11 +++++++++++ spec/setup_spec.rb | 26 ++++++++++++++++++++++++++ spec/spec_helper.rb | 4 ++-- 4 files changed, 42 insertions(+), 3 deletions(-) diff --git a/Berksfile b/Berksfile index 9369731..6d99f15 100644 --- a/Berksfile +++ b/Berksfile @@ -1,7 +1,9 @@ -source 'https://supermarket.getchef.com' +source 'https://supermarket.chef.io' metadata +cookbook "openstack-bare-metal", + github: "stackforge/cookbook-openstack-bare-metal" cookbook "openstack-common", github: "stackforge/cookbook-openstack-common" cookbook "openstack-identity", diff --git a/recipes/setup.rb b/recipes/setup.rb index 5ac1ef1..77ab5e0 100644 --- a/recipes/setup.rb +++ b/recipes/setup.rb @@ -65,6 +65,17 @@ admin_pass = get_password 'user', node['openstack']['identity']['ad action :create_user end + 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'] + user_name node['openstack']['integration-test'][user]['user_name'] + user_pass node['openstack']['integration-test'][user]['password'] + role_name 'Member' + + action :create_role + end + openstack_identity_register "Grant 'member' Role to tempest user for tempest tenant ##{i}" do auth_uri auth_uri bootstrap_token bootstrap_token diff --git a/spec/setup_spec.rb b/spec/setup_spec.rb index 17be789..10b633a 100644 --- a/spec/setup_spec.rb +++ b/spec/setup_spec.rb @@ -43,6 +43,19 @@ describe 'openstack-integration-test::setup' do ) end + it 'creates member role to tempest_user1 for tempest_tenant1' 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', + user_name: 'tempest_user1', + user_pass: 'tempest_user1_pass', + role_name: 'Member' + ) + end + it 'grants member role to tempest_user1 for tempest_tenant1' do expect(chef_run).to grant_role_openstack_identity_register( "Grant 'member' Role to tempest user for tempest tenant #1" @@ -78,6 +91,19 @@ describe 'openstack-integration-test::setup' do ) end + it 'creates member role to tempest_user2 for tempest_tenant2' 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', + user_name: 'tempest_user2', + user_pass: 'tempest_user2_pass', + role_name: 'Member' + ) + end + it 'grants member role to tempest_user2 for tempest_tenant2' do expect(chef_run).to grant_role_openstack_identity_register( "Grant 'member' Role to tempest user for tempest tenant #2" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 7975be5..2657c28 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,12 +9,12 @@ require 'chef/application' LOG_LEVEL = :fatal REDHAT_OPTS = { platform: 'redhat', - version: '6.3', + version: '7.0', log_level: LOG_LEVEL } UBUNTU_OPTS = { platform: 'ubuntu', - version: '12.04', + version: '14.04', log_level: LOG_LEVEL }