Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add examples

  • Loading branch information...
commit a220a8b9195098d10f982da1fbc3c360d7076e0b 1 parent 90fd669
Zachary Patten authored
View
7 examples/README.md
@@ -0,0 +1,7 @@
+Examples
+========
+
+This directory contains various examples in the form of early feature tests for some of my cookbooks. You can find out more about the cookbooks on GitHub:
+
+https://github.com/jovelabs
+https://github.com/zpatten
View
51 examples/users_add.feature
@@ -0,0 +1,51 @@
+@users
+Feature: Perform test driven infrastructure with Cucumber-Chef
+ In order to learn how to develop test driven infrastructure
+ As an infrastructure developer
+ I want to better understand how to use Cucumber-Chef
+
+ Background:
+ * I have a server called "users"
+ * "users" is running "ubuntu" "lucid"
+ * "users" has been provisioned
+ * the following roles have been updated:
+ | role | role_path |
+ | users | ./support/roles/ |
+ * the "users" role has been added to the "users" run list
+ * the following databags have been updated:
+ | databag | databag_path |
+ | users | ./support/data_bags/users |
+ * the chef-client has been run on "users"
+ * I ssh to "users" with the following credentials:
+ | username | keyfile |
+ | root | ../.ssh/id_rsa |
+
+ Scenario: The user has been added
+ When I run "cat /etc/passwd | grep [b]dobbs"
+ Then I should see "bdobbs" in the output
+ And I should see "/home/bdobbs" in the output
+ And I should see "/bin/bash" in the output
+
+ Scenario: The user's groups have been added
+ When I run "cat /etc/group | grep [b]dobbs"
+ Then I should see "bdobbs" in the output
+ And I should see "sysop" in the output
+ And I should see "dba" in the output
+ And I should see "dev" in the output
+
+ Scenario: The user's ssh keys have been populated
+ When I run "cat /home/bdobbs/.ssh/authorized_keys"
+ Then I should see "ssh-rsa" in the output
+ And I should see "bob@dobbs" in the output
+
+ Scenario: The user's ssh config has been populated
+ When I run "cat /home/bdobbs/.ssh/config"
+ Then I should see "KeepAlive yes" in the output
+ And I should see "ServerAliveInterval 60" in the output
+
+ Scenario: The user can ssh in to the system with their key pair
+ * I ssh to "users" with the following credentials:
+ | username | keyfile |
+ | bdobbs | ./support/keys/bdobbs |
+ When I run "hostname"
+ Then I should see "users" in the output
View
50 examples/users_auto_remove.feature
@@ -0,0 +1,50 @@
+@users
+Feature: Perform test driven infrastructure with Cucumber-Chef
+ In order to learn how to develop test driven infrastructure
+ As an infrastructure developer
+ I want to better understand how to use Cucumber-Chef
+
+ Background:
+ * I have a server called "users"
+ * "users" is running "ubuntu" "lucid"
+ * "users" has been provisioned
+ * the following roles have been updated:
+ | role | role_path |
+ | users | ./support/roles/ |
+ * the "users" role has been added to the "users" run list
+ * the following databags have been updated:
+ | databag | databag_path |
+ | users | ./support/data_bags/users |
+ * the chef-client has been run on "users"
+ * I ssh to "users" with the following credentials:
+ | username | keyfile |
+ | root | ../.ssh/id_rsa |
+
+ Scenario: The user has been removed
+ * the following databags have been updated:
+ | databag | databag_path |
+ | users | ./support/data_bags/users-auto-remove |
+ * the chef-client has been run on "users"
+ When I run "cat /etc/passwd | grep [b]dobbs"
+ Then I should not see "bdobbs" in the output
+ And I should not see "/home/bdobbs" in the output
+ And I should not see "/bin/bash" in the output
+
+ Scenario: The user's group has been removed
+ * the following databags have been updated:
+ | databag | databag_path |
+ | users | ./support/data_bags/users-auto-remove |
+ * the chef-client has been run on "users"
+ When I run "cat /etc/group | grep [b]dobbs"
+ Then I should not see "bdobbs" in the output
+ And I should not see "sysop" in the output
+ And I should not see "dba" in the output
+ And I should not see "dev" in the output
+
+ Scenario: The user's directory has been preserved on remove
+ * the following databags have been updated:
+ | databag | databag_path |
+ | users | ./support/data_bags/users-auto-remove |
+ * the chef-client has been run on "users"
+ When I run "[[ -e /home/bdobbs ]] && echo OK"
+ Then I should see "OK" in the output
Please sign in to comment.
Something went wrong with that request. Please try again.