Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding Attributes to Test Kitchen

I'm trying to override attributes in the java cookbook with test-kitchen.

When I try run kitchen converge default-centos-64, a bad YAML error shows up.

---
driver:
  name: vagrant
  customize:
    memory: 1024
    cpuexecutioncap: 50

provisioner:
  name: chef_solo

platforms:
  - name: centos-6.4

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes: {
                  java.install_flavor: "oracle",
                  java.jdk_version: "7"
                }

I pasted the above into http://yamllint.com/. When I hit "Go," it removes all lines beginning at "attributes", and then shows a Green "Valid YAML".

like image 354
Kevin Meredith Avatar asked Apr 22 '14 15:04

Kevin Meredith


People also ask

What does kitchen test do?

Test Kitchen is Chef's integrated testing framework. It enables writing test recipes, which will run on the VMs once they are instantiated and converged using the cookbook. The test recipes run on that VM and can verify if everything works as expected. ChefSpec is something which only simulates a Chef run.

What is kitchen Yaml?

Kitchen is a testing framework provided by chef. kitchen. yml is a fairly simple file. Its purpose is to provide configurations for the kitchen setup.

What is kitchen converge?

A converge will leave the machine running and kitchen automatically uploads changes each converge so that one can iterate rapidly on configuration code. A lot of time and effort has gone into ensuring that the exit code of kitchen is always appropriate.


1 Answers

Attributes are supplied as normal yaml content:

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes:
       java:
         install_flavor: "oracle",
         jdk_version: "7"

The Getting Started shows a syntax similar to yours:

suites:
  - name: default
    run_list: 
      - recipe[java::default]
      - recipe[maven::default]
    attributes: { 'java': { 'install_flavor': 'oracle' } }
like image 155
StephenKing Avatar answered Nov 09 '22 09:11

StephenKing