0

I'm trying to test a change to the kitchen-hyperv driver locally, but can't figure out how I replace the driver bundled in test-kitchen with my local bits.

I've tried to install my local built kitchen-hyperv gem, but test-kitchen still uses its bundled version.

I'm not able to find any decriptions of how to replace an internal bundled test/kitchen driver, no matter what I search for.

1 Answers1

0

Unfortunately this isn't really doable. You can do a one-off by installing the new gem into ChefDK's ruby environment and then opening the kitchen executable and editing the appropriate gem line(s). There is also the slightly more automated appbundle-updater tool. But needless to say, we as a community don't really support either very much and you can easily leave your DK as a non-functional mess. If doing local development, it is often required that you stop using ChefDK entirely and instead use a more traditional bundler-based workflow. However this also requires you to take responsibility for some bits of environment management and generally requires more Ruby knowledge than ChefDK normally would.

coderanger
  • 52,400
  • 4
  • 52
  • 75
  • Thanks for the clarification. Are your recommondation that I clone the test-kitchen repo locally, tweak it to include my version of kitchen-hyperv , build it and use this for testing instead? – Eirik Bjornset Jan 30 '18 at 23:41
  • @EirikBjornset You do not have to clone test-kitchen, unless you really want. It would be enough to switch to bundler-based workflow, like coderanger mentioned. You will need at least two lines in Gemfile, for example: `gem "test-kitchen"` and `gem "your-driver", git: ""` and probably recent local ruby installation. – Szymon Jan 31 '18 at 05:59
  • If you are familiar with the "normal" Ruby development workflow, bundler is indeed the way to go. Just don't try to use _both_ ChefDK and a bundler-based system, down that path lies sadness. – coderanger Jan 31 '18 at 06:24
  • Thanks for the suggestions. I switched to bundler-based development yesterday. I'm all new to Ruby development , but based on your feedback I was able to integration test my changes when creating actual virtual machines from test-kitchen. When I cloned the test-kitchen repo I came across these instructions on how to test on windows: https://github.com/test-kitchen/test-kitchen/blob/master/testing_windows.md It states more or less the same instructions as you, but also that I should put my gem in the cookbook directory. That was not obvious to a Runy starter like me. – Eirik Bjornset Feb 01 '18 at 14:29