2
votes

I'm trying to run kitchen with my actual test suite using LXC, I have tried kitchen delegating to vagrant-lxc and kitchen-lxc both without any luck. Using kitchen-lxc my kitchen.yml looks this way:

driver_plugin: lxc
driver_config:
  require_chef_omnibus: false

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver_config:
      base_container: "opscode-ubuntu-12.04"
      username: ubuntu
      password: ubuntu

suites:
  - name: default
    run_list:
      - recipe[project::default]

and when I run kitchen test I'm getting

Failed to complete #create action: [Permission denied - /var/lib/lxc/opscode-ubuntu-12.04-L1qycdk8K0J0/config] (Kitchen::ActionFailed)

In this case I have a vagrant-lxc box and I'm not configuring paths or something to tell kitchen where the container is, how can this be done?

Using vagrant-lxc plugin I configured kitchen.yml this way:

---
driver:
  name: vagrant
  require_chef_omnibus: false
  require_chef_berkshelf: true
  driver_config:
    require_chef_omnibus: false
    provider: lxc

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver_config:
      box: "opscode-ubuntu-12.04"
      box_url: "http://dl.company.com/boxes/vagrant-lxc-precise-amd64.box"

suites:
  - name: default
    run_list:
      - recipe[project::default]

On this case this is what I got:

["sudo", "lxc-create", "--template", "vagrant-tmp-opscode-ubuntu-1204_default_1393616342539_80654", "--name", "opscode-ubuntu-1204_default_1393616342539_80654", "-f", "/home/user/.vagrant.d/boxes/opscode-ubuntu-12.04/lxc/lxc.conf", "--", "--tarball", "/home/user/.vagrant.d/boxes/opscode-ubuntu-12.04/lxc/rootfs.tar.gz", "--auth-key", "/opt/vagrant/embedded/gems/gems/vagrant-1.4.3/keys/vagrant.pub"]

I think the problem is with the template name but I might be wrong, what would be the problem?

Either way I want to solve my issue, please provide some advices.

Forgot to tell that running an lxc container using pure Vagrantfile with vagrant-lxc works fine so is not a problem of tools.

1

1 Answers

0
votes

I ended up using kitchen-vagrant and LXC through Vagrant instead of using kitchen-lxc. so it will be approach 2 with some changes, look below:

---
driver:
  name: vagrant
  require_chef_omnibus: false
  require_chef_berkshelf: true
  driver_config:
    require_chef_omnibus: false

provisioner:
  name: chef_solo

platforms:
  - name: ubuntu-12.04
    driver:
      box: "ubuntu-12.04"
      box_url: "http://dl.company.com/boxes/vagrant-lxc-precise-amd64.box"
      provider: lxc

Also, as an advice, one should ensure the vagrant-lxc box you use work fine under vagran-lxc before starting a test-kitchen work-flow,

Hope it helps to others.