Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/support/database/query_recorder.rb')
-rw-r--r--spec/support/database/query_recorder.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/spec/support/database/query_recorder.rb b/spec/support/database/query_recorder.rb
index 1050120e528..c0736221af3 100644
--- a/spec/support/database/query_recorder.rb
+++ b/spec/support/database/query_recorder.rb
@@ -3,7 +3,15 @@
RSpec.configure do |config|
# Truncate the query_recorder log file before starting the suite
config.before(:suite) do
- log_path = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder::LOG_FILE)
- File.write(log_path, '') if File.exist?(log_path)
+ log_file = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder.log_file)
+ File.write(log_file, '') if File.exist?(log_file)
+ File.delete("#{log_file}.gz") if File.exist?("#{log_file}.gz")
+ end
+
+ config.after(:suite) do
+ if ENV['CI']
+ log_file = Rails.root.join(Gitlab::Database::QueryAnalyzers::QueryRecorder.log_file)
+ system("gzip #{log_file}") if File.exist?(log_file)
+ end
end
end