bugsnag-maze-runner 7.24.0 → 7.25.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/maze-runner +1 -0
- data/lib/features/steps/network_steps.rb +28 -19
- data/lib/features/support/internal_hooks.rb +3 -0
- data/lib/maze/metrics_processor.rb +71 -0
- data/lib/maze/request_list.rb +1 -1
- data/lib/maze/server.rb +10 -0
- data/lib/maze.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 02e955bef1519e412688dc3c061336307d211c724dedd39fce301e9e89113f6e
|
4
|
+
data.tar.gz: c4643eab515e98e1acc179d9b5ddaf90c9d3bf937ace170860c52d7a9b1235f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ce234fcc1913ba4b2b87cbe13e30ce02c3e726e3ff38f0b466282c8bb7f6236202186a224f92b6e9582715fb2eba3b3db19723e19227ae8249b72abbcd35a49
|
7
|
+
data.tar.gz: 25fdf555f609bc45b19c09e53ffe23f2929ad0cddf7fc3c7d32891ebaf72a71c4426e932c7fe22151169dd60a1e177b86dafccf3b1f1e6aa218945b5354f0d30
|
data/bin/maze-runner
CHANGED
@@ -38,6 +38,7 @@ require_relative '../lib/maze/http_request'
|
|
38
38
|
require_relative '../lib/maze/logger'
|
39
39
|
require_relative '../lib/maze/macos_utils'
|
40
40
|
require_relative '../lib/maze/maze_output'
|
41
|
+
require_relative '../lib/maze/metrics_processor'
|
41
42
|
require_relative '../lib/maze/network'
|
42
43
|
require_relative '../lib/maze/proxy'
|
43
44
|
require_relative '../lib/maze/retry_handler'
|
@@ -8,29 +8,17 @@ When('I wait for the host {string} to open port {string}') do |host, port|
|
|
8
8
|
Maze::Network.wait_for_port(host, port)
|
9
9
|
end
|
10
10
|
|
11
|
-
# Sets the HTTP status code to be used for
|
12
|
-
#
|
13
|
-
# @step_input status_code [Integer] The status code to return
|
14
|
-
When('I set the HTTP status code to {int}') do |status_code|
|
15
|
-
Maze::Server.set_status_code_generator(Maze::Generator.new [status_code].cycle)
|
16
|
-
end
|
17
|
-
|
18
|
-
# Sets the HTTP status code to be used for the next request
|
19
|
-
#
|
20
|
-
# @step_input status_code [Integer] The status code to return
|
21
|
-
When('I set the HTTP status code for the next request to {int}') do |status_code|
|
22
|
-
Maze::Server.set_status_code_generator(create_defaulting_generator([status_code], Maze::Server::DEFAULT_STATUS_CODE))
|
23
|
-
end
|
24
|
-
|
25
|
-
# Sets the HTTP status code to be used for the next set of requests
|
11
|
+
# Sets the HTTP status code to be used for the next set of requests for a given connection type
|
26
12
|
#
|
13
|
+
# @step_input http_verb [String] The type of request this code will be used for
|
27
14
|
# @step_input status_codes [String] A comma separated list of status codes to return
|
28
|
-
When('I set the HTTP status code for the next requests to {string}') do |status_codes|
|
15
|
+
When('I set the HTTP status code for the next {string} requests to {string}') do |http_verb, status_codes|
|
16
|
+
raise("Invalid HTTP verb: #{http_verb}") unless Maze::Server::ALLOWED_HTTP_VERBS.include?(http_verb)
|
29
17
|
codes = status_codes.split(',').map(&:strip)
|
30
|
-
Maze::Server.set_status_code_generator(create_defaulting_generator(codes, Maze::Server::DEFAULT_STATUS_CODE))
|
18
|
+
Maze::Server.set_status_code_generator(create_defaulting_generator(codes, Maze::Server::DEFAULT_STATUS_CODE), http_verb)
|
31
19
|
end
|
32
20
|
|
33
|
-
#
|
21
|
+
# Sets the HTTP status code to be used for all subsequent requests for a given connection type
|
34
22
|
#
|
35
23
|
# @step_input http_verb [String] The type of request this code will be used for
|
36
24
|
# @step_input status_code [Integer] The status code to return
|
@@ -39,7 +27,7 @@ When('I set the HTTP status code for {string} requests to {int}') do |http_verb,
|
|
39
27
|
Maze::Server.set_status_code_generator(Maze::Generator.new([status_code].cycle), http_verb)
|
40
28
|
end
|
41
29
|
|
42
|
-
#
|
30
|
+
# Sets the HTTP status code to be used for the next request for a given connection type
|
43
31
|
#
|
44
32
|
# @step_input http_verb [String] The type of request this code will be used for
|
45
33
|
# @step_input status_code [Integer] The status code to return
|
@@ -48,6 +36,27 @@ When('I set the HTTP status code for the next {string} request to {int}') do |ht
|
|
48
36
|
Maze::Server.set_status_code_generator(create_defaulting_generator([status_code], Maze::Server::DEFAULT_STATUS_CODE), http_verb)
|
49
37
|
end
|
50
38
|
|
39
|
+
# Sets the HTTP status code to be used for all subsequent POST requests
|
40
|
+
#
|
41
|
+
# @step_input status_code [Integer] The status code to return
|
42
|
+
When('I set the HTTP status code to {int}') do |status_code|
|
43
|
+
step %{I set the HTTP status code for "POST" requests to #{status_code}}
|
44
|
+
end
|
45
|
+
|
46
|
+
# Sets the HTTP status code to be used for the next POST request
|
47
|
+
#
|
48
|
+
# @step_input status_code [Integer] The status code to return
|
49
|
+
When('I set the HTTP status code for the next request to {int}') do |status_code|
|
50
|
+
step %{I set the HTTP status code for the next "POST" request to #{status_code}}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Sets the HTTP status code to be used for the next set of POST requests
|
54
|
+
#
|
55
|
+
# @step_input status_codes [String] A comma separated list of status codes to return
|
56
|
+
When('I set the HTTP status code for the next requests to {string}') do |status_codes|
|
57
|
+
step %{I set the HTTP status code for the next "POST" requests to "#{status_codes}"}
|
58
|
+
end
|
59
|
+
|
51
60
|
# Sets the sampling probability to be used for all subsequent trace responses
|
52
61
|
#
|
53
62
|
# @step_input sampling_probability [String] The sampling probability to return
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require_relative './request_list'
|
2
|
+
|
3
|
+
module Maze
|
4
|
+
class MetricsProcessor
|
5
|
+
# @param metrics [RequestList] The metrics to be processed
|
6
|
+
def initialize(metrics)
|
7
|
+
@metrics = metrics
|
8
|
+
@columns = Set.new
|
9
|
+
@rows = []
|
10
|
+
end
|
11
|
+
|
12
|
+
# Collates the metrics given into a CSV-friendly structure and writes the CSV to disk
|
13
|
+
def process
|
14
|
+
return if @metrics.size_all == 0
|
15
|
+
|
16
|
+
collate
|
17
|
+
write_to_disk
|
18
|
+
end
|
19
|
+
|
20
|
+
# Organises the raw metrics into an Array of hashes representing each row of the CSV,
|
21
|
+
# whilst also capturing an overall set of column headings
|
22
|
+
def collate
|
23
|
+
@metrics.all.each do |request|
|
24
|
+
row = {}
|
25
|
+
metric = request[:body]
|
26
|
+
metric.each do |key, value|
|
27
|
+
@columns.add key
|
28
|
+
row[key] = value
|
29
|
+
end
|
30
|
+
@rows << row
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def write_to_disk
|
35
|
+
filepath = File.join(Dir.pwd, 'maze_output', 'metrics.csv')
|
36
|
+
|
37
|
+
puts "Call with #{filepath}"
|
38
|
+
|
39
|
+
File.open(filepath, 'w') do |file|
|
40
|
+
# Write the header, with columns ordered alphabetically
|
41
|
+
sorted_columns = @columns.to_a.sort!
|
42
|
+
header = sorted_columns.join ','
|
43
|
+
file.puts header
|
44
|
+
|
45
|
+
# Write the rows
|
46
|
+
@rows.each do |row|
|
47
|
+
row_values = sorted_columns.map do |column|
|
48
|
+
if row.has_key? column
|
49
|
+
to_csv_friendly(row[column])
|
50
|
+
else
|
51
|
+
''
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
file.puts row_values.join ','
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_csv_friendly(value)
|
61
|
+
return value unless value.class == String
|
62
|
+
|
63
|
+
if value.include?(' ') || value.include?(',')
|
64
|
+
"\"#{value}\""
|
65
|
+
else
|
66
|
+
value
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
end
|
data/lib/maze/request_list.rb
CHANGED
data/lib/maze/server.rb
CHANGED
@@ -83,6 +83,8 @@ module Maze
|
|
83
83
|
builds
|
84
84
|
when 'log', 'logs'
|
85
85
|
logs
|
86
|
+
when 'metric', 'metrics'
|
87
|
+
metrics
|
86
88
|
when 'trace', 'traces'
|
87
89
|
traces
|
88
90
|
when 'upload', 'uploads'
|
@@ -145,6 +147,13 @@ module Maze
|
|
145
147
|
@logs ||= RequestList.new
|
146
148
|
end
|
147
149
|
|
150
|
+
# A list of metric requests received
|
151
|
+
#
|
152
|
+
# @return [RequestList] Received metric requests
|
153
|
+
def metrics
|
154
|
+
@metrics ||= RequestList.new
|
155
|
+
end
|
156
|
+
|
148
157
|
# A list of commands for a test fixture to perform. Strictly speaking these are responses to HTTP
|
149
158
|
# requests, but the list behavior is all we need.
|
150
159
|
#
|
@@ -202,6 +211,7 @@ module Maze
|
|
202
211
|
server.mount '/react-native-source-map', Servlets::Servlet, :sourcemaps
|
203
212
|
server.mount '/command', Servlets::CommandServlet
|
204
213
|
server.mount '/logs', Servlets::LogServlet
|
214
|
+
server.mount '/metrics', Servlets::Servlet, :metrics
|
205
215
|
server.mount '/reflect', Servlets::ReflectiveServlet
|
206
216
|
server.start
|
207
217
|
rescue StandardError => e
|
data/lib/maze.rb
CHANGED
@@ -7,7 +7,7 @@ require_relative 'maze/timers'
|
|
7
7
|
# Glues the various parts of MazeRunner together that need to be accessed globally,
|
8
8
|
# providing an alternative to the proliferation of global variables or singletons.
|
9
9
|
module Maze
|
10
|
-
VERSION = '7.
|
10
|
+
VERSION = '7.25.0'
|
11
11
|
|
12
12
|
class << self
|
13
13
|
attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address, :run_uuid
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bugsnag-maze-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.
|
4
|
+
version: 7.25.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Kirkland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -408,6 +408,7 @@ files:
|
|
408
408
|
- lib/maze/logger.rb
|
409
409
|
- lib/maze/macos_utils.rb
|
410
410
|
- lib/maze/maze_output.rb
|
411
|
+
- lib/maze/metrics_processor.rb
|
411
412
|
- lib/maze/network.rb
|
412
413
|
- lib/maze/option.rb
|
413
414
|
- lib/maze/option/parser.rb
|