2021-03-11 19:13:27 +05:30
|
|
|
# frozen_string_literal: true
|
2021-09-30 23:02:18 +05:30
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
require_relative "qa"
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2022-03-02 08:16:31 +05:30
|
|
|
Dir['tasks/*.rake'].each { |file| load file }
|
2019-02-15 15:39:39 +05:30
|
|
|
|
|
|
|
desc "Revokes all personal access tokens"
|
|
|
|
task :revoke_personal_access_tokens do
|
|
|
|
QA::Tools::RevokeAllPersonalAccessTokens.new.run
|
|
|
|
end
|
2019-03-02 22:35:43 +05:30
|
|
|
|
|
|
|
desc "Deletes subgroups within a provided group"
|
|
|
|
task :delete_subgroups do
|
|
|
|
QA::Tools::DeleteSubgroups.new.run
|
|
|
|
end
|
2019-07-07 11:18:12 +05:30
|
|
|
|
2021-01-03 14:25:43 +05:30
|
|
|
desc "Initialize GitLab with an access token"
|
|
|
|
task :initialize_gitlab_auth, [:address] do |t, args|
|
|
|
|
QA::Tools::InitializeGitLabAuth.new(args).run
|
|
|
|
end
|
|
|
|
|
2019-07-07 11:18:12 +05:30
|
|
|
desc "Generate Performance Testdata"
|
2019-09-30 21:07:59 +05:30
|
|
|
task :generate_perf_testdata, :type do |t, args|
|
|
|
|
args.with_defaults(type: :all)
|
|
|
|
QA::Tools::GeneratePerfTestdata.new.method(args[:type]).call
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
desc "Run artillery load tests"
|
|
|
|
task :run_artillery_load_tests do
|
|
|
|
unless ENV['HOST_URL'] && ENV['LARGE_ISSUE_URL'] && ENV['LARGE_MR_URL']
|
|
|
|
urls_file = ENV['URLS_FILE_PATH'] || 'urls.yml'
|
|
|
|
|
|
|
|
unless File.exist?(urls_file)
|
2021-09-30 23:02:18 +05:30
|
|
|
raise(<<~ERR)
|
|
|
|
#{urls_file} file is missing. Please provide correct URLS_FILE_PATH or all of HOST_URL, LARGE_ISSUE_URL and LARGE_MR_URL\n
|
|
|
|
ERR
|
2019-07-07 11:18:12 +05:30
|
|
|
end
|
|
|
|
|
|
|
|
urls = YAML.safe_load(File.read(urls_file))
|
|
|
|
ENV['HOST_URL'] = urls["host"]
|
|
|
|
ENV['LARGE_ISSUE_URL'] = urls["large_issue"]
|
|
|
|
ENV['LARGE_MR_URL'] = urls["large_mr"]
|
|
|
|
end
|
|
|
|
|
|
|
|
sh('artillery run load/artillery.yml -o report.json')
|
|
|
|
sh('artillery report report.json -o report.html && rm report.json')
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Generate data and run load tests"
|
|
|
|
task generate_data_and_run_load_test: [:generate_perf_testdata, :run_artillery_load_tests]
|
2020-05-24 23:13:21 +05:30
|
|
|
|
|
|
|
desc "Deletes test ssh keys a user"
|
2020-10-24 23:57:45 +05:30
|
|
|
task :delete_test_ssh_keys, [:title_portion, :delete_before, :dry_run] do |t, args|
|
2020-05-24 23:13:21 +05:30
|
|
|
QA::Tools::DeleteTestSSHKeys.new(args).run
|
|
|
|
end
|
2021-02-22 17:27:13 +05:30
|
|
|
|
|
|
|
desc "Deletes projects directly under the provided group"
|
|
|
|
task :delete_projects do
|
|
|
|
QA::Tools::DeleteProjects.new.run
|
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
desc "Deletes test users"
|
|
|
|
task :delete_test_users, [:delete_before, :dry_run, :exclude_users] do |t, args|
|
|
|
|
QA::Tools::DeleteTestUsers.new(args).run
|
|
|
|
end
|
|
|
|
|
2022-07-16 23:28:13 +05:30
|
|
|
desc "Deletes snippets"
|
|
|
|
task :delete_test_snippets, [:delete_before, :dry_run] do |t, args|
|
|
|
|
QA::Tools::DeleteTestSnippets.new(args).run
|
|
|
|
end
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
namespace :test_resources do
|
|
|
|
desc "Deletes resources created during E2E test runs"
|
|
|
|
task :delete, [:file_pattern] do |t, args|
|
|
|
|
QA::Tools::TestResourcesHandler.new(args[:file_pattern]).run_delete
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload test resources JSON files to GCS"
|
|
|
|
task :upload, [:file_pattern, :ci_project_name] do |t, args|
|
|
|
|
QA::Tools::TestResourcesHandler.new(args[:file_pattern]).upload(args[:ci_project_name])
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Download test resources JSON files from GCS"
|
|
|
|
task :download, [:ci_project_name] do |t, args|
|
|
|
|
QA::Tools::TestResourcesHandler.new.download(args[:ci_project_name])
|
|
|
|
end
|
2022-03-02 08:16:31 +05:30
|
|
|
end
|
2022-08-27 11:52:29 +05:30
|
|
|
|
|
|
|
desc "Deletes user's projects"
|
|
|
|
task :delete_user_projects, [:delete_before, :dry_run] do |t, args|
|
|
|
|
QA::Tools::DeleteUserProjects.new(args).run
|
|
|
|
end
|