Permalink
Browse files

Added MiniTest tests.

  • Loading branch information...
1 parent b76beb8 commit 6e1105815fb6b2848f92fe3f0ed6e07346f928b8 @hectcastro committed May 26, 2012
Showing with 54 additions and 1 deletion.
  1. +53 −0 files/default/tests/minitest/statsd_test.rb
  2. +1 −1 metadata.rb
@@ -0,0 +1,53 @@
+require "minitest/autorun"
+require "socket"
+
+describe_recipe "statsd::default" do
+ include MiniTest::Chef::Assertions
+ include MiniTest::Chef::Context
+ include MiniTest::Chef::Resources
+
+ describe "files" do
+ it "creates the share directory" do
+ directory(node["statsd"]["dir"]).must_exist
+ end
+
+ it "creates the configuration directory" do
+ directory(node["statsd"]["conf_dir"]).must_exist
+ end
+
+ it "creates the configuration file" do
+ file("#{node["statsd"]["conf_dir"]}/config.js").must_exist
+ end
+
+ it "creates the Upstart script" do
+ file("/etc/init/statsd.conf").must_exist
+ end
+
+ it "creates the log file" do
+ file(node["statsd"]["log_file"]).must_exist
+ end
+ end
+
+ describe "users" do
+ it "creates a daemon user" do
+ user("statsd").must_exist
+ end
+ end
+
+ describe "services" do
+ it "runs as a daemon" do
+ service("statsd").must_be_running
+ end
+
+ it "accepts connections" do
+ s = TCPSocket.new("127.0.0.1", 8126)
+ s.puts("help\r\n")
+ help = s.gets
+ s.close
+
+ assert(help =~ /Commands:/)
+ end
+ end
+end
+
+
View
@@ -2,7 +2,7 @@
maintainer_email "hectcastro@gmail.com"
license "Apache 2.0"
description "Installs and configures StatsD."
-version "0.0.2"
+version "0.0.3"
recipe "statsd", "Installs and configures StatsD"
%w{ git logrotate nodejs }.each do |d|

0 comments on commit 6e11058

Please sign in to comment.