Skip to content

Commit

Permalink
Only zip maze_output if file_log is on (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
imjoehaines authored Apr 8, 2024
1 parent c374413 commit 3444b56
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# TBD

## Fixes

- Only zip maze_output if file_log is on [#644](https://github.com/bugsnag/maze-runner/pull/644)

# 9.6.0 - 2024/04/03

## Enhancements
Expand Down
22 changes: 13 additions & 9 deletions lib/features/support/internal_hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,17 +238,21 @@ def output_received_requests(request_type)
# Ensure the logger output is in the correct location
Maze::Hooks::LoggerHooks.after_all

maze_output = File.join(Dir.pwd, 'maze_output')
maze_output_zip = File.join(Dir.pwd, 'maze_output.zip')
# zip a folder with files and subfolders
Zip::File.open(maze_output_zip, Zip::File::CREATE) do |zipfile|
Dir["#{maze_output}/**/**"].each do |file|
zipfile.add(file.sub(Dir.pwd + '/', ''), file)
if Maze.config.file_log
# create a zip file from the maze_output directory
maze_output = File.join(Dir.pwd, 'maze_output')
maze_output_zip = File.join(Dir.pwd, 'maze_output.zip')

# zip a folder with files and subfolders
Zip::File.open(maze_output_zip, Zip::File::CREATE) do |zipfile|
Dir["#{maze_output}/**/**"].each do |file|
zipfile.add(file.sub(Dir.pwd + '/', ''), file)
end
end
end

# Move the zip file to the maze_output folder
FileUtils.mv(maze_output_zip, maze_output)
# Move the zip file to the maze_output folder
FileUtils.mv(maze_output_zip, maze_output)
end

metrics = Maze::MetricsProcessor.new(Maze::Server.metrics)
metrics.process
Expand Down

0 comments on commit 3444b56

Please sign in to comment.