blitz 0.1.14 → 0.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/blitz.gemspec +3 -2
- data/lib/blitz.rb +1 -1
- data/lib/blitz/command.rb +1 -0
- data/lib/blitz/command/curl.rb +25 -15
- data/lib/blitz/command/help.rb +2 -1
- data/lib/blitz/command/version.rb +9 -0
- data/lib/blitz/curl/sprint.rb +5 -3
- metadata +4 -3
data/blitz.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{blitz}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.15"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["pcapr"]
|
12
|
-
s.date = %q{2011-10-
|
12
|
+
s.date = %q{2011-10-13}
|
13
13
|
s.default_executable = %q{blitz}
|
14
14
|
s.description = %q{Make load and performance testing a fun sport}
|
15
15
|
s.email = %q{support@blitz.io}
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"lib/blitz/command/couch.rb",
|
35
35
|
"lib/blitz/command/curl.rb",
|
36
36
|
"lib/blitz/command/help.rb",
|
37
|
+
"lib/blitz/command/version.rb",
|
37
38
|
"lib/blitz/curl/error.rb",
|
38
39
|
"lib/blitz/curl/rush.rb",
|
39
40
|
"lib/blitz/curl/sprint.rb",
|
data/lib/blitz.rb
CHANGED
data/lib/blitz/command.rb
CHANGED
data/lib/blitz/command/curl.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
class Blitz
|
2
2
|
class Command
|
3
3
|
class Curl < Command # :nodoc:
|
4
|
-
include Term::ANSIColor
|
5
|
-
|
6
4
|
def cmd_help argv
|
7
5
|
help
|
8
6
|
end
|
@@ -57,16 +55,17 @@ class Curl < Command # :nodoc:
|
|
57
55
|
def sprint args
|
58
56
|
begin
|
59
57
|
job = ::Blitz::Curl::Sprint.queue args
|
58
|
+
error "sprinting from #{yellow(job.region)}"
|
60
59
|
result = job.result
|
61
60
|
print_sprint_result args, result
|
62
61
|
rescue ::Blitz::Curl::Error::Authorize => e
|
63
62
|
authorize_error e
|
64
63
|
rescue ::Blitz::Curl::Error::Step => e
|
65
|
-
error "#{
|
64
|
+
error "#{red(e.message)} in step #{e.step}"
|
66
65
|
puts
|
67
66
|
print_sprint_result args, e
|
68
67
|
rescue ::Blitz::Curl::Error::Region => e
|
69
|
-
error "#{
|
68
|
+
error "#{red(e.message)}"
|
70
69
|
rescue ::Blitz::Curl::Error => e
|
71
70
|
error red(e.message)
|
72
71
|
end
|
@@ -84,7 +83,7 @@ class Curl < Command # :nodoc:
|
|
84
83
|
def print_sprint_result args, result
|
85
84
|
if result.respond_to? :duration
|
86
85
|
rtt = pretty_print_duration result.duration
|
87
|
-
msg "
|
86
|
+
msg "Transaction time #{green(rtt)}"
|
88
87
|
puts
|
89
88
|
end
|
90
89
|
|
@@ -105,17 +104,19 @@ class Curl < Command # :nodoc:
|
|
105
104
|
puts
|
106
105
|
end
|
107
106
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
if
|
114
|
-
|
115
|
-
|
116
|
-
|
107
|
+
if res
|
108
|
+
puts "< " + res.line
|
109
|
+
res.headers.each_pair { |k, v| puts "< #{k}: #{v}\r\n" }
|
110
|
+
puts
|
111
|
+
content = res.content
|
112
|
+
if not content.empty?
|
113
|
+
if /^[[:print:]]+$/ =~ content
|
114
|
+
puts content
|
115
|
+
else
|
116
|
+
puts Hexy.new(content).to_s
|
117
|
+
end
|
117
118
|
end
|
118
|
-
end
|
119
|
+
end
|
119
120
|
else
|
120
121
|
puts "> " + req.method + ' ' + req.url
|
121
122
|
if res
|
@@ -322,6 +323,15 @@ class Curl < Command # :nodoc:
|
|
322
323
|
step['request'] = shift(k, argv)
|
323
324
|
next
|
324
325
|
end
|
326
|
+
|
327
|
+
if /-x:c/ =~ k or /--xtract:cookie/ =~ k
|
328
|
+
xname = shift(k, argv)
|
329
|
+
assert_match /^[a-zA-Z_][a-zA-Z_0-9]*$/, xname, "cookie name must be alphanumeric: #{xname}"
|
330
|
+
|
331
|
+
step['xtracts'] ||= Hash.new
|
332
|
+
xhash = step['xtracts'][xname] = { 'type' => 'cookie' }
|
333
|
+
next
|
334
|
+
end
|
325
335
|
|
326
336
|
if /-v:(\S+)/ =~ k or /--variable:(\S+)/ =~ k
|
327
337
|
vname = $1
|
data/lib/blitz/command/help.rb
CHANGED
@@ -7,9 +7,10 @@ class Help < Command # :nodoc:
|
|
7
7
|
helps = [
|
8
8
|
{ :cmd => 'help', :help => "Display this help" },
|
9
9
|
{ :cmd => 'api:init', :help => 'Validate your API key' },
|
10
|
+
{ :cmd => 'couch:fuzz', :help => 'Auto generate blitz tests from CouchDB' },
|
10
11
|
{ :cmd => 'curl', :help => 'Run a sprint or a rush' },
|
11
12
|
{ :cmd => 'curl:help', :help => 'Show help on sprint and rushing' },
|
12
|
-
{ :cmd => '
|
13
|
+
{ :cmd => 'version', :help => 'Show the version of this Ruby gem' }
|
13
14
|
]
|
14
15
|
|
15
16
|
max_cmd_size = helps.inject(0) { |memo, obj| [ obj[:cmd].size, memo ].max } + 4
|
data/lib/blitz/curl/sprint.rb
CHANGED
@@ -121,13 +121,15 @@ class Sprint
|
|
121
121
|
|
122
122
|
res = Command::API.client.curl_execute args
|
123
123
|
raise Error.new(res) if res['error']
|
124
|
-
return self.new res
|
124
|
+
return self.new res
|
125
125
|
end
|
126
126
|
|
127
127
|
attr_reader :job_id # :nodoc:
|
128
|
+
attr_reader :region # :nodoc:
|
128
129
|
|
129
|
-
def initialize
|
130
|
-
@job_id = job_id
|
130
|
+
def initialize json # :nodoc:
|
131
|
+
@job_id = json['job_id']
|
132
|
+
@region = json['region']
|
131
133
|
end
|
132
134
|
|
133
135
|
def result # :nodoc:
|
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.15
|
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: 2011-10-
|
13
|
+
date: 2011-10-13 00:00:00 -07:00
|
14
14
|
default_executable: blitz
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -148,6 +148,7 @@ files:
|
|
148
148
|
- lib/blitz/command/couch.rb
|
149
149
|
- lib/blitz/command/curl.rb
|
150
150
|
- lib/blitz/command/help.rb
|
151
|
+
- lib/blitz/command/version.rb
|
151
152
|
- lib/blitz/curl/error.rb
|
152
153
|
- lib/blitz/curl/rush.rb
|
153
154
|
- lib/blitz/curl/sprint.rb
|
@@ -169,7 +170,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
169
170
|
requirements:
|
170
171
|
- - ">="
|
171
172
|
- !ruby/object:Gem::Version
|
172
|
-
hash:
|
173
|
+
hash: 510668115
|
173
174
|
segments:
|
174
175
|
- 0
|
175
176
|
version: "0"
|