chef-boneyard / delivery-sugar

DEPRECATED: Library cookbook that adds sugar to build cookbooks for Chef Delivery
Apache License 2.0
12 stars 26 forks source link

Can't pass environment variables to delivery_test_kitchen even though it's accounted for. #38

Open qubitrenegade opened 7 years ago

qubitrenegade commented 7 years ago

Hello,

In delivery_test_kitchen.rb we clearly expect @environment to be passed in, otherwise, why would we parameters[:environment] || {} and not just set it to {} out of the gate?

However, it does not appear that we can actually pass in environment attributes as setting something like:

delivery_test_kitchen 'unit_create' do
  driver 'ec2'
  suite 'default'
  environment('TK_EC2_REGION' => 'us-west-2', 'TK_MACHINE_SIZE' => 't2.micro')
  action :test
end

Results in an error "no function environment" or so...

Basically we're making heavy use of environment variables as Team A might not have access to the same EC2 VPCs as Team B. But save pointing to a different region, ami, etc. it's the same process. so we have a .kitchen.yml:

driver:
  name: ec2
  region: <%= ENV['TK_EC2_REGION'] %>
  instance_type: <%= ENV['TK_INSTANCE_TYPE'] %>

Team A might have a shell script

#!/usr/bin/env bash
export TK_EC2_REGION = us-west-2
export TK_INSTANCE_TYPE = t2.micro

and Team B gets

#!/usr/bin/env bash
export TK_EC2_REGION= us-east-1
export TK_INSTANCE_TYPE = t1.large

What we'd like to see is the ability to pass "arbitrary" environment variables to our Test Kitchen run.

Thanks!