Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test-kitchen #74

Merged

Conversation

gravitystorm
Copy link
Contributor

This initial configuration uses kitchen-vagrant to test the tools cookbook.

I tried, and failed^Whaven't yet succeeded in getting more complex cookbooks to run, so I fell back on a pretty simple cookbook. Even then, there were challenges getting it to work with kitchen-docker, so I stuck with kitchen-vagrant for now.

The choice of a global test-kitchen setup vs a per-cookbook setup is not my first preference. Unfortunately there's no straightforward way to implement anything else, given our mono-repo and not using any cookbook publication systems. Using a global test-kitchen config is also the result that @zerebubuth came up with independently during work in June.

This initial configuration uses kitchen-vagrant to test the tools cookbook.
@gravitystorm
Copy link
Contributor Author

Oh, I should note that the "testing" of the tools cookbook only goes as far as the recipe converging successfully, it doesn't yet have any serverspec-based verification.

@gravitystorm gravitystorm mentioned this pull request Jul 28, 2016
@tomhughes
Copy link
Member

Hmm, so this seems to want to use virtualbox which is something that is not getting anywhere near my machine... Not sure if it is explicitly requesting that somehow or not, as I thought I had vagrant using libvirt...

@tomhughes
Copy link
Member

Ah you need to set VAGRANT_DEFAULT_PROVIDER=libvirt but then you find that the bento/ubuntu-16.04 box doesn't support the libvirt provider!

@gravitystorm
Copy link
Contributor Author

It's possible to override configuration using a .kitchen.local.yml file, if that's useful.

https://jjasghar.github.io/blog/2014/02/17/dot-kitchen-dot-local-dot-yml-and-when-you-want-to-use-it/

That should allow setting the driver provider, and will hopefully allow you to choose a different image.

@tomhughes
Copy link
Member

Yes I've managed to get it working now with the peru/ubuntu-16.04-server-amd64 box.

It's pretty slow mind - abut 3 minutes to run that one test on my machine.

@tomhughes
Copy link
Member

Just for the record this .kitchen.local.yml worked for me:

---
driver:
  provider: libvirt

platforms:
  - name: ubuntu-16.04
    driver:
      box: peru/ubuntu-16.04-server-amd64

@openstreetmap-mirror openstreetmap-mirror merged commit 0901083 into openstreetmap:master Jul 28, 2016
@gravitystorm gravitystorm deleted the test-kitchen-2 branch August 11, 2016 12:41
@mmd-osm
Copy link
Contributor

mmd-osm commented Sep 16, 2018

I really wondered how you test all those cookbooks and stumbled across this old pull request. Running anything non-trivial seems to be quite challenging due to lots and lots of dependencies (hardware, networking, hostnames, ... just to name a few).

Even then, there were challenges getting it to work with kitchen-docker, so I stuck with kitchen-vagrant for now.

I've changed my .kitchen.yml to run with docker and Ubuntu 18.04 running on a Ubuntu 18.04 host (which wasn't that good an idea, because of a missing postgres 9.5 on 18.04). This seems to be quite ok for the purpose of testing easy recipes, and performance isn't as bad as with virtualbox.

---
driver:
  name: docker
  provision: true
  vagrantfiles:
    - .kitchen.provision.rb
  provision_command: mkdir -p /run/sshd

provisioner:
  name: chef_zero
  roles_path: roles
  data_bags_path: test/data_bags
#  log_level: info

platforms:
  - name: ubuntu-18.04

systemd causes some serious screw up with Docker on Ubuntu 18.04, which could be resolved by adjusting the following line in /etc/default/grub and reboot (new systemd parameter added):

 GRUB_CMDLINE_LINUX_DEFAULT="quiet systemd.legacy_systemd_cgroup_controller=yes"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants