Fauxhai, ChefSpec, and airgapped Automate 1 Workflow runners

Sean Horn -

 

If you run https://github.com/chefspec/chefspec in an airgapped Automate 1 Workflow runner environment and specify platform/version to test, you will find the tests failing when trying to contact raw.githubusercontent.com. Why is it doing those connections? ChefSpec depends on Fauxhai, and Fauxhai's default behavior is to use the internet. https://github.com/chefspec/fauxhai/blob/86699f314c1dae2533f8877dfaeff237c21742a5/lib/fauxhai/mocker.rb#L50

There is fake Ohai data at the endpoints specified, like this, when the platform is ubuntu, and the version. Notice how the last two components of this URI path would change if you were to change the platform/version specification? That's exactly what happens when Fauxhai builds the necessary request for ubuntu/16.04 or any other acceptable combination https://raw.githubusercontent.com/chefspec/fauxhai/master/lib/fauxhai/platforms/ubuntu/16.04.json

You will need to download the data appropriate for your mocked platform/version and place it in a filesystem location reachable when the workflow runner build tries to do the ChefSpec testing.

You can specify the location for the file like this, with "config.path"

RSpec.configure do |config|
   config.platform = 'redhat'
   config.version = '7.4'
   config.path "ohai.json'
end
Have more questions? Submit a request

Comments

Powered by Zendesk