Rich Megginson (richmegginson) wrote,
Rich Megginson
richmegginson

Running puppet-keystone spec tests in docker container

I am working on adding features to puppet-keystone such as support for configuring Keystone to use the LDAP identity backend, read-only as well as read-write, and to have multiple LDAP identity backends.  I wanted to easily run tests on different platforms using docker.

I started with a fedora 20 docker image, and installed the ruby and ruby bundle packages.  I called this image "puppet-keystone".  In order to share my development source code working directory, I mount my home directory inside the container as "/share".  In order for the container to have access, I need to create my user and group inside the container:

# groupadd -g 1000 rmeggins
# useradd -g rmeggins -u 1000 rmeggins


I ran docker like this:

$ sudo docker run -v /home/rmeggins:/share -i -t -u 1000 puppet-keystone


However, I could not see /share - permission denied.  Not sure why, but I figured that I had to run the container with --privileged like this:

$ sudo docker run --privileged -v /home/rmeggins:/share -i -t -u 1000 puppet-keystone


This allowed me full access to the /share volume.

Then I ran the test setup:

$ cd /share/puppet-keystone
$ GEM_HOME=vendor bundle install
$ GEM_HOME=vendor bundle exec rake spec SPEC_OPTS="--format d"


This caused errors reading from manifests/wsgi/apache.pp:

  1) keystone::wsgi::apache on RedHat platforms configures apache serving keysto
ne with mod_wsgi
     Failure/Error: it { should contain_service('httpd').with_name(platform_para
meters[:httpd_service_name]) }
     Puppet::Error:
       invalid byte sequence in US-ASCII at /share/puppet-keystone/spec/fixtures
/modules/keystone/manifests/wsgi/apache.pp:1 on node 82d2ea5b23ae.redhat.com
     Shared Example Group: "apache serving keystone with mod_wsgi" called from .
/spec/classes/keystone_wsgi_apache_spec.rb:195


Sure enough, file reports a different type for that file:

$ find manifests -name "*.pp" | xargs file
...
manifests/init.pp:                      ASCII text
manifests/endpoint.pp:                  C++ source, ASCII text
manifests/python.pp:                    C++ source, ASCII text
manifests/service.pp:                   C++ source, ASCII text
manifests/cron/token_flush.pp:          C++ source, ASCII text
manifests/wsgi/apache.pp:               C++ source, UTF-8 Unicode text


For some reason, inside the container, it can't read this file, but I don't have this problem from the host.  I was able to work around the problem in the container by running the test like this:

$ LC_CTYPE=C.UTF-8 LANG=C.UTF-8 GEM_HOME=vendor bundle exec rake spec SPEC_OPTS="--format d"


Now I am able to run the tests successfully with no errors
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments