hansel 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.6
1
+ 0.1.7
data/hansel.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hansel}
8
- s.version = "0.1.6"
8
+ s.version = "0.1.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Paul Mylchreest"]
12
- s.date = %q{2010-05-05}
12
+ s.date = %q{2010-05-08}
13
13
  s.default_executable = %q{hansel}
14
14
  s.description = %q{Ruby driver for httperf - automated load and performance testing}
15
15
  s.email = %q{paul.mylchreest@mac.com}
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/httperf_result_parser.rb",
36
36
  "lib/octave_formatter.rb",
37
37
  "lib/yaml_formatter.rb",
38
+ "spec/arg_parser_spec.rb",
38
39
  "spec/httperf_result_parser_spec.rb",
39
40
  "spec/spec_helper.rb",
40
41
  "templates/octave.m.erb"
@@ -45,7 +46,8 @@ Gem::Specification.new do |s|
45
46
  s.rubygems_version = %q{1.3.6}
46
47
  s.summary = %q{Ruby driver for httperf - automated load and performance testing}
47
48
  s.test_files = [
48
- "spec/httperf_result_parser_spec.rb",
49
+ "spec/arg_parser_spec.rb",
50
+ "spec/httperf_result_parser_spec.rb",
49
51
  "spec/spec_helper.rb"
50
52
  ]
51
53
 
data/lib/arg_parser.rb CHANGED
@@ -30,6 +30,18 @@ module Hansel
30
30
  )
31
31
  end
32
32
 
33
+ #
34
+ # Uses OptionParser to return an OpenStruct object describing the options.
35
+ #
36
+ def parse
37
+ # The options specified on the command line will be collected in *options*.
38
+ # We set default values here.
39
+ OptionParser.new { |options| parse_options options}.parse!(@args)
40
+ @options
41
+ end
42
+
43
+ private
44
+
33
45
  def server_options options
34
46
  options.on("-s", "--server=S",
35
47
  "Specifies the IP hostname of the server.") do |server|
@@ -38,7 +50,7 @@ module Hansel
38
50
 
39
51
  options.on("-p", "--port=N",
40
52
  "Specifies the port number on which the server is listening.") do |port|
41
- @options.port = port
53
+ @options.port = port.to_i
42
54
  end
43
55
 
44
56
  options.on("-u", "--uri=S",
@@ -50,22 +62,22 @@ module Hansel
50
62
  def httperf_options options
51
63
  options.on("-n", "--num_conns=N",
52
64
  "Specifies the total number of connections to create.") do |num_conns|
53
- @options.num_conns = num_conns
65
+ @options.num_conns = num_conns.to_i
54
66
  end
55
67
 
56
68
  options.on("-l", "--low_rate=S",
57
69
  "Specifies the starting fixed rate at which connections are created.") do |low_rate|
58
- @options.low_rate = low_rate
70
+ @options.low_rate = low_rate.to_i
59
71
  end
60
72
 
61
73
  options.on("-l", "--high_rate=S",
62
74
  "Specifies the ending fixed rate at which connections are created.") do |high_rate|
63
- @options.high_rate = high_rate
75
+ @options.high_rate = high_rate.to_i
64
76
  end
65
77
 
66
78
  options.on("-l", "--rate_step=S",
67
79
  "Specifies the fixed rate step at which connections are created.") do |rate_step|
68
- @options.rate_step = rate_step
80
+ @options.rate_step = rate_step.to_i
69
81
  end
70
82
  end
71
83
 
@@ -76,7 +88,7 @@ module Hansel
76
88
  end
77
89
 
78
90
  options.on("-o", "--output=FILE", "Specify an output file.") do |output|
79
- @options.output = output
91
+ @options.output = !!output
80
92
  end
81
93
 
82
94
  options.on("-d", "--output_dir=PATH",
@@ -127,15 +139,5 @@ module Hansel
127
139
  end
128
140
  end
129
141
 
130
- #
131
- # Uses OptionParser to return an OpenStruct object describing the options.
132
- #
133
- def parse
134
- # The options specified on the command line will be collected in *options*.
135
- # We set default values here.
136
- OptionParser.new { |options| parse_options options}.parse!(@args)
137
- @options
138
- end
139
-
140
142
  end
141
143
  end
@@ -0,0 +1,57 @@
1
+ require File.dirname(__FILE__) + "/spec_helper"
2
+ require 'arg_parser'
3
+
4
+ describe Hansel::ArgParser, "#parse" do
5
+ before :each do
6
+ @argv = [
7
+ '--server=frunobulax.local',
8
+ '--port=4000',
9
+ '--uri=/',
10
+ '--num_conns=1',
11
+ '--low_rate=1',
12
+ '--high_rate=5',
13
+ '--rate_step=1',
14
+ '--format=octave',
15
+ '--output=true'
16
+ ]
17
+ @options = Hansel::ArgParser.new(@argv).parse
18
+ end
19
+
20
+ describe "should set the" do
21
+ it "server to 'frunobulax.local'" do
22
+ @options.server.should == 'frunobulax.local'
23
+ end
24
+
25
+ it "port to 4000" do
26
+ @options.port.should == 4000
27
+ end
28
+
29
+ it "uri to '/" do
30
+ @options.uri.should == '/'
31
+ end
32
+
33
+ it "num_conns to 1" do
34
+ @options.num_conns.should == 1
35
+ end
36
+
37
+ it "low_rate to 1" do
38
+ @options.low_rate.should == 1
39
+ end
40
+
41
+ it "high_rate to 5" do
42
+ @options.high_rate.should == 5
43
+ end
44
+
45
+ it "rate_step to 1" do
46
+ @options.rate_step.should == 1
47
+ end
48
+
49
+ it "output_format to 'octave'" do
50
+ @options.output_format.should == :octave
51
+ end
52
+
53
+ it "output to 'true'" do
54
+ @options.output.should == true
55
+ end
56
+ end
57
+ end
@@ -49,68 +49,68 @@ describe Hansel::HttperfResultParser, "#score" do
49
49
  @httperf_result.class.name =~ /HttperfResult/
50
50
  end
51
51
 
52
- describe "the HttperfResult object" do
53
- it "initialize the rate should be 10" do
52
+ describe "the HttperfResult object should initialize the" do
53
+ it "rate to 10" do
54
54
  @httperf_result.rate.should == 10
55
55
  end
56
56
 
57
- it "initialize the server to 'www.example.com'" do
57
+ it "server to 'www.example.com'" do
58
58
  @httperf_result.server.should == 'www.example.com'
59
59
  end
60
60
 
61
- it "initialize the port to 80" do
61
+ it "port to 80" do
62
62
  @httperf_result.port.should == 80
63
63
  end
64
64
 
65
- it "initialize the uri to '/'" do
65
+ it "uri to '/'" do
66
66
  @httperf_result.uri.should == '/'
67
67
  end
68
68
 
69
- it "initialize the num_conns to 100" do
69
+ it "num_conns to 100" do
70
70
  @httperf_result.num_conns.should == 100
71
71
  end
72
72
 
73
- it "the should be replies to 98" do
73
+ it "replies to 98" do
74
74
  @httperf_result.replies.should == 98
75
75
  end
76
76
 
77
- it "the connection_rate should be 9.9" do
77
+ it "connection_rate to 9.9" do
78
78
  @httperf_result.connection_rate.should == 9.9
79
79
  end
80
80
 
81
- it "the request_rate should be 9.9" do
81
+ it "request_rate should to 9.9" do
82
82
  @httperf_result.request_rate.should == 9.9
83
83
  end
84
84
 
85
- it "should set the reply_time to 90.1" do
85
+ it "reply_time to 90.1" do
86
86
  @httperf_result.reply_time.should == 90.1
87
87
  end
88
88
 
89
- it "the net_io should be 7.7" do
89
+ it "net_io to 7.7" do
90
90
  @httperf_result.net_io.should == 7.7
91
91
  end
92
92
 
93
- it "the errors should be 0" do
93
+ it "errors to 0" do
94
94
  @httperf_result.errors.should == 0
95
95
  end
96
96
 
97
- it "the status should be 1" do
97
+ it "status to 1" do
98
98
  @httperf_result.status.should == 1
99
99
  end
100
100
 
101
- it "reply_rate_min should be 9.8" do
101
+ it "reply_rate_min to 9.8" do
102
102
  @httperf_result.reply_rate_min.should == 9.8
103
103
  end
104
104
 
105
- it "the reply_rate_avg should be 9.9" do
105
+ it "the reply_rate_avg to 9.9" do
106
106
  @httperf_result.reply_rate_avg.should == 9.9
107
107
  end
108
108
 
109
- it "the reply_rate_max should be 10.0" do
109
+ it "the reply_rate_max to 10.0" do
110
110
  @httperf_result.reply_rate_max.should == 10.0
111
111
  end
112
112
 
113
- it "the reply_rate_stddev should be 0.1" do
113
+ it "the reply_rate_stddev to 0.1" do
114
114
  @httperf_result.reply_rate_stddev.should == 0.1
115
115
  end
116
116
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 6
9
- version: 0.1.6
8
+ - 7
9
+ version: 0.1.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Paul Mylchreest
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-05-05 00:00:00 -04:00
17
+ date: 2010-05-08 00:00:00 -04:00
18
18
  default_executable: hansel
19
19
  dependencies: []
20
20
 
@@ -44,6 +44,7 @@ files:
44
44
  - lib/httperf_result_parser.rb
45
45
  - lib/octave_formatter.rb
46
46
  - lib/yaml_formatter.rb
47
+ - spec/arg_parser_spec.rb
47
48
  - spec/httperf_result_parser_spec.rb
48
49
  - spec/spec_helper.rb
49
50
  - templates/octave.m.erb
@@ -78,5 +79,6 @@ signing_key:
78
79
  specification_version: 3
79
80
  summary: Ruby driver for httperf - automated load and performance testing
80
81
  test_files:
82
+ - spec/arg_parser_spec.rb
81
83
  - spec/httperf_result_parser_spec.rb
82
84
  - spec/spec_helper.rb