voxpupuli / onceover

Your gateway drug to automated infrastructure testing with Puppet
141 stars 45 forks source link

Issue running Onceover within a Docker container #317

Open jortencio opened 2 years ago

jortencio commented 2 years ago

There seems to be an issue when running Onceover within a Docker container as it is unable to find the classes that it is testing. I believe this is due to Dockers interaction with symbolic links on a mounted volume.

To reproduce the issue, run onceover (3.20.0) within a puppet-dev-tools:4.x container against a control-repo mounted from a given location on the local filesystem (in this case ~/Projects/control-repo) to /repo: docker run --rm -u puppetdev -v ~/Projects/control-repo:/repo puppet/puppet-dev-tools:4.x /bin/bash -c "gem install bundler:2.2.29 && bundle install && bundle exec onceover run spec"

The output results in classes being not found as per the following output as it is unable to resolve the symbolic links:

image

When running in debug mode, it shows that symbolic links are being generated to reference these classes:

image

A workaround that I have found for this issue is to copy the contents of the mounted volume to another location on the containers filesystem:

docker run --rm -u puppetdev -v ~/Projects/control-repo:/repo puppet/puppet-dev-tools:4.x /bin/bash -c "cp -r /repo /home/puppetdev/ && cd /home/puppetdev/repo && gem install bundler:2.2.29 && bundle install && bundle exec onceover run spec"

image

The environment I used for testing this:

Docker Containers tested:

Control-repo tested: Basic control-repo cloned from the puppet control-repo template (https://github.com/puppetlabs/control-repo) with onceover initialised.