Atalanta / cucumber-chef

Framework for test-driven infrastructure development
http://cucumber-chef.org
Apache License 2.0
265 stars 55 forks source link

node has no roles, run list #131

Open perplexes opened 11 years ago

perplexes commented 11 years ago

After having a successful run, I wanted to see the chef data on the container. Should it have data? I assume so. Without this I can't test deploying to the container with cc-knife search node :/

colin@blackbook:~/src/verba/chef-repo$ bin/cc-knife node list
cc-knife v3.0.8
verba-web

colin@blackbook:~/src/verba/chef-repo$ bin/cc-knife node show verba-web
cc-knife v3.0.8
Node Name:   verba-web
Environment: test
FQDN:        verba-web
IP:          192.168.0.1
Run List:    
Roles:       
Recipes:     
Platform:    ubuntu 10.04
Tags:
zpatten commented 11 years ago

Did you actually set any roles, etc during your cuke run? Where is that output?

perplexes commented 11 years ago

Yes. Here is my Labfile:

#!/usr/bin/env ruby
#^syntax detection

ecosystem "verba-ecosystem" do

  container "verba-web" do
    distro "ubuntu"
    release "lucid"
    persist true
    ip "192.168.0.1"
    mac "00:00:5e:35:ea:d5"
    chef_client  ({
      :environment => "test",
      :run_list => ["role[verba_compete_web]"]
    })
  end

end

The container's /etc/chef/attributes.json picks up the role:

root@verba-web:~# cat /etc/chef/attributes.json
{"environment":"test","run_list":["role[verba_compete_web]"]}

Here's the cuke run:

colin@blackbook:~/src/verba/chef-repo$ VERBOSE=1 bin/cucumber
Code:
  * features/support/env.rb
  * features/support/cc-hooks.rb
>>> cucumber-chef v3.0.8
>>> Pushing chef-repo environments to the test lab completed in 1.7068 seconds.
>>> Pushing chef-repo cookbooks to the test lab completed in 6.2111 seconds.
>>> Pushing chef-repo roles to the test lab completed in 4.5149 seconds.
>>> Creating container 'verba-web' completed in 0.3468 seconds.
>>> Provisioning container 'verba-web' completed in 277.5350 seconds.
Failed to load 'md' programming language for file features/verba/README.md: cannot load such file -- cucumber/md_support/md_language
  * features/verba/README.md [NOT SUPPORTED]
  * features/verba/step_definitions/verba_steps.rb

Features:
  * features/chef-client.feature
  * features/verba/web.feature
Parsing feature files took 0m0.023s

Using the default profile...
@chef-client
Feature: Chef-Client Role
  In order to automate server provisioning with Opscode Chef
  As a DevOp Engineer
  I want to ensure that chef-client is daemonized on my servers

  Background:                                              # features/chef-client.feature:7
    * I ssh to "verba-web" with the following credentials: # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:28
      | username | keyfile |
      | $lxc$    | $lxc$   |

  Scenario: Chef-Client is running as a daemon             # features/chef-client.feature:12
    When I run "ps aux | grep [c]hef-client"               # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:62
    Then the exit code should be "0"                       # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:84
    And I should see "chef-client" in the output           # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68
    And I should see "-i 1800" in the output               # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68
    And I should see "-s 300" in the output                # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68

  Scenario: The Chef-Server validation key has been removed # features/chef-client.feature:19
    When I run "[[ ! -e /etc/chef/validation.pem ]]"        # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:62
    Then the exit code should be "0"                        # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:84

@verba
Feature: verba
  In order to automate server provisioning with Opscode Chef
  As a DevOp Engineer
  I want to ensure that verba is running on my servers

  Background:                                              # features/verba/web.feature:7
    * I ssh to "verba-web" with the following credentials: # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:28
      | username | keyfile |
      | $lxc$    | $lxc$   |

  Scenario: apache2 is running as a daemon                 # features/verba/web.feature:12
    When I run "ps aux | grep [a]pache2"                   # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:62
    Then the exit code should be "0"                       # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:84
    And I should see "apache2" in the output               # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68

  Scenario: monit is running as a daemon                   # features/verba/web.feature:17
    When I run "ps aux | grep [m]onit"                     # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:62
    Then the exit code should be "0"                       # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:84
    And I should see "monitrc" in the output               # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68

4 scenarios (4 passed)
17 steps (17 passed)
0m1.617s

Please let me know if there's anything else I can do to help resolve this issue.

Does this not happen with you and your setup? Do you get nodes populated with run lists and roles in your vagrant chef-server?

pikesley commented 11 years ago

Works for me:

[{~/Github/odi-chef} <2.0.0@cc3> (master) ] ➔ cucumber
Code:
  * features/support/env.rb
  * features/support/cc-hooks.rb
>>> cucumber-chef v3.0.8
>>> Pushing chef-repo environments to the test lab completed in 1.4136 seconds.

<snip snip snip>

  Scenario: Ruby 1.9.3 is installed                                 # features/quirkafleeg/webnode.feature:66
    * I run "su - quirkafleeg -c 'ruby -v'"                         # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:62
    * I should see "1.9.3" in the output                            # cucumber-chef-3.0.8/lib/cucumber/chef/steps/ssh_steps.rb:68

9 scenarios (9 passed)
37 steps (37 passed)
0m3.031s
[{~/Github/odi-chef} <2.0.0@cc3> (master) ] ➔ cc-knife node show web-quirkafleeg-01
cc-knife v3.0.8
Node Name:   web-quirkafleeg-01
Environment: cucumber
FQDN:        web-quirkafleeg-01.test-lab
IP:          192.168.99.30
Run List:    role[quirkafleeg], role[base], role[chef-client], role[webnode]
Roles:       quirkafleeg, base, chef-client, webnode
Recipes:     build-essential, git, postfix, ntp, odi-users, mysql::client, dictionary, nodejs::install_from_package, chef-client::delete_validation, chef-client::config, chef-client::service, odi-rvm, envbuilder, quirkafleeg-deployment
Platform:    ubuntu 12.04
Tags:
[{~/Github/odi-chef} <2.0.0@cc3> (master) ] ➔

Not sure what I'd be doing differently to you.

S

perplexes commented 11 years ago

I figured it out - there were unresolved errors in my runs, since I'm still developing the cookbooks for the node.

I think I'll enter a feature request for tests to fail if the provisioning fails.