puppet-openstack-integration/playbooks/run-unit-tests.yaml
Alex Schultz 0914577244 Disable strict variables for unit tests
So rspec-puppet 2.4+ has strict variables enabled
which causes test failures. The problem is that the puppet modules
have never worked with strict_variables = true due to backwards
compatibility & import ordering.  Since this has not been true,
lets disable it in the unit testing for now. Perhaps some day
we will be able to turn this back to true.  This should allow us to lift
the 2.3.x cap that we added as part of
https://review.opendev.org/#/c/618854/.

Change-Id: Idbf837e87072c829c94e0356b8536088cf98c3bb
2019-04-24 20:36:47 +00:00

31 lines
1.4 KiB
YAML

- hosts: all
tasks:
- name: install ruby bundler and run it
shell:
cmd: |
if [ "{{ puppet_gem_version }}" != "latest" ]; then
export PUPPET_GEM_VERSION='~> {{ puppet_gem_version }}'
fi
# TODO(tobias-urdin): Remove when we dont pin rspec-puppet
export RSPEC_PUPPET_VERSION='{{ rspec_puppet_version }}'
# NOTE(aschultz): rspec-puppet 2.4+ has strict variables enabled
# which causes test failures. The problem is that the puppet modules
# have never worked with strict_variables = true due to backwards
# compatibility & import ordering. Since this has not been true,
# lets disable it in the unit testing for now. Perhaps some day
# we will be able to turn this back to true.
export STRICT_VARIABLES=no
mkdir .bundled_gems
export GEM_HOME=`pwd`/.bundled_gems
ruby <<EOF
cmd = 'gem install bundler --no-rdoc --no-ri --verbose'
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.3.0') then
cmd += ' -v 1.17.3'
end
system(cmd)
EOF
$GEM_HOME/bin/bundle install --retry 3
$GEM_HOME/bin/bundle exec rake spec SPEC_OPTS='--format documentation'
chdir: '{{ ansible_user_dir }}/workspace'
environment: '{{ zuul | zuul_legacy_vars }}'