From 4a6f46749b8f814874f8fa15e1b4317fe20fc078 Mon Sep 17 00:00:00 2001 From: Kyle Jorgensen Date: Tue, 20 Dec 2016 14:58:13 -0800 Subject: [PATCH] Add support for https endpoint in auth URI Since the 'scheme' for the identity endpoint is defined as a node attribute, we can use this value when constructing the auth URI in the tempest.conf Closes-Bug: #1650364 Change-Id: Ieaadef347661547cb549870e42e2a0d92c722b8e --- recipes/setup.rb | 1 + spec/setup_spec.rb | 35 +++++++++++++++++++++++++++++- templates/default/tempest.conf.erb | 4 ++-- 3 files changed, 37 insertions(+), 3 deletions(-) diff --git a/recipes/setup.rb b/recipes/setup.rb index 779922e..9599560 100644 --- a/recipes/setup.rb +++ b/recipes/setup.rb @@ -163,6 +163,7 @@ template '/opt/tempest/etc/tempest.conf' do 'tempest_disable_ssl_validation' => node['openstack']['integration-test']['disable_ssl_validation'], 'identity_endpoint_host' => identity_public_endpoint.host, 'identity_endpoint_port' => identity_public_endpoint.port, + 'identity_endpoint_scheme' => identity_public_endpoint.scheme, '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'], diff --git a/spec/setup_spec.rb b/spec/setup_spec.rb index 56311c1..0006d84 100644 --- a/spec/setup_spec.rb +++ b/spec/setup_spec.rb @@ -198,7 +198,7 @@ describe 'openstack-integration-test::setup' do expect(chef_run).to run_ruby_block('Create nano flavor 99') end - describe 'tempest.conf' do + describe 'tempest.conf default' do let(:file) { chef_run.template('/opt/tempest/etc/tempest.conf') } it 'creates tempest.conf' do @@ -224,6 +224,39 @@ describe 'openstack-integration-test::setup' do 'image_ref_alt = 5d1ff378-e9c1-4db7-97c1-d35f07824595' ) end + + it 'has a v2 auth URI with the default scheme' do + expect(chef_run).to render_file(file.name).with_content( + 'uri = http://127.0.0.1:5000/v2.0' + ) + end + + it 'has a v3 auth URI with the default scheme' do + expect(chef_run).to render_file(file.name).with_content( + 'uri_v3 = http://127.0.0.1:5000/v3' + ) + end + end + + describe 'tempest.conf with HTTPS' do + let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) } + let(:chef_run) do + runner.node.normal['openstack']['endpoints']['public']['identity']['scheme'] = 'https' + runner.converge(described_recipe) + end + let(:file) { chef_run.template('/opt/tempest/etc/tempest.conf') } + + it 'has a v2 auth URI with the secure scheme' do + expect(chef_run).to render_file(file.name).with_content( + 'uri = https://127.0.0.1:5000/v2.0' + ) + end + + it 'has a v3 auth URI with the secure scheme' do + expect(chef_run).to render_file(file.name).with_content( + 'uri_v3 = https://127.0.0.1:5000/v3' + ) + end end end end diff --git a/templates/default/tempest.conf.erb b/templates/default/tempest.conf.erb index 6edd60a..5c30fc6 100644 --- a/templates/default/tempest.conf.erb +++ b/templates/default/tempest.conf.erb @@ -13,8 +13,8 @@ catalog_type = identity disable_ssl_certificate_validation = <%= @tempest_disable_ssl_validation %> -uri = http://<%= @identity_endpoint_host %>:<%= @identity_endpoint_port %>/v2.0/ -uri_v3 = http://<%= @identity_endpoint_host %>:<%= @identity_endpoint_port %>/v3/ +uri = <%= @identity_endpoint_scheme %>://<%= @identity_endpoint_host %>:<%= @identity_endpoint_port %>/v2.0/ +uri_v3 = <%= @identity_endpoint_scheme %>://<%= @identity_endpoint_host %>:<%= @identity_endpoint_port %>/v3/ v3_endpoint_type = publicURL strategy = keystone