0

I'm trying to set up kitchen and having difficulties with this aspect.

As far as I can tell, the yml looks correct but it's constantly error'ing when running the recipe.

The error: LoadError

cannot load such file -- chef/provisioning/aws_driver
and
[2017-07-04T15:09:11+00:00] ERROR: cannot load such file -- chef/provisioning/aws_driver
[2017-07-04T15:09:11+00:00] ERROR: cannot load such file -- chef/provisioning/aws_driver

my yml is:

driver:
name: ec2
aws_ssh_key_id: key
security_group_ids: ["sg-", "sg-"]
reqion: us-east-1
require_chef_omnibus: true
subnet_id: subnet-x
instance_type: t2.micro
associate_public_ip: true
interface: public

provisioner:
name: chef_zero

platforms:

name: amazon-linux
driver:
image_id: ami-a4c7edb2
transport:
ssh_key: C:\Keys.pem
connection_timeout: 10
connection_retries: 5
username: ec2-user
suites:

name: default
run_list:
recipe[solr::default]
attributes:
null
  • 3,469
  • 7
  • 41
  • 90
  • Chef-provisioning and Test Kitchen have nothing to do with each other. Which are you trying to use? – coderanger Jul 05 '17 at 07:35
  • the recipe I'm rtying to test has 'require 'chef/provisioning/aws_driver' with_driver 'aws:Test:us-east-1'' in it which I think test kitchen is objecting to – null Jul 05 '17 at 07:36
  • 1
    Indeed, and chances are running that recipe in Test Kitchen won't do much since the thing you would be testing is the host running the recipe, not the EC2 instance that gets created by it. You would probably need to reconfigure TK to install ChefDK instead of the normal Chef installers, which is doable but as mentioned probably useless in the end. – coderanger Jul 05 '17 at 07:43
  • What are you trying to test? – coderanger Jul 05 '17 at 07:43
  • @coderanger - I've a recipe with several ruby blocks in and was wanting to test converge time results etc. – null Jul 05 '17 at 08:14
  • But if the the that recipe is doing is EC2 provisioning, you're not going to get things cleaned up afterwards without some very fancy coding. We don't have a testing system for chef-provisioning that I'm aware of. – coderanger Jul 05 '17 at 08:20
  • @coderanger - thank you for helping / clarifying - back to the drawing baord :) – null Jul 05 '17 at 08:25
  • I should say that we don't have integration testing systems, you can use ChefSpec as per normal which would be enough for testing `ruby_block` stuff if mocked carefully. – coderanger Jul 05 '17 at 08:32

1 Answers1

1

Resolved in comments, Test Kitchen normally installs the standard Chef installer package which does not include chef-provisioning. You can set it up to install and use ChefDK instead but this requires some complex configuration and currently has some major performance issues so it isn't recommended.

More directly in case people find this by Google, you can't (currently) use Test Kitchen to test chef-provisioning code as we have no systems in place to clean things up at the end of tests, nor is there a way to test anything about the systems that get created other than the Kitchen instance VM itself.

coderanger
  • 52,400
  • 4
  • 52
  • 75