test-kitchen / kitchen-digitalocean

A Test Kitchen driver for DigitalOcean

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to create custom platform names

jwadolowski opened this issue · comments

Hey,

I've just tried to migrate some of my test-kitchen suites from vagrant driver to digitalocean one, but it seems I'm not able to get the same flow I had so far.

The case is I need to iterate over platforms to create <platform>-<chef_version> pairs. Here's the .kitchen.yml file that works fine for me when vagrant driver is used:

---
<% chef_versions = %w( 11 12 ) %>
<% platforms = %w( centos-6.6 centos-7.1 ) %>

driver:
  name: vagrant
  customize:
    memory: 3072

provisioner:
  name: chef_zero
  data_path: test/shared

platforms:
<% platforms.each do |p| %>
<%   chef_versions.each do |chef_version| %>
  - name: <%= p %>-chef-<%= chef_version %>
    driver_config:
      box: opscode-<%= p %>
      box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_<%= p %>_chef-provisionerless.box
      require_chef_omnibus: <%= chef_version %>
<%   end %>
<% end %>

suites:
  - name: suite1
  - name: suite2

Whenever I execute kitchen list I get the following:

Instance                  Driver   Provisioner  Verifier  Transport  Last Action
suite1-centos-66-chef-11  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite1-centos-66-chef-12  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite1-centos-71-chef-11  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite1-centos-71-chef-12  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite2-centos-66-chef-11  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite2-centos-66-chef-12  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite2-centos-71-chef-11  Vagrant  ChefZero     Busser    Ssh        <Not Created>
suite2-centos-71-chef-12  Vagrant  ChefZero     Busser    Ssh        <Not Created>

and that's what I expect.

I applied the same flow for digitalocean driver with the following .kitchen.yml file:

---
<% chef_versions = %w( 11 12 ) %>
<% platforms = %w( centos-6.5-x64 centos-7-0-x64 ) %>

driver:
  name: digitalocean
  driver_config:
    region: fra1
    size: 2gb

provisioner:
  name: chef_zero
  data_path: test/shared

<% platforms.each do |p| %>
<%   chef_versions.each do |chef_version| %>
platforms:
  - name: <%= p %>-chef-<%= chef_version %>
    driver:
      image: <%= p %>
    driver_config:
      require_chef_omnibus: <%= chef_version %>
<%   end %>
<% end %>

suites:
  - name: suite1
  - name: suite2

but the result was as follows:

Instance                       Driver        Provisioner  Verifier  Transport  Last Action
suite1-centos-7-0-x64-chef-12  Digitalocean  ChefZero     Busser    Ssh        <Not Created>
suite2-centos-7-0-x64-chef-12  Digitalocean  ChefZero     Busser    Ssh        <Not Created>

It looks like just the last platform/chef_version pair from the loop is taken into consideration for each test suite.

Thanks in advance.

@jwadolowski If your copy-pastes are both accurate, it looks like your platforms: line is slightly out of place in your DigitalOcean config.

<% platforms.each do |p| %>
<%   chef_versions.each do |chef_version| %>
platforms:

This would create multiple platforms: sections rather than one section with multiple platforms listed in it. It should be:

platforms:
<% platforms.each do |p| %>
<%   chef_versions.each do |chef_version| %>

like what you have in the first, working example.

@RoboticCheese - thanks!

I was moving lines back and forth in my .kitchen.yml and didn't notice that I misplaced platforms: one.