bugsnag-maze-runner 9.6.0 → 9.7.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c5244250d40c6b3b44f775401c136e2f61e87779135858b5533e40875658190
4
- data.tar.gz: 9cab0c07bc4db58a9ec93e4b25157a7749f5bb53a03812e1420270da48f38729
3
+ metadata.gz: f948d5bf3980cb7514127f60fbecb2ffdb4484c8d19a484e39ebccaaaebda535
4
+ data.tar.gz: efb5c22b4c81824d63c2762ea0792ad6316dc8744660042b4c1d6357eb8b7a5c
5
5
  SHA512:
6
- metadata.gz: b80d77bb8d388956f6acbefce51c3482b7450feb01dda66d655e9e682c89dc4b118f20d14bd63b0289092a27bce4dfb923332bf364a051e382b46e86ad8cf852
7
- data.tar.gz: 3ddc5d20186dee38db31c3db556e5454b9bd825caf6cef96ef18b92b3f503c2771f2f78afa8bf22d262fbdef0165d66e280daae764ab0b15d4db441811eac63e
6
+ metadata.gz: 100b68e6b60360ea1a0bad3eb51c2b7e28fce9328e0ebc5a8bfeba089621714cfb834d7c4ae568f4c88c7399ff2e2b0fef351cbf8dd97397b3fb4da5cd39644b
7
+ data.tar.gz: ba9d6bbf2e966981d14be78688c119967278d662b5c0cc166fedba5302c829a3e9b2e93a0c4dfefc30893c5a9cebd09e1f7408de7c71ee7986d3fe89995eb748
@@ -238,17 +238,21 @@ AfterAll do
238
238
  # Ensure the logger output is in the correct location
239
239
  Maze::Hooks::LoggerHooks.after_all
240
240
 
241
- maze_output = File.join(Dir.pwd, 'maze_output')
242
- maze_output_zip = File.join(Dir.pwd, 'maze_output.zip')
243
- # zip a folder with files and subfolders
244
- Zip::File.open(maze_output_zip, Zip::File::CREATE) do |zipfile|
245
- Dir["#{maze_output}/**/**"].each do |file|
246
- zipfile.add(file.sub(Dir.pwd + '/', ''), file)
241
+ if Maze.config.file_log
242
+ # create a zip file from the maze_output directory
243
+ maze_output = File.join(Dir.pwd, 'maze_output')
244
+ maze_output_zip = File.join(Dir.pwd, 'maze_output.zip')
245
+
246
+ # zip a folder with files and subfolders
247
+ Zip::File.open(maze_output_zip, Zip::File::CREATE) do |zipfile|
248
+ Dir["#{maze_output}/**/**"].each do |file|
249
+ zipfile.add(file.sub(Dir.pwd + '/', ''), file)
250
+ end
247
251
  end
248
- end
249
252
 
250
- # Move the zip file to the maze_output folder
251
- FileUtils.mv(maze_output_zip, maze_output)
253
+ # Move the zip file to the maze_output folder
254
+ FileUtils.mv(maze_output_zip, maze_output)
255
+ end
252
256
 
253
257
  metrics = Maze::MetricsProcessor.new(Maze::Server.metrics)
254
258
  metrics.process
data/lib/maze/server.rb CHANGED
@@ -15,6 +15,12 @@ module Maze
15
15
  DEFAULT_STATUS_CODE = 200
16
16
 
17
17
  class << self
18
+
19
+ # Records the previous command UUID sent to the test fixture
20
+ #
21
+ # @return [String] The UUID of the last command sent
22
+ attr_accessor :last_command_uuid
23
+
18
24
  # Sets the response delay generator.
19
25
  #
20
26
  # @param generator [Maze::Generator] The new generator
@@ -19,17 +19,7 @@ module Maze
19
19
 
20
20
  if request.query.empty?
21
21
  # Non-idempotent mode - return the "current" command
22
- commands = Maze::Server.commands
23
-
24
- if commands.size_remaining == 0
25
- response.body = NOOP_COMMAND
26
- response.status = 200
27
- else
28
- command = commands.current
29
- response.body = JSON.pretty_generate(command)
30
- response.status = 200
31
- commands.next
32
- end
22
+ send_current_command(response)
33
23
  else
34
24
  # Idempotent mode
35
25
  after_uuid = request.query['after']
@@ -44,6 +34,21 @@ module Maze
44
34
  response.header['Access-Control-Allow-Origin'] = '*'
45
35
  end
46
36
 
37
+ def send_current_command(response)
38
+ commands = Maze::Server.commands
39
+
40
+ if commands.size_remaining == 0
41
+ response.body = NOOP_COMMAND
42
+ response.status = 200
43
+ else
44
+ command = commands.current
45
+ Server.last_command_uuid = command[:uuid]
46
+ response.body = JSON.pretty_generate(command)
47
+ response.status = 200
48
+ commands.next
49
+ end
50
+ end
51
+
47
52
  def command_after(uuid, response)
48
53
  commands = Maze::Server.commands
49
54
  if uuid.empty?
@@ -52,14 +57,20 @@ module Maze
52
57
  index = commands.all.find_index {|command| command[:uuid] == uuid }
53
58
  end
54
59
  if index.nil?
55
- msg = "Request invalid - there is no command with a UUID of #{uuid} to follow on from"
56
- $logger.error msg
57
- response.body = msg
58
- response.status = 400
60
+ # If the UUID given matches the last UUID sent by the server, we can assume the fixture has failed to reset
61
+ if uuid.eql?(Server.last_command_uuid)
62
+ send_current_command(response)
63
+ else
64
+ msg = "Request invalid - there is no command with a UUID of #{uuid} to follow on from"
65
+ $logger.error msg
66
+ response.body = msg
67
+ response.status = 400
68
+ end
59
69
  else
60
70
  if index + 1 < commands.size_all
61
71
  # Respond with the next command in the queue
62
72
  command = commands.get(index + 1)
73
+ Server.last_command_uuid = command[:uuid]
63
74
  command_json = JSON.pretty_generate(command)
64
75
  response.body = command_json
65
76
  response.status = 200
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 = '9.6.0'
10
+ VERSION = '9.7.0'
11
11
 
12
12
  class << self
13
13
  attr_accessor :check, :driver, :internal_hooks, :mode, :start_time, :dynamic_retry, :public_address,
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: 9.6.0
4
+ version: 9.7.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: 2024-04-03 00:00:00.000000000 Z
11
+ date: 2024-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber