blitz 0.1.20 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +7 -2
- data/Gemfile.lock +8 -1
- data/README.md +26 -0
- data/Rakefile +5 -5
- data/blitz.gemspec +21 -10
- data/lib/blitz.rb +2 -1
- data/lib/blitz/command.rb +2 -32
- data/lib/blitz/command/curl.rb +13 -195
- data/lib/blitz/curl.rb +226 -0
- data/lib/blitz/curl/error.rb +1 -1
- data/lib/blitz/curl/rush.rb +12 -19
- data/lib/blitz/curl/sprint.rb +13 -17
- data/lib/blitz/utils.rb +38 -0
- data/spec/blitz/client_spec.rb +57 -0
- data/spec/blitz/command/api_spec.rb +42 -0
- data/spec/blitz/command/curl_spec.rb +4 -0
- data/spec/blitz/curl/rush_spec.rb +89 -0
- data/spec/blitz/curl/sprint_spec.rb +86 -0
- data/spec/blitz/curl_spec.rb +242 -0
- data/spec/spec_helper.rb +13 -0
- metadata +29 -26
- data/spec/command/curl_spec.rb +0 -244
data/spec/spec_helper.rb
ADDED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: blitz
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.21
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- pcapr
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-
|
13
|
+
date: 2012-02-07 00:00:00 -08:00
|
14
14
|
default_executable: blitz
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -69,41 +69,30 @@ dependencies:
|
|
69
69
|
prerelease: false
|
70
70
|
version_requirements: *id005
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
|
-
name:
|
72
|
+
name: term-ansicolor
|
73
73
|
requirement: &id006 !ruby/object:Gem::Requirement
|
74
74
|
none: false
|
75
75
|
requirements:
|
76
|
-
- -
|
76
|
+
- - "="
|
77
77
|
- !ruby/object:Gem::Version
|
78
|
-
version:
|
78
|
+
version: 1.0.5
|
79
79
|
type: :runtime
|
80
80
|
prerelease: false
|
81
81
|
version_requirements: *id006
|
82
82
|
- !ruby/object:Gem::Dependency
|
83
|
-
name:
|
83
|
+
name: rake
|
84
84
|
requirement: &id007 !ruby/object:Gem::Requirement
|
85
|
-
none: false
|
86
|
-
requirements:
|
87
|
-
- - ~>
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: "2.6"
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: *id007
|
93
|
-
- !ruby/object:Gem::Dependency
|
94
|
-
name: term-ansicolor
|
95
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
96
85
|
none: false
|
97
86
|
requirements:
|
98
87
|
- - "="
|
99
88
|
- !ruby/object:Gem::Version
|
100
|
-
version:
|
89
|
+
version: 0.9.0
|
101
90
|
type: :runtime
|
102
91
|
prerelease: false
|
103
|
-
version_requirements: *
|
92
|
+
version_requirements: *id007
|
104
93
|
- !ruby/object:Gem::Dependency
|
105
94
|
name: bundler
|
106
|
-
requirement: &
|
95
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
107
96
|
none: false
|
108
97
|
requirements:
|
109
98
|
- - ~>
|
@@ -111,10 +100,10 @@ dependencies:
|
|
111
100
|
version: 1.0.0
|
112
101
|
type: :development
|
113
102
|
prerelease: false
|
114
|
-
version_requirements: *
|
103
|
+
version_requirements: *id008
|
115
104
|
- !ruby/object:Gem::Dependency
|
116
105
|
name: jeweler
|
117
|
-
requirement: &
|
106
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
118
107
|
none: false
|
119
108
|
requirements:
|
120
109
|
- - ~>
|
@@ -122,7 +111,7 @@ dependencies:
|
|
122
111
|
version: 1.5.1
|
123
112
|
type: :development
|
124
113
|
prerelease: false
|
125
|
-
version_requirements: *
|
114
|
+
version_requirements: *id009
|
126
115
|
description: Make load and performance testing a fun sport
|
127
116
|
email: support@blitz.io
|
128
117
|
executables:
|
@@ -151,13 +140,21 @@ files:
|
|
151
140
|
- lib/blitz/command/help.rb
|
152
141
|
- lib/blitz/command/traceroute.rb
|
153
142
|
- lib/blitz/command/version.rb
|
143
|
+
- lib/blitz/curl.rb
|
154
144
|
- lib/blitz/curl/error.rb
|
155
145
|
- lib/blitz/curl/rush.rb
|
156
146
|
- lib/blitz/curl/sprint.rb
|
157
147
|
- lib/blitz/helper.rb
|
158
148
|
- lib/blitz/traceroute.rb
|
159
149
|
- lib/blitz/traceroute/error.rb
|
160
|
-
-
|
150
|
+
- lib/blitz/utils.rb
|
151
|
+
- spec/blitz/client_spec.rb
|
152
|
+
- spec/blitz/command/api_spec.rb
|
153
|
+
- spec/blitz/command/curl_spec.rb
|
154
|
+
- spec/blitz/curl/rush_spec.rb
|
155
|
+
- spec/blitz/curl/sprint_spec.rb
|
156
|
+
- spec/blitz/curl_spec.rb
|
157
|
+
- spec/spec_helper.rb
|
161
158
|
- test/helper.rb
|
162
159
|
- test/test_blitz.rb
|
163
160
|
has_rdoc: true
|
@@ -174,7 +171,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
174
171
|
requirements:
|
175
172
|
- - ">="
|
176
173
|
- !ruby/object:Gem::Version
|
177
|
-
hash:
|
174
|
+
hash: 824321089
|
178
175
|
segments:
|
179
176
|
- 0
|
180
177
|
version: "0"
|
@@ -192,6 +189,12 @@ signing_key:
|
|
192
189
|
specification_version: 3
|
193
190
|
summary: Make load and performance testing a fun sport
|
194
191
|
test_files:
|
195
|
-
- spec/
|
192
|
+
- spec/blitz/client_spec.rb
|
193
|
+
- spec/blitz/command/api_spec.rb
|
194
|
+
- spec/blitz/command/curl_spec.rb
|
195
|
+
- spec/blitz/curl/rush_spec.rb
|
196
|
+
- spec/blitz/curl/sprint_spec.rb
|
197
|
+
- spec/blitz/curl_spec.rb
|
198
|
+
- spec/spec_helper.rb
|
196
199
|
- test/helper.rb
|
197
200
|
- test/test_blitz.rb
|
data/spec/command/curl_spec.rb
DELETED
@@ -1,244 +0,0 @@
|
|
1
|
-
describe "parse_cli" do
|
2
|
-
attr_reader :curl
|
3
|
-
|
4
|
-
before :each do
|
5
|
-
@curl = Blitz::Command::Curl.new
|
6
|
-
class << @curl
|
7
|
-
def parse args
|
8
|
-
parse_cli args
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "url" do
|
14
|
-
it "should check that the args are not empty" do
|
15
|
-
lambda { curl.parse %w[] }.should raise_error(ArgumentError, /no URL specified!/)
|
16
|
-
end
|
17
|
-
|
18
|
-
it "should not check for URL when --help is specified" do
|
19
|
-
%w[-h --help].each do |h|
|
20
|
-
hash = curl.parse [h]
|
21
|
-
hash.should include 'help'
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
it "should succeed when a URL is given" do
|
26
|
-
hash = curl.parse %w[blitz.io]
|
27
|
-
hash.should include 'steps'
|
28
|
-
hash['steps'].should be_a(Array)
|
29
|
-
hash['steps'].size.should == 1
|
30
|
-
hash['steps'].first.should include 'url'
|
31
|
-
hash['steps'].first['url'].should == 'blitz.io'
|
32
|
-
end
|
33
|
-
|
34
|
-
it "should succeed when multiple URLs are given" do
|
35
|
-
hash = curl.parse %w[blitz.io docs.blitz.io]
|
36
|
-
hash.should include 'steps'
|
37
|
-
hash['steps'].should be_a(Array)
|
38
|
-
hash['steps'].size.should == 2
|
39
|
-
hash['steps'][0].should include 'url'
|
40
|
-
hash['steps'][0]['url'].should == 'blitz.io'
|
41
|
-
hash['steps'][1].should include 'url'
|
42
|
-
hash['steps'][1]['url'].should == 'docs.blitz.io'
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
context "user-agent" do
|
47
|
-
it "should check that a user-agent is given" do
|
48
|
-
lambda { curl.parse %w[--user-agent] }.should raise_error(MiniTest::Assertion, /missing value/)
|
49
|
-
end
|
50
|
-
|
51
|
-
it "should support one user-agent for each step" do
|
52
|
-
hash = curl.parse %w[-A foo blitz.io -A bar /faq]
|
53
|
-
hash.should include 'steps'
|
54
|
-
hash['steps'].size.should == 2
|
55
|
-
hash['steps'][0]['user-agent'] == 'foo'
|
56
|
-
hash['steps'][1]['user-agent'] == 'bar'
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
context "cookie" do
|
61
|
-
it "should check that a cookie is given" do
|
62
|
-
lambda { curl.parse %w[--cookie] }.should raise_error(MiniTest::Assertion, /missing value/)
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should be an array of cookies" do
|
66
|
-
hash = curl.parse %w[--cookie foo=bar --cookie hello=world blitz.io]
|
67
|
-
hash['steps'].size.should == 1
|
68
|
-
step = hash['steps'].first
|
69
|
-
step['cookies'].should be_a(Array)
|
70
|
-
step['cookies'].should == [ 'foo=bar', 'hello=world' ]
|
71
|
-
end
|
72
|
-
|
73
|
-
it "should support one cookie for each step" do
|
74
|
-
hash = curl.parse %w[-b foo=bar blitz.io -b hello=world /faq]
|
75
|
-
hash.should include 'steps'
|
76
|
-
hash['steps'].size.should == 2
|
77
|
-
hash['steps'][0]['cookies'] == [ 'foo=bar' ]
|
78
|
-
hash['steps'][1]['cookies'] == [ 'hello=world' ]
|
79
|
-
end
|
80
|
-
end
|
81
|
-
|
82
|
-
context "data" do
|
83
|
-
it "should check that a data is given" do
|
84
|
-
lambda { curl.parse %w[--data] }.should raise_error(MiniTest::Assertion, /missing value/)
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should be an array of data" do
|
88
|
-
hash = curl.parse %w[--data foo=bar --data hello=world blitz.io]
|
89
|
-
hash['steps'].size.should == 1
|
90
|
-
step = hash['steps'].first
|
91
|
-
step['content'].should be_a(Hash)
|
92
|
-
step['content']['data'].should be_a(Array)
|
93
|
-
step['content']['data'].should == [ 'foo=bar', 'hello=world' ]
|
94
|
-
end
|
95
|
-
|
96
|
-
it "should support one data for each step" do
|
97
|
-
hash = curl.parse %w[-d foo=bar blitz.io -d hello=world /faq]
|
98
|
-
hash.should include 'steps'
|
99
|
-
hash['steps'].size.should == 2
|
100
|
-
hash['steps'][0]['content']['data'] == [ 'foo=bar' ]
|
101
|
-
hash['steps'][1]['content']['data'] == [ 'hello=world' ]
|
102
|
-
end
|
103
|
-
end
|
104
|
-
|
105
|
-
context "referer" do
|
106
|
-
it "should check that a referer is given" do
|
107
|
-
lambda { curl.parse %w[--referer] }.should raise_error(MiniTest::Assertion, /missing value/)
|
108
|
-
end
|
109
|
-
|
110
|
-
it "should support one referer for each step" do
|
111
|
-
hash = curl.parse %w[-e foo blitz.io -e bar /faq]
|
112
|
-
hash.should include 'steps'
|
113
|
-
hash['steps'].size.should == 2
|
114
|
-
hash['steps'][0]['referer'] == 'foo'
|
115
|
-
hash['steps'][1]['referer'] == 'bar'
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context "headers" do
|
120
|
-
it "should check that a header is given" do
|
121
|
-
lambda { curl.parse %w[--header] }.should raise_error(MiniTest::Assertion, /missing value/)
|
122
|
-
end
|
123
|
-
|
124
|
-
it "should be an array of headers" do
|
125
|
-
hash = curl.parse %w[-H foo=bar -H hello=world blitz.io]
|
126
|
-
hash['steps'].size.should == 1
|
127
|
-
step = hash['steps'].first
|
128
|
-
step['headers'].should be_a(Array)
|
129
|
-
step['headers'].should == [ 'foo=bar', 'hello=world' ]
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should support one header for each step" do
|
133
|
-
hash = curl.parse %w[-H foo=bar blitz.io -H hello=world /faq]
|
134
|
-
hash.should include 'steps'
|
135
|
-
hash['steps'].size.should == 2
|
136
|
-
hash['steps'][0]['headers'] == [ 'foo=bar' ]
|
137
|
-
hash['steps'][1]['headers'] == [ 'hello=world' ]
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
context "pattern" do
|
142
|
-
it "should check that a pattern is given" do
|
143
|
-
lambda { curl.parse %w[--pattern] }.should raise_error(MiniTest::Assertion, /missing value/)
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should add the pattern to the hash" do
|
147
|
-
hash = curl.parse %w[-p 1-250:60 blitz.io]
|
148
|
-
hash['pattern'].should be_a(Hash)
|
149
|
-
hash['pattern']['iterations'].should == 1
|
150
|
-
hash['pattern']['intervals'].should be_an(Array)
|
151
|
-
hash['pattern']['intervals'].size.should == 1
|
152
|
-
hash['pattern']['intervals'].first['iterations'].should == 1
|
153
|
-
hash['pattern']['intervals'].first['start'].should == 1
|
154
|
-
hash['pattern']['intervals'].first['end'].should == 250
|
155
|
-
hash['pattern']['intervals'].first['duration'].should == 60
|
156
|
-
end
|
157
|
-
|
158
|
-
it "should parse multiple intervals in the pattern" do
|
159
|
-
hash = curl.parse %w[-p 1-250:60,500-500:10 blitz.io]
|
160
|
-
hash['pattern'].should be_a(Hash)
|
161
|
-
hash['pattern']['iterations'].should == 1
|
162
|
-
hash['pattern']['intervals'].should be_an(Array)
|
163
|
-
hash['pattern']['intervals'].size.should == 2
|
164
|
-
hash['pattern']['intervals'].first['iterations'].should == 1
|
165
|
-
hash['pattern']['intervals'].first['start'].should == 1
|
166
|
-
hash['pattern']['intervals'].first['end'].should == 250
|
167
|
-
hash['pattern']['intervals'].first['duration'].should == 60
|
168
|
-
hash['pattern']['intervals'].last['iterations'].should == 1
|
169
|
-
hash['pattern']['intervals'].last['start'].should == 500
|
170
|
-
hash['pattern']['intervals'].last['end'].should == 500
|
171
|
-
hash['pattern']['intervals'].last['duration'].should == 10
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
context "region" do
|
176
|
-
it "should check that a region is given" do
|
177
|
-
lambda { curl.parse %w[--region] }.should raise_error(MiniTest::Assertion, /missing value/)
|
178
|
-
end
|
179
|
-
|
180
|
-
it "should verify that it's a valid region" do
|
181
|
-
[ 'california', 'oregon', 'virginia', 'ireland', 'singapore', 'japan' ].each do |r|
|
182
|
-
lambda { curl.parse ['-r', r, 'blitz.io' ] }.should_not raise_error
|
183
|
-
end
|
184
|
-
|
185
|
-
lambda { curl.parse %w[-r a ] }.should raise_error(MiniTest::Assertion, /must be one of/)
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
context "status" do
|
190
|
-
it "should check that a status is given" do
|
191
|
-
lambda { curl.parse %w[--status] }.should raise_error(MiniTest::Assertion, /missing value/)
|
192
|
-
end
|
193
|
-
|
194
|
-
it "should support one status for each step" do
|
195
|
-
hash = curl.parse %w[-s 302 blitz.io -s 200 /faq]
|
196
|
-
hash.should include 'steps'
|
197
|
-
hash['steps'].size.should == 2
|
198
|
-
hash['steps'][0]['status'] == 302
|
199
|
-
hash['steps'][1]['status'] == 200
|
200
|
-
end
|
201
|
-
end
|
202
|
-
|
203
|
-
context "timeout" do
|
204
|
-
it "should check that a timeout is given" do
|
205
|
-
lambda { curl.parse %w[--timeout] }.should raise_error(MiniTest::Assertion, /missing value/)
|
206
|
-
end
|
207
|
-
|
208
|
-
it "should support one timeout for each step" do
|
209
|
-
hash = curl.parse %w[-T 100 blitz.io -T 200 /faq]
|
210
|
-
hash.should include 'steps'
|
211
|
-
hash['steps'].size.should == 2
|
212
|
-
hash['steps'][0]['timeout'] == 100
|
213
|
-
hash['steps'][1]['timeout'] == 200
|
214
|
-
end
|
215
|
-
end
|
216
|
-
|
217
|
-
context "user" do
|
218
|
-
it "should check that a user is given" do
|
219
|
-
lambda { curl.parse %w[--user] }.should raise_error(MiniTest::Assertion, /missing value/)
|
220
|
-
end
|
221
|
-
|
222
|
-
it "should support one user for each step" do
|
223
|
-
hash = curl.parse %w[-u foo:bar blitz.io -u hello:world /faq]
|
224
|
-
hash.should include 'steps'
|
225
|
-
hash['steps'].size.should == 2
|
226
|
-
hash['steps'][0]['user'] == 'foo:bar'
|
227
|
-
hash['steps'][1]['user'] == 'hello:world'
|
228
|
-
end
|
229
|
-
end
|
230
|
-
|
231
|
-
context "request" do
|
232
|
-
it "should check that a request is given" do
|
233
|
-
lambda { curl.parse %w[--request] }.should raise_error(MiniTest::Assertion, /missing value/)
|
234
|
-
end
|
235
|
-
|
236
|
-
it "should support one request for each step" do
|
237
|
-
hash = curl.parse %w[-X GET blitz.io -X POST /faq]
|
238
|
-
hash.should include 'steps'
|
239
|
-
hash['steps'].size.should == 2
|
240
|
-
hash['steps'][0]['request'] == 'GET'
|
241
|
-
hash['steps'][1]['request'] == 'POST'
|
242
|
-
end
|
243
|
-
end
|
244
|
-
end
|