[openstack-dev] [puppet] how to run rspec tests? r10k issue

Sofer Athlan-Guyot sathlang at redhat.com
Fri Feb 26 13:25:27 UTC 2016


Hi Matt,

Matt Fischer <matt at mattfischer.com> writes:

> I ended up symlinking the r10k binary I have installed to the place it
> wants it to be and it worked. I do have that in my Gemfile. Question
> is, can we make this work without manual steps?

Well, I was thinking I had a smart way to fix as it was working on my
env.  It turns out that it was only because of a strange setup that my
"GEM_HOME=~/" trick was working.

In the end, I discovered that bundler always set GEM_HOME and so the
scripts of the puppet-openstack-integration always set GEM_BIN_DIR to
the wrong path.

I've created this bug report[1] and this fix[2].  It seems to be working
well on my env.  It shouldn't change anything to the Openstack CI as the
function is install_all is not used inside a proper ZUUL environment.

One less pain,

I discovered afterwards that you've already created the bug report
there[3].  Sorry for the duplicate.

As a side note, it's kind of hard to test it as the directory where the
function is is recreated at each run of "bundle exec rake spec_prep"
from gerrit/master. So here is what I did:
 1. run it once and let it fail;
 2. apply this:

cat > /tmp/fix <<EOF
--- lib/puppet-openstack_spec_helper/rake_tasks.rb.orig 2016-02-26 14:19:00.955396358 +0100
+++ lib/puppet-openstack_spec_helper/rake_tasks.rb      2016-02-26 14:19:09.856505122 +0100
@@ -49,7 +49,7 @@
     zuul_branch = ENV['ZUUL_BRANCH']
     zuul_url = ENV['ZUUL_URL']
     repo = 'openstack/puppet-openstack-integration'
-    rm_rf(repo)
+#    rm_rf(repo)
     if File.exists?('/usr/zuul-env/bin/zuul-cloner')
       zuul_clone_cmd = ['/usr/zuul-env/bin/zuul-cloner']
       zuul_clone_cmd += ['--cache-dir', '/opt/git']
@@ -59,7 +59,7 @@
       zuul_clone_cmd += ['git://git.openstack.org', "#{repo}"]
       sh(*zuul_clone_cmd)
     else
-      sh("git clone https://git.openstack.org/#{repo} #{repo}")
+#      sh("git clone https://git.openstack.org/#{repo} #{repo}")
     end
     script = ['env']
     script += ["PUPPETFILE_DIR=#{Dir.pwd}/spec/fixtures/modules"]
EOF

running this (from your bundler env)

   cat /tmp/fix | patch -d $(bundle show puppet-openstack_spec_helper) -p0

and then, still from your bundler env, you can apply the patch:

--- openstack/puppet-openstack-integration/functions.orig       2016-02-26 14:22:10.246709340 +0100
+++ openstack/puppet-openstack-integration/functions    2016-02-26 14:22:15.395772257 +0100
@@ -48,7 +48,7 @@
 # - ``SCRIPT_DIR`` must be set to script path
 # - ``GEM_BIN_DIR`` must be set to Gem bin directory
 install_all() {
-  PUPPETFILE=${SCRIPT_DIR}/Puppetfile ${GEM_BIN_DIR}r10k puppetfile install -v
+  PUPPETFILE=${SCRIPT_DIR}/Puppetfile r10k puppetfile install -v
 }
 
 # Install Puppet OpenStack modules and dependencies by using

Kinda complicated ... certainly why I didn't bother earlier.

[1] https://bugs.launchpad.net/puppet-openstack-integration/+bug/1550331
[2] https://review.openstack.org/285285
[3] https://bugs.launchpad.net/puppet-keystone/+bug/1548872

>
> On Thu, Feb 18, 2016 at 4:57 PM, Alex Schultz <aschultz at mirantis.com>
> wrote:
>
>     
>     
>     
>     
>     
>     
>     On Thu, Feb 18, 2016 at 3:26 PM, Matt Fischer
>     <matt at mattfischer.com> wrote:
>     
>     
>         Is anyone able to share the secret of running spec tests since
>         the r10k transition? bundle install && bundle exec rake spec
>         have issues because r10k is not being installed. Since I'm not
>         the only one hopefully this question will help others.
>         
>         
>         
>         +
>         PUPPETFILE=/etc/puppet/modules/keystone/openstack/puppet-openstack-integration/Puppetfile
>        
>         + /var/lib/gems/1.9.1/bin/r10k puppetfile install -v
>         /etc/puppet/modules/keystone/openstack/puppet-openstack-integration/functions:
>         line 51: /var/lib/gems/1.9.1/bin/r10k: No such file or
>         directory
>         rake aborted!
>
>     
>     
>     I assume you were trying to run the tests on the keystone module
>     so it should have been installed with the bundle install as it is
>     listed in the Gemfile[0]. Are you sure your module is up to date?
>     
>     
>     -Alex
>     
>     
>     [0]
>     https://github.com/openstack/puppet-keystone/blob/master/Gemfile#L26
>    
>     
>     __________________________________________________________________________
>        
>         OpenStack Development Mailing List (not for usage questions)
>         Unsubscribe:
>         OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>         http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>        
>         
>         
>
>     __________________________________________________________________________
>    
>     OpenStack Development Mailing List (not for usage questions)
>     Unsubscribe:
>     OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
>     http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev
>     
>     
>
>
> __________________________________________________________________________
> OpenStack Development Mailing List (not for usage questions)
> Unsubscribe: OpenStack-dev-request at lists.openstack.org?subject:unsubscribe
> http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev

-- 
Sofer Athlan-Guyot



More information about the OpenStack-dev mailing list