2021-02-12 04:08:48 -05:00
|
|
|
# frozen_string_literal: true
|
2021-07-13 20:09:11 -04:00
|
|
|
|
2022-01-14 19:15:15 -05:00
|
|
|
require_relative "qa"
|
2021-02-12 04:08:48 -05:00
|
|
|
|
2022-01-14 19:15:15 -05:00
|
|
|
Dir['tasks/*.rake'].each { |file| load file }
|
2019-01-14 02:17:18 -05:00
|
|
|
|
2019-01-23 05:42:20 -05:00
|
|
|
desc "Deletes subgroups within a provided group"
|
|
|
|
task :delete_subgroups do
|
|
|
|
QA::Tools::DeleteSubgroups.new.run
|
|
|
|
end
|
2019-03-05 03:39:04 -05:00
|
|
|
|
2020-10-05 02:08:45 -04:00
|
|
|
desc "Initialize GitLab with an access token"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :initialize_gitlab_auth, [:address] do |_, args|
|
2022-10-18 08:09:21 -04:00
|
|
|
QA::Tools::InitializeGitlabAuth.new(args).run
|
2020-10-05 02:08:45 -04:00
|
|
|
end
|
|
|
|
|
2019-03-05 03:39:04 -05:00
|
|
|
desc "Generate Performance Testdata"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :generate_perf_testdata, :type do |_, args|
|
2019-06-18 04:29:30 -04:00
|
|
|
args.with_defaults(type: :all)
|
|
|
|
QA::Tools::GeneratePerfTestdata.new.method(args[:type]).call
|
2019-03-05 03:39:04 -05:00
|
|
|
end
|
2019-03-19 01:09:30 -04:00
|
|
|
|
|
|
|
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-07-13 20:09:11 -04:00
|
|
|
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-03-19 01:09:30 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
urls = YAML.safe_load(File.read(urls_file))
|
2019-03-25 23:25:36 -04:00
|
|
|
ENV['HOST_URL'] = urls["host"]
|
|
|
|
ENV['LARGE_ISSUE_URL'] = urls["large_issue"]
|
|
|
|
ENV['LARGE_MR_URL'] = urls["large_mr"]
|
2019-03-19 01:09:30 -04:00
|
|
|
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-04-28 23:09:39 -04:00
|
|
|
|
2020-05-06 02:09:36 -04:00
|
|
|
desc "Deletes test ssh keys a user"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :delete_test_ssh_keys, [:title_portion, :delete_before, :dry_run] do |_, args|
|
2022-10-18 08:09:21 -04:00
|
|
|
QA::Tools::DeleteTestSshKeys.new(args).run
|
2020-04-28 23:09:39 -04:00
|
|
|
end
|
2020-12-04 16:09:29 -05:00
|
|
|
|
|
|
|
desc "Deletes projects directly under the provided group"
|
|
|
|
task :delete_projects do
|
|
|
|
QA::Tools::DeleteProjects.new.run
|
|
|
|
end
|
2022-01-17 16:15:21 -05:00
|
|
|
|
2022-02-18 01:14:34 -05:00
|
|
|
desc "Deletes test users"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :delete_test_users, [:delete_before, :dry_run, :exclude_users] do |_, args|
|
2022-02-18 01:14:34 -05:00
|
|
|
QA::Tools::DeleteTestUsers.new(args).run
|
|
|
|
end
|
2022-03-11 07:07:56 -05:00
|
|
|
|
2022-05-16 02:08:30 -04:00
|
|
|
desc "Deletes snippets"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :delete_test_snippets, [:delete_before, :dry_run] do |_, args|
|
2022-05-16 02:08:30 -04:00
|
|
|
QA::Tools::DeleteTestSnippets.new(args).run
|
|
|
|
end
|
|
|
|
|
2022-03-11 07:07:56 -05:00
|
|
|
namespace :test_resources do
|
|
|
|
desc "Deletes resources created during E2E test runs"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :delete, [:file_pattern] do |_, args|
|
2022-03-11 07:07:56 -05:00
|
|
|
QA::Tools::TestResourcesHandler.new(args[:file_pattern]).run_delete
|
|
|
|
end
|
|
|
|
|
|
|
|
desc "Upload test resources JSON files to GCS"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :upload, [:file_pattern, :ci_project_name] do |_, args|
|
2022-03-17 23:07:42 -04:00
|
|
|
QA::Tools::TestResourcesHandler.new(args[:file_pattern]).upload(args[:ci_project_name])
|
2022-03-11 07:07:56 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Download test resources JSON files from GCS"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :download, [:ci_project_name] do |_, args|
|
2022-03-17 23:07:42 -04:00
|
|
|
QA::Tools::TestResourcesHandler.new.download(args[:ci_project_name])
|
2022-03-11 07:07:56 -05:00
|
|
|
end
|
|
|
|
end
|
2022-07-21 17:10:17 -04:00
|
|
|
|
|
|
|
desc "Deletes user's projects"
|
2022-09-08 11:12:29 -04:00
|
|
|
task :delete_user_projects, [:delete_before, :dry_run] do |_, args|
|
2022-07-21 17:10:17 -04:00
|
|
|
QA::Tools::DeleteUserProjects.new(args).run
|
|
|
|
end
|
2022-09-08 11:12:29 -04:00
|
|
|
|
|
|
|
desc "Revokes user's personal access tokens"
|
|
|
|
task :revoke_user_pats, [:revoke_before, :dry_run] do |_, args|
|
|
|
|
QA::Tools::RevokeUserPersonalAccessTokens.new(args).run
|
|
|
|
end
|