2020-09-09 17:08:33 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'rake_helper'
|
|
|
|
|
2021-06-08 11:10:00 -04:00
|
|
|
RSpec.describe 'gitlab:usage data take tasks', :silence_stdout do
|
2021-04-14 11:09:04 -04:00
|
|
|
include UsageDataHelpers
|
|
|
|
|
2020-09-09 17:08:33 -04:00
|
|
|
before do
|
|
|
|
Rake.application.rake_require 'tasks/gitlab/usage_data'
|
|
|
|
# stub prometheus external http calls https://gitlab.com/gitlab-org/gitlab/-/issues/245277
|
2021-04-14 11:09:04 -04:00
|
|
|
stub_prometheus_queries
|
2020-09-09 17:08:33 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dump_sql_in_yaml' do
|
|
|
|
it 'dumps SQL queries in yaml format' do
|
|
|
|
expect { run_rake_task('gitlab:usage_data:dump_sql_in_yaml') }.to output(/.*recorded_at:.*/).to_stdout
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe 'dump_sql_in_json' do
|
|
|
|
it 'dumps SQL queries in json format' do
|
|
|
|
expect { run_rake_task('gitlab:usage_data:dump_sql_in_json') }.to output(/.*"recorded_at":.*/).to_stdout
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|