summaryrefslogtreecommitdiff
path: root/qa/qa
diff options
context:
space:
mode:
authorSanad Liaquat <sliaquat@gitlab.com>2019-03-19 05:09:30 +0000
committerRamya Authappan <rauthappan@gitlab.com>2019-03-19 05:09:30 +0000
commitf9832a08c513853ab10dd86adc9c7dd596e30da0 (patch)
tree1651cbd87f77b947f3042a0d71fc80c7b0c1f69b /qa/qa
parent3c5a81cb83e6022530e53b1b6cdedf94c92d980e (diff)
downloadgitlab-ce-f9832a08c513853ab10dd86adc9c7dd596e30da0.tar.gz
Add load testing script for artillery.io
Also add rake tasks that makes use of existing performance data genertion task.
Diffstat (limited to 'qa/qa')
-rw-r--r--qa/qa/tools/generate_perf_testdata.rb12
1 files changed, 7 insertions, 5 deletions
diff --git a/qa/qa/tools/generate_perf_testdata.rb b/qa/qa/tools/generate_perf_testdata.rb
index ad515014794..0a0dbdf5b15 100644
--- a/qa/qa/tools/generate_perf_testdata.rb
+++ b/qa/qa/tools/generate_perf_testdata.rb
@@ -2,6 +2,7 @@
require 'securerandom'
require 'faker'
+require 'yaml'
require_relative '../../qa'
# This script generates testdata for Performance Testing.
# Required environment variables: PERSONAL_ACCESS_TOKEN and GITLAB_ADDRESS
@@ -20,7 +21,8 @@ module QA
@api_client = Runtime::API::Client.new(ENV['GITLAB_ADDRESS'], personal_access_token: ENV['PERSONAL_ACCESS_TOKEN'])
@group_name = "gitlab-qa-perf-sandbox-#{SecureRandom.hex(8)}"
@project_name = "my-test-project-#{SecureRandom.hex(8)}"
- @urls = {}
+ @visibility = "public"
+ @urls = { host: ENV['GITLAB_ADDRESS'] }
end
def run
@@ -39,26 +41,26 @@ module QA
threads_arr = []
methods_arr.each do |m|
- threads_arr << Thread.new {m.call}
+ threads_arr << Thread.new { m.call }
end
threads_arr.each(&:join)
STDOUT.puts "\nURLs: #{@urls}"
- File.open("urls.txt", "w") { |file| file.puts @urls.to_s}
+ File.open("urls.yml", "w") { |file| file.puts @urls.to_yaml }
STDOUT.puts "\nDone"
end
private
def create_group
- group_search_response = post Runtime::API::Request.new(@api_client, "/groups").url, "name=#{@group_name}&path=#{@group_name}"
+ group_search_response = post Runtime::API::Request.new(@api_client, "/groups").url, "name=#{@group_name}&path=#{@group_name}&visibility=#{@visibility}"
group = JSON.parse(group_search_response.body)
@urls[:group_page] = group["web_url"]
group["id"]
end
def create_project(group_id)
- create_project_response = post Runtime::API::Request.new(@api_client, "/projects").url, "name=#{@project_name}&namespace_id=#{group_id}"
+ create_project_response = post Runtime::API::Request.new(@api_client, "/projects").url, "name=#{@project_name}&namespace_id=#{group_id}&visibility=#{@visibility}"
@urls[:project_page] = JSON.parse(create_project_response.body)["web_url"]
end