summaryrefslogtreecommitdiff
path: root/spec/tasks
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 21:08:33 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-09-09 21:08:33 +0000
commitb296ffa543e23f57fa2692539e6f0028c59e2203 (patch)
treef5224a37cac088506d1c8fd53925ee1d9fd2a02c /spec/tasks
parentc172bb9967f280e05bd904188d60a959dff10f00 (diff)
downloadgitlab-ce-b296ffa543e23f57fa2692539e6f0028c59e2203.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/tasks')
-rw-r--r--spec/tasks/gitlab/usage_data_rake_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/tasks/gitlab/usage_data_rake_spec.rb b/spec/tasks/gitlab/usage_data_rake_spec.rb
new file mode 100644
index 00000000000..2a596946d86
--- /dev/null
+++ b/spec/tasks/gitlab/usage_data_rake_spec.rb
@@ -0,0 +1,28 @@
+# frozen_string_literal: true
+
+require 'rake_helper'
+
+RSpec.describe 'gitlab:usage data take tasks' do
+ before do
+ Rake.application.rake_require 'tasks/gitlab/usage_data'
+ # stub prometheus external http calls https://gitlab.com/gitlab-org/gitlab/-/issues/245277
+ stub_request(:get, %r{^http://::1:9090/api/v1/query\?query=.*})
+ .to_return(
+ status: 200,
+ body: [{}].to_json,
+ headers: { 'Content-Type' => 'application/json' }
+ )
+ 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