# Issues running Test Kitchen in Audit mode

**URL:** <https://discourse.chef.io/t/issues-running-test-kitchen-in-audit-mode/6957>\
**Category:** Chef Infra (archive)\
**Created:** [September 8, 2015, 5:58pm UTC](https://discourse.chef.io/t/issues-running-test-kitchen-in-audit-mode/6957 "2015-09-08T17:58:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rajakulasingam\_Anush](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Rajakulasingam\_Anush](https://discourse.chef.io/u/Rajakulasingam_Anush)\
**Post date:** [September 8, 2015, 5:58pm UTC](https://discourse.chef.io/t/issues-running-test-kitchen-in-audit-mode/6957/1 "2015-09-08T17:58:47Z")

</div>

Hello all,

I'm attempting to use test kitchen with chef-audit to test some of my audits but running into the following error:

```
   [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'

```

See below for debug info. This runs fine on the actual server but via test kitchen fails with the above message... any ideas?

# Application Versions

Test Kitchen: 1.4.0  
Chef-Client: 12.3.0  
Chefdk: 0.6.2 Release: 1.el6

# Kitchen YML File

* * *

driver:  
name: ssh  
hostname: \<%= ENV['vagrant\_ip'] %\>  
port: '22'  
username: username  
password: xxxxxxxx

provisioner:  
name: chef\_zero  
client\_rb:  
audit\_mode: :audit\_only  
platforms:

- name: rhel-6.3

suites:

- name: default  
run\_list:
  - recipe[test-audit::default]  
attributes:

# default.rb Recipe/Audit

# 

# Cookbook Name:: test-audit

# Recipe:: default

# 

# Copyright (c) 2015 The Authors, All Rights Reserved.

control\_group 'Blog Post Examples' do  
control 'SSH' do  
it 'should be listening on port 22' do  
expect(port(22)).to be\_listening  
end  
end  
end

# Trace from Test Kitchen

-----\> Starting Kitchen (v1.4.0)  
-----\> Cleaning up any prior instances of   
-----\> Destroying ...  
Kitchen-ssh does not destroy your server '' by shutting it down...  
Shutdown your server '' natively with user ''  
in your cloud or virtualisation console etc.\n  
Finished destroying (0m0.00s).  
-----\> Testing   
-----\> Creating ...  
Kitchen-ssh does not start your server '10.126.69.72' but will look for an ssh connection with user 'vagrant'  
[SSH] Established  
Kitchen-ssh found ssh ready on host '10.126.69.72' with user 'vagrant'

```
   Finished creating <default-rhel-63> (0m1.21s).

```

-----\> Converging ...  
$$$$$$ Running legacy converge for 'Ssh' Driver  
Preparing files for transfer  
Preparing dna.json  
Resolving cookbook dependencies with Berkshelf 3.3.0...  
Removing non-cookbook files before transfer  
Preparing validation.pem  
Preparing client.rb  
-----\> Chef Omnibus installation detected (install only if missing)  
Transferring files to   
Starting Chef Client, version 12.0.3  
[2015-09-08T13:42:37-04:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json  
resolving cookbooks for run list: ["test-audit::default"]  
Synchronizing Cookbooks:  
- test-audit  
Compiling Cookbooks...

```
   ================================================================================
   Recipe Compile Error in /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb
   ================================================================================

   NoMethodError
   -------------
   No resource or method named `control_group' for `Chef::Recipe "default"'

   Cookbook Trace:
   ---------------
     /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:7:in `from_file'

   Relevant File Content:
   ----------------------
   /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:

     1: #
     2: # Cookbook Name:: test-audit
     3: # Recipe:: default
     4: #
     5: # Copyright (c) 2015 The Authors, All Rights Reserved.
     6:
     7>> control_group 'Blog Post Examples' do
     8: control 'SSH' do
     9: it 'should be listening on port 22' do
    10: expect(port(22)).to be_listening
    11: end
    12: end
    13: end
    14:

   Running handlers:
   [2015-09-08T13:42:37-04:00] ERROR: Running exception handlers
   Running handlers complete
   [2015-09-08T13:42:37-04:00] ERROR: Exception handlers complete
   [2015-09-08T13:42:37-04:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
   Chef Client failed. 0 resources updated in 8.00419466 seconds
   [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
   [2015-09-08T13:42:39-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

```

> > > > > > Converge failed on instance .  
> > > > > > Please see .kitchen/logs/default-rhel-63.log for more details  
> > > > > > ------Exception-------  
> > > > > > Class: Kitchen::ActionFailed  
> > > > > > Message: SSH exited (1) for command: [sh -c '

sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log\_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889  
']

> > > > > > * * *

Thanks,  
Anushan Rajakulasingam

---

<div class="post-metadata">

**Author:** ![jdunn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jdunn/32/1800_2.png) [@jdunn](https://discourse.chef.io/u/jdunn)\
**Post date:** [September 8, 2015, 11:38pm UTC](https://discourse.chef.io/t/issues-running-test-kitchen-in-audit-mode/6957/2 "2015-09-08T23:38:54Z")

</div>

The output indicates you're running Chef Client 12.0.3 not 12.3.0.  
Audit mode was added in 12.1.0.

> **[Chef Client 12.1.0 Released - Chef Blog | Chef](https://www.chef.io/blog/chef-12-1-0-released)**
>
> Ohai Chefs, 
> Today, we’re excited to announce that Chef Client 12.

- Julian

On Tue, Sep 8, 2015 at 1:58 PM, Rajakulasingam, Anushan  
[Anushan.Rajakulasingam@cibc.com](mailto:Anushan.Rajakulasingam@cibc.com) wrote:

> Hello all,
> 
> I'm attempting to use test kitchen with chef-audit to test some of my audits but running into the following error:
> 
> ```
> [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
> 
> ```
> 
> See below for debug info. This runs fine on the actual server but via test kitchen fails with the above message... any ideas?
> 
> # Application Versions
> 
> Test Kitchen: 1.4.0  
> Chef-Client: 12.3.0  
> Chefdk: 0.6.2 Release: 1.el6
> 
> # Kitchen YML File
> 
> * * *
> 
> driver:  
> name: ssh  
> hostname: \<%= ENV['vagrant\_ip'] %\>  
> port: '22'  
> username: username  
> password: xxxxxxxx
> 
> provisioner:  
> name: chef\_zero  
> client\_rb:  
> audit\_mode: :audit\_only  
> platforms:
> 
> - name: rhel-6.3
> 
> suites:
> 
> - name: default  
> run\_list:
> - recipe[test-audit::default]  
> attributes:
> 
> # default.rb Recipe/Audit
> 
> # 
> 
> # Cookbook Name:: test-audit
> 
> # Recipe:: default
> 
> # 
> 
> # Copyright (c) 2015 The Authors, All Rights Reserved.
> 
> control\_group 'Blog Post Examples' do  
> control 'SSH' do  
> it 'should be listening on port 22' do  
> expect(port(22)).to be\_listening  
> end  
> end  
> end
> 
> # Trace from Test Kitchen
> 
> -----\> Starting Kitchen (v1.4.0)  
> -----\> Cleaning up any prior instances of   
> -----\> Destroying ...  
> Kitchen-ssh does not destroy your server '' by shutting it down...  
> Shutdown your server '' natively with user ''  
> in your cloud or virtualisation console etc.\n  
> Finished destroying (0m0.00s).  
> -----\> Testing   
> -----\> Creating ...  
> Kitchen-ssh does not start your server '10.126.69.72' but will look for an ssh connection with user 'vagrant'  
> [SSH] Established  
> Kitchen-ssh found ssh ready on host '10.126.69.72' with user 'vagrant'
> 
> ```
> Finished creating <default-rhel-63> (0m1.21s).
> 
> ```
> 
> -----\> Converging ...  
> $$$$$$ Running legacy converge for 'Ssh' Driver  
> Preparing files for transfer  
> Preparing dna.json  
> Resolving cookbook dependencies with Berkshelf 3.3.0...  
> Removing non-cookbook files before transfer  
> Preparing validation.pem  
> Preparing client.rb  
> -----\> Chef Omnibus installation detected (install only if missing)  
> Transferring files to   
> Starting Chef Client, version 12.0.3  
> [2015-09-08T13:42:37-04:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json  
> resolving cookbooks for run list: ["test-audit::default"]  
> Synchronizing Cookbooks:  
> - test-audit  
> Compiling Cookbooks...
> 
> ```
> ================================================================================
> Recipe Compile Error in /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb
> ================================================================================
> 
> NoMethodError
> -------------
> No resource or method named `control_group' for `Chef::Recipe "default"'
> 
> Cookbook Trace:
> ---------------
> /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:7:in `from_file'
> 
> Relevant File Content:
> ----------------------
> /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:
> 
> 1: #
> 2: # Cookbook Name:: test-audit
> 3: # Recipe:: default
> 4: #
> 5: # Copyright (c) 2015 The Authors, All Rights Reserved.
> 6:
> 7>> control_group 'Blog Post Examples' do
> 8: control 'SSH' do
> 9: it 'should be listening on port 22' do
> 10: expect(port(22)).to be_listening
> 11: end
> 12: end
> 13: end
> 14:
> 
> Running handlers:
> [2015-09-08T13:42:37-04:00] ERROR: Running exception handlers
> Running handlers complete
> [2015-09-08T13:42:37-04:00] ERROR: Exception handlers complete
> [2015-09-08T13:42:37-04:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
> Chef Client failed. 0 resources updated in 8.00419466 seconds
> [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
> [2015-09-08T13:42:39-04:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
> 
> ```
> 
> > > > > > > Converge failed on instance .  
> > > > > > > Please see .kitchen/logs/default-rhel-63.log for more details  
> > > > > > > ------Exception-------  
> > > > > > > Class: Kitchen::ActionFailed  
> > > > > > > Message: SSH exited (1) for command: [sh -c '
> 
> sudo -E /opt/chef/bin/chef-client --local-mode --config /tmp/kitchen/client.rb --log\_level auto --force-formatter --no-color --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889  
> ']
> 
> > > > > > > * * *
> 
> Thanks,  
> Anushan Rajakulasingam

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](http://www.aquezada.com/staff/julian) \* only Web 1.0 ]  
[gopher://sdf.org/1/users/keymaker/ \* compliant!]  
[PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9]

---

<div class="post-metadata">

**Author:** ![Rajakulasingam\_Anush](https://avatars.discourse-cdn.com/v4/letter/r/e19b73/32.png) [@Rajakulasingam\_Anush](https://discourse.chef.io/u/Rajakulasingam_Anush)\
**Post date:** [September 9, 2015, 2:48pm UTC](https://discourse.chef.io/t/issues-running-test-kitchen-in-audit-mode/6957/3 "2015-09-09T14:48:22Z")

</div>

Interesting...

On console if I type `chef-client -version`  
It spits out:  
Chef: 12.3.0

But the running client itself is reporting 12.0.3 in the output... is this a bug?

Thanks,  
Anushan Rajakulasingam

-----Original Message-----  
From: Julian C. Dunn [[mailto:jdunn@aquezada.com](mailto:jdunn@aquezada.com)]  
Sent: Tuesday, September 08, 2015 7:39 PM  
To: [chef@lists.opscode.com](mailto:chef@lists.opscode.com)  
Subject: [chef] Re: Issues running Test Kitchen in Audit mode

The output indicates you're running Chef Client 12.0.3 not 12.3.0.  
Audit mode was added in 12.1.0.

> **[Chef Client 12.1.0 Released - Chef Blog | Chef](https://www.chef.io/blog/chef-12-1-0-released)**
>
> Ohai Chefs, 
> Today, we’re excited to announce that Chef Client 12.

- Julian

On Tue, Sep 8, 2015 at 1:58 PM, Rajakulasingam, Anushan [Anushan.Rajakulasingam@cibc.com](mailto:Anushan.Rajakulasingam@cibc.com) wrote:

> Hello all,
> 
> I'm attempting to use test kitchen with chef-audit to test some of my audits but running into the following error:
> 
> ```
> [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
> 
> ```
> 
> See below for debug info. This runs fine on the actual server but via test kitchen fails with the above message... any ideas?
> 
> # Application Versions
> 
> Test Kitchen: 1.4.0  
> Chef-Client: 12.3.0  
> Chefdk: 0.6.2 Release: 1.el6
> 
> # Kitchen YML File
> 
> * * *
> 
> driver:  
> name: ssh  
> hostname: \<%= ENV['vagrant\_ip'] %\>  
> port: '22'  
> username: username  
> password: xxxxxxxx
> 
> provisioner:  
> name: chef\_zero  
> client\_rb:  
> audit\_mode: :audit\_only  
> platforms:
> 
> - name: rhel-6.3
> 
> suites:
> 
> - name: default  
> run\_list:
> - recipe[test-audit::default]  
> attributes:
> 
> # default.rb Recipe/Audit
> 
> # 
> 
> # Cookbook Name:: test-audit
> 
> # Recipe:: default
> 
> # 
> 
> # Copyright (c) 2015 The Authors, All Rights Reserved.
> 
> control\_group 'Blog Post Examples' do  
> control 'SSH' do  
> it 'should be listening on port 22' do  
> expect(port(22)).to be\_listening  
> end  
> end  
> end
> 
> # Trace from Test Kitchen
> 
> -----\> Starting Kitchen (v1.4.0)  
> -----\> Cleaning up any prior instances of Destroying  
> -----\> ...  
> Kitchen-ssh does not destroy your server '' by shutting it down...  
> Shutdown your server '' natively with user ''  
> in your cloud or virtualisation console etc.\n  
> Finished destroying (0m0.00s).  
> -----\> Testing   
> -----\> Creating ...  
> Kitchen-ssh does not start your server '10.126.69.72' but will look for an ssh connection with user 'vagrant'  
> [SSH] Established  
> Kitchen-ssh found ssh ready on host '10.126.69.72' with user 'vagrant'
> 
> ```
> Finished creating <default-rhel-63> (0m1.21s).
> 
> ```
> 
> -----\> Converging ...  
> $$$$$$ Running legacy converge for 'Ssh' Driver  
> Preparing files for transfer  
> Preparing dna.json  
> Resolving cookbook dependencies with Berkshelf 3.3.0...  
> Removing non-cookbook files before transfer  
> Preparing validation.pem  
> Preparing client.rb  
> -----\> Chef Omnibus installation detected (install only if missing)  
> Transferring files to   
> Starting Chef Client, version 12.0.3  
> [2015-09-08T13:42:37-04:00] WARN: Child with name 'dna.json' found in multiple directories: /tmp/kitchen/dna.json and /tmp/kitchen/dna.json  
> resolving cookbooks for run list: ["test-audit::default"]  
> Synchronizing Cookbooks:  
> - test-audit  
> Compiling Cookbooks...
> 
> ```
> ================================================================================
> Recipe Compile Error in /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb
> 
> ```
> 
> # ======================================================================
> 
> ```
> NoMethodError
> -------------
> No resource or method named `control_group' for `Chef::Recipe "default"'
> 
> Cookbook Trace:
> ---------------
> /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:7:in `from_file'
> 
> Relevant File Content:
> ----------------------
> /tmp/kitchen/cache/cookbooks/test-audit/recipes/default.rb:
> 
> 1: #
> 2: # Cookbook Name:: test-audit
> 3: # Recipe:: default
> 4: #
> 5: # Copyright (c) 2015 The Authors, All Rights Reserved.
> 6:
> 7>> control_group 'Blog Post Examples' do
> 8: control 'SSH' do
> 9: it 'should be listening on port 22' do
> 10: expect(port(22)).to be_listening
> 11: end
> 12: end
> 13: end
> 14:
> 
> Running handlers:
> [2015-09-08T13:42:37-04:00] ERROR: Running exception handlers
> Running handlers complete
> [2015-09-08T13:42:37-04:00] ERROR: Exception handlers complete
> [2015-09-08T13:42:37-04:00] FATAL: Stacktrace dumped to /tmp/kitchen/cache/chef-stacktrace.out
> Chef Client failed. 0 resources updated in 8.00419466 seconds
> [2015-09-08T13:42:37-04:00] ERROR: No resource or method named `control_group' for `Chef::Recipe "default"'
> [2015-09-08T13:42:39-04:00] FATAL: 
> 
> ```
> 
> Chef::Exceptions::ChildConvergeError: Chef run process exited  
> unsuccessfully (exit code 1)
> 
> > > > > > > Converge failed on instance .  
> > > > > > > Please see .kitchen/logs/default-rhel-63.log for more details  
> > > > > > > ------Exception-------  
> > > > > > > Class: Kitchen::ActionFailed  
> > > > > > > Message: SSH exited (1) for command: [sh -c '
> 
> sudo -E /opt/chef/bin/chef-client --local-mode --config  
> /tmp/kitchen/client.rb --log\_level auto --force-formatter --no-color  
> --json-attributes /tmp/kitchen/dna.json --chef-zero-port 8889 ']
> 
> > > > > > > * * *
> 
> Thanks,  
> Anushan Rajakulasingam

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](http://www.aquezada.com/staff/julian) \* only Web 1.0 ]  
[gopher://sdf.org/1/users/keymaker/ \* compliant!]  
[PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9]
