Permalink
Browse files

Add some tests

  • Loading branch information...
1 parent 7057a6b commit 3b5504145f7b82df5972fbec44a23ffe24042bd9 @markolson committed Aug 29, 2013
View
@@ -0,0 +1,3 @@
+.DS_Store
+.kitchen/
+.kitchen.local.yml
View
@@ -0,0 +1,17 @@
+---
+driver_plugin: vagrant
+driver_config:
+ require_chef_omnibus: true
+
+platforms:
+- name: ubuntu-12.04
+ driver_config:
+ box: opscode-ubuntu-12.04
+ box_url: https://opscode-vm-bento.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
+
+suites:
+- name: default
+ run_list:
+ - recipe[minitest-handler]
+ - recipe[ssh_test]
+ attributes: {}
View
1 .rvmrc
@@ -0,0 +1 @@
+rvm --create use 1.9.3@chefssh
View
@@ -0,0 +1,4 @@
+metadata
+
+cookbook "minitest-handler"
+cookbook "ssh_test", :path => "./test/cookbooks/ssh_test"
View
@@ -0,0 +1,16 @@
+{
+ "sources": {
+ "ssh": {
+ "path": "."
+ },
+ "minitest-handler": {
+ "locked_version": "0.2.1"
+ },
+ "ssh_test": {
+ "path": "./test/cookbooks/ssh_test"
+ },
+ "chef_handler": {
+ "locked_version": "1.1.4"
+ }
+ }
+}
View
@@ -1,5 +1,9 @@
# CHANGELOG for ssh
+## 0.6.4
+
+* Use OHAI to determine the user's $HOME (Tom Duckering)
+
## 0.6.3:
* Fixed libary to make /root instead of /home/root work (Vincent Gijsen)
View
@@ -4,4 +4,4 @@
license "Apache 2.0"
description "LWRPs for managing SSH known_hosts and config files"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version "0.6.3"
+version "0.6.4"
@@ -0,0 +1,13 @@
+ssh_test CHANGELOG
+==================
+
+This file is used to list changes made in each version of the ssh_test cookbook.
+
+0.1.0
+-----
+- [your_name] - Initial release of ssh_test
+
+- - -
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
No changes.
@@ -0,0 +1,34 @@
+require 'minitest/spec'
+
+describe_recipe 'ssh::default' do
+ it "creates a 'root' config" do
+ file("/root/.ssh/config").must_exist.with(:mode, "600").with(:owner, "root")
+ file("/root/.ssh/config").must_include 'Host github.com'
+ end
+
+ it "creates a 'root' known_hosts" do
+ file("/root/.ssh/known_hosts").must_exist.with(:mode, "644").with(:owner, "root")
+ file("/root/.ssh/known_hosts").must_include 'github.com'
+ end
+
+ it "creates a 'vagrant' config" do
+ file("/home/vagrant/.ssh/config").must_exist.with(:mode, "600").with(:owner, "vagrant")
+ file("/home/vagrant/.ssh/config").must_include 'Host github.com'
+ end
+
+ it "creates a 'vagrant' known_hosts" do
+ file("/home/vagrant/.ssh/known_hosts").must_exist.with(:mode, "644").with(:owner, "vagrant")
+ file("/home/vagrant/.ssh/known_hosts").must_include '|1|' #haha how do you TEST THIS
+ end
+
+ it "creates a 'faked' config" do
+ file("/tmp/bitty/.ssh/config").must_exist.with(:mode, "600").with(:owner, "faked")
+ file("/tmp/bitty/.ssh/config").must_include 'Host github.com'
+ end
+
+ it "creates a 'faked' known_hosts" do
+ file("/tmp/bitty/.ssh/known_hosts").must_exist.with(:mode, "644").with(:owner, "faked")
+ file("/tmp/bitty/.ssh/known_hosts").must_include 'github.com'
+ end
+
+end
@@ -0,0 +1,10 @@
+name 'ssh_test'
+maintainer 'Mark Olson'
+maintainer_email 'theothermarkolson@gmail.com'
+license 'All rights reserved'
+description 'Runs some tests for Chef-SSH'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version '0.1.0'
+
+
+depends 'ssh'
@@ -0,0 +1,42 @@
+include_recipe 'ssh'
+
+ssh_known_hosts "github.com" do
+ hashed false
+ user 'root'
+end
+
+ssh_config "github.com" do
+ options 'User' => 'git', 'IdentityFile' => '/tmp/gh'
+ user 'root'
+end
+
+ssh_known_hosts "github.com" do
+ hashed true
+ user 'vagrant'
+end
+
+ssh_config "github.com" do
+ options 'User' => 'git', 'IdentityFile' => '/tmp/gh'
+ user 'vagrant'
+end
+
+
+user "faked" do
+ comment "Not A Real Person"
+ uid 1000
+ gid "users"
+ system true
+ home "/tmp/bitty"
+ shell "/bin/zsh"
+ password "weeeeeeeeeeeee"
+end
+
+ssh_known_hosts "github.com" do
+ hashed false
+ user 'faked'
+end
+
+ssh_config "github.com" do
+ options 'User' => 'git', 'IdentityFile' => '/tmp/gh'
+ user 'faked'
+end

0 comments on commit 3b55041

Please sign in to comment.