diff --git a/recipes/setup.rb b/recipes/setup.rb index 8e2271a..12ca167 100644 --- a/recipes/setup.rb +++ b/recipes/setup.rb @@ -45,9 +45,7 @@ admin_pass = get_password 'user', admin_user admin_project = node['openstack']['identity']['admin_project'] admin_domain = node['openstack']['identity']['admin_domain_name'] admin_project_domain_name = node['openstack']['identity']['admin_project_domain'] -# TODO(ramereth): commenting this out until -# https://github.com/fog/fog-openstack/pull/494 gets merged and released. -# endpoint_type = node['openstack']['identity']['endpoint_type'] +endpoint_type = node['openstack']['identity']['endpoint_type'] connection_params = { openstack_auth_url: auth_url, @@ -55,7 +53,7 @@ connection_params = { openstack_api_key: admin_pass, openstack_project_name: admin_project, openstack_domain_name: admin_domain, - # openstack_endpoint_type: endpoint_type, + openstack_endpoint_type: endpoint_type, } %w(user1 user2).each_with_index do |user| @@ -89,22 +87,28 @@ include_recipe 'openstack-common' tempest_path = '/opt/tempest' venv_path = '/opt/tempest-venv' -execute "virtualenv #{venv_path}" do +case node['platform'] +when 'debian' + venv_cmd = 'virtualenv -p python3' +when 'fedora', 'rhel' + venv_cmd = 'virtualenv' +end + +execute 'create virtualenv for tempest' do + command "#{venv_cmd} #{venv_path}" creates venv_path end -execute 'install tempest' do - action :nothing - command "#{venv_path}/bin/pip install ." - cwd tempest_path -end +# Note(jh): Make sure to keep the constraint definition in sync with +# the tempest version +tempest_ver = '22.0.0' +constraint = '-c https://opendev.org/openstack/requirements/raw/'\ + 'branch/stable/train/upper-constraints.txt' -git tempest_path do - repository 'https://github.com/openstack/tempest' - reference '17.2.0' - depth 1 - action :sync - notifies :run, 'execute[install tempest]', :immediately +execute 'install tempest' do + command "#{venv_path}/bin/pip install #{constraint} tempest==#{tempest_ver}" + cwd tempest_path + creates "#{venv_path}/bin/tempest" end template "#{venv_path}/tempest.sh" do @@ -153,7 +157,7 @@ node.default['openstack']['integration-test']['conf'].tap do |conf| conf['compute']['image_ref'] = node['openstack']['integration-test']['image1']['id'] conf['compute']['image_ref_alt'] = node['openstack']['integration-test']['image2']['id'] conf['identity']['uri_v3'] = identity_endpoint.to_s - # conf['identity']['v3_endpoint_type'] = endpoint_type + conf['identity']['v3_endpoint_type'] = endpoint_type end node.default['openstack']['integration-test']['conf_secrets'].tap do |conf_secrets| diff --git a/spec/setup_spec.rb b/spec/setup_spec.rb index 7210cd8..dad4bd3 100644 --- a/spec/setup_spec.rb +++ b/spec/setup_spec.rb @@ -17,7 +17,7 @@ describe 'openstack-integration-test::setup' do openstack_api_key: 'admin', openstack_project_name: 'admin', openstack_domain_name: 'default', - # openstack_endpoint_type: 'internalURL', + openstack_endpoint_type: 'internalURL', } it 'installs tempest dependencies' do @@ -92,31 +92,18 @@ describe 'openstack-integration-test::setup' do end it do - expect(chef_run).to run_execute('virtualenv /opt/tempest-venv').with(creates: '/opt/tempest-venv') + expect(chef_run).to run_execute('create virtualenv for tempest').with(creates: '/opt/tempest-venv') end it do - expect(chef_run).to nothing_execute('install tempest') + expect(chef_run).to run_execute('install tempest') .with( - command: '/opt/tempest-venv/bin/pip install .', - cwd: '/opt/tempest' + command: '/opt/tempest-venv/bin/pip install -c https://opendev.org/openstack/requirements/raw/branch/stable/train/upper-constraints.txt tempest==22.0.0', + cwd: '/opt/tempest', + creates: '/opt/tempest-venv/bin/tempest', ) end - it 'syncs /opt/tempest from github' do - expect(chef_run).to sync_git( - '/opt/tempest' - ).with( - repository: 'https://github.com/openstack/tempest', - reference: '17.2.0', - depth: 1 - ) - end - - it do - expect(chef_run.git('/opt/tempest')).to notify('execute[install tempest]').to(:run).immediately - end - it 'uploads image1' do expect(chef_run).to upload_openstack_image_image('image1').with( identity_user: 'admin', @@ -174,11 +161,11 @@ describe 'openstack-integration-test::setup' do ) end - # it 'has an endpoint type matching the default value' do - # expect(chef_run).to render_file(file.name).with_content( - # 'endpoint_type = internalURL' - # ) - # end + it 'has a v3 endpoint type matching the default value' do + expect(chef_run).to render_file(file.name).with_content( + 'v3_endpoint_type = internalURL' + ) + end it 'discovers compute hosts' do expect(chef_run).to run_execute('discover_hosts')