When using vagrant machines with test-kitchen the pre_create_command allows you to specify a command which is run locally before the vagrant machine is being created. With kitchen-docker no such configuration option seems to exist, and bending chef_omnibus_url as suggested here isn't an option.
The script specified as pre_create_command for the testing vagrants generates a local chef data bag.
Is there a solution around which I've overlooked?
Best practices include Rakefile and Thor.
In essence you control your tests from a Rakefile. For example:
rake style
This will run all commands under your style task (maybe lint/syntax/unit and kitchen tests). Of course you can modify your tasks to perform whatever you like. Here are some good resources:
https://blog.chef.io/2015/04/21/overview-of-test-driven-infrastructure-with-chef/
See the Supporting Tools and Dependencies section.
Here is an example Rakefile:
https://github.com/chef-cookbooks/chef-server/blob/master/Rakefile
I sketched a patch for kitchen-docker here. However, as the discussion on this pull request shows, there are arguments against an appropriate functionality in kitchen-docker, namely the one that such functionality (if ever) should go in the kitchen core.
So for the time being we have to live with this inconsistency between docker and vagrant, and this is where thun's answer comes into play.
This can be done using
driver_config:
provision_command: <command>
in kitchen.yml
Check more here
Kr,
Rshad
Related
This one is quite strange.
I am running a very typical Docker container that holds a Rails API. Inside this API, I have an endpoint which takes an upload of a CSV and does some things and stuff.
Here is the exact flow:
vim spec/fixtuers/bid_update.csv
# fill it with some data
# now we call the spec that uses this fixture
docker-compose run --rm web bundle exec rspec spec/requests/bids_spec.rb
# and now the csv is loaded and I can see it as plaintext
However, after creating this, I decided to change the content of the CSV. So I do this, adding a column and respective value to it for each piece.
Now, however, when we run our spec again after saving this it has the old version of the CSV. The one originally used at the breakpoint in the spec.
cat'ing out the CSV shows it clearly should have the new content.
Restarting the VM does nothing. The only solution I've found is to docker-machine rm dev and build a new machine (my main one for this is called dev).
I am entirely perplexed as to what could cause this or a simple means to fix it (building with all those images takes a while).
Ideas? Inform me I'm an idiot and I just had to press 0 for an operator and they would have fixed it?
Any help appreciated :)
I think it could be an issue with how virtualbox shares folders with your environment. More information here https://github.com/mitchellh/vagrant/issues/351#issuecomment-1339640
Title says it all.
If I understand correctly, the Heroku VM environment provides some built-in binaries and then additional ones can be provided in a custom build pak.
Trial (by building a little test app) and error (by having the build fail) is the only way forward so far. Surely there's a better way.
I have read the Heroku docs and looked in obvious places in the Ruby build pak source. No list.
My immediate aim is to determine if a Rails app that requires GD2 graphics (the gd2-ruby gem) will build without a custom build pak. But the general question of binaries availability comes up again and again.
Run heroku run bash, and get a shell in a plain dyno. Then list all rpms installed by invoking dpkg --get-selections, as for example here: https://askubuntu.com/questions/17823/how-to-list-all-installed-packages or here: http://www.howtogeek.com/howto/linux/show-the-list-of-installed-packages-on-ubuntu-or-debian/
I am having a problem with the ExecJS in that it is unable to locate a required Runtime. I am using Windows, and I have both Windows CScript and Node.js installed on my computer, but neither of these guys are being invoked.
As a result, I am unable to run any rails task that involves this (I cannot even load my rake list in RubyMine to call actions such as db:create to create my databases from a fresh project.)
I am capable of accessing both csript and node from the command line, and I have checked my environment variables and their proper file locations are in the PATH. There's something else ruining my ability to use ExecJS. Has anyone else had a similar experience where you have had all of the right stuff, but something is still going wrong?
When Ruby spawns child process to invoke CScript or Node, it will use the same rules that allow cmd.exe execute them from the command line.
But, sometimes, stuff in your registry or your environment variables can affect this process.
At RubyInstaller project we collected a series of troubleshooting items that could possible be the culprit.
Please check that COMSPEC environment variable is set to use cmd.exe and nothing like TCC/LE or other stuff.
C:\>SET COMSPEC
Also, check that your registry do not contain an AutoRun key, which will also affect Ruby.
C:\>REG QUERY "HKCU\Software\Microsoft\Command Processor"
C:\>REG QUERY "HKLM\Software\Microsoft\Command Processor"
If you see a key AutoRun in one of the above commands, that means something is setup to automatically execute everytime a new cmd.exe is started, which is bad for some cases.
Please follow the instructions in the Troubleshooting page on how to remove it.
This also affects gem installation that requires compilation, but if is not failing for you then the problem might be something else.
Hope that helps.
I was having similar problems, my basic skeleton app wouldn't run despite having Node.js installed, and then trying therubyracer gem. Finally I decided to use my troubleshooting mantra with windows, "When in doubt, run as admin". So I ran my rails cmd as an admin and it worked fine after that.
When I run all my cucumber features my system hangs, there seems to be a memory leak. I would like to find out which features create this problem. There are lot of feature files so I cannot run them individually
Using the pretty formatter will print the feature and scenario names as the tests run
cucumber --format pretty
You can also add this to the cucumber.yml config file if you are using rake to run the cukes.
When I rake my db in emacs, it fails– although it works fine in terminal. The error is related specifically to an environment variable that emacs doesn't seem to be picking up on. What is the best way to resolve this in .emacs? Do I need to source my profile every time I start emacs?
Which emacs shell are you using? There are a few different types which are good for different cases. I recently read this article which you may find informative: http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/
I suggest trying simply M-x shell which will simply run your default shell in emacs (usually bash).