2021-02-12 04:08:48 -05:00
|
|
|
# frozen_string_literal: true
|
2021-07-13 20:09:11 -04:00
|
|
|
# rubocop:disable Rails/RakeEnvironment
|
|
|
|
|
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
|
|
|
|
|
|
|
desc "Revokes all personal access tokens"
|
|
|
|
task :revoke_personal_access_tokens do
|
|
|
|
QA::Tools::RevokeAllPersonalAccessTokens.new.run
|
|
|
|
end
|
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"
|
|
|
|
task :initialize_gitlab_auth, [:address] do |t, args|
|
|
|
|
QA::Tools::InitializeGitLabAuth.new(args).run
|
|
|
|
end
|
|
|
|
|
2019-03-05 03:39:04 -05:00
|
|
|
desc "Generate Performance Testdata"
|
2019-06-18 04:29:30 -04:00
|
|
|
task :generate_perf_testdata, :type do |t, args|
|
|
|
|
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"
|
2020-08-04 23:10:58 -04:00
|
|
|
task :delete_test_ssh_keys, [:title_portion, :delete_before, :dry_run] do |t, args|
|
2020-05-06 02:09:36 -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
|
|
|
|
|
|
|
desc "Deletes resources created during E2E test runs"
|
|
|
|
task :delete_test_resources, :file_pattern do |t, args|
|
|
|
|
QA::Tools::DeleteTestResources.new(args[:file_pattern]).run
|
|
|
|
end
|
2021-07-13 20:09:11 -04:00
|
|
|
# rubocop:enable Rails/RakeEnvironment
|