summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
Diffstat (limited to 'qa')
-rw-r--r--qa/.gitignore2
-rw-r--r--qa/Rakefile22
-rw-r--r--qa/load/artillery.yml22
-rw-r--r--qa/qa.rb7
-rw-r--r--qa/qa/page/dashboard/projects.rb2
-rw-r--r--qa/qa/page/dashboard/snippet/index.rb21
-rw-r--r--qa/qa/page/dashboard/snippet/new.rb53
-rw-r--r--qa/qa/page/dashboard/snippet/show.rb63
-rw-r--r--qa/qa/page/main/menu.rb5
-rw-r--r--qa/qa/resource/snippet.rb30
-rw-r--r--qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb31
-rw-r--r--qa/qa/tools/generate_perf_testdata.rb12
12 files changed, 54 insertions, 216 deletions
diff --git a/qa/.gitignore b/qa/.gitignore
index 102f7e5e54d..b0ae074ac07 100644
--- a/qa/.gitignore
+++ b/qa/.gitignore
@@ -1,3 +1,3 @@
tmp/
.ruby-version
-urls.txt
+urls.yml
diff --git a/qa/Rakefile b/qa/Rakefile
index b6ad09f9b00..bad8daac848 100644
--- a/qa/Rakefile
+++ b/qa/Rakefile
@@ -16,3 +16,25 @@ desc "Generate Performance Testdata"
task :generate_perf_testdata do
QA::Tools::GeneratePerfTestdata.new.run
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)
+ raise "\n#{urls_file} file is missing. Please provide correct URLS_FILE_PATH or all of HOST_URL, LARGE_ISSUE_URL and LARGE_MR_URL\n\n"
+ end
+
+ urls = YAML.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]
diff --git a/qa/load/artillery.yml b/qa/load/artillery.yml
new file mode 100644
index 00000000000..e2c3c293d8b
--- /dev/null
+++ b/qa/load/artillery.yml
@@ -0,0 +1,22 @@
+config:
+ target: "{{ $processEnvironment.HOST_URL }}"
+ phases:
+ - duration: 60
+ arrivalRate: 1
+ name: "Warm up"
+ - duration: 120
+ arrivalRate: 1
+ rampTo: 50
+ name: "Gradual ramp up"
+ - duration: 60
+ arrivalRate: 50
+ name: "Sustained max load"
+scenarios:
+ - name: "Visit large issue url"
+ flow:
+ - get:
+ url: "{{ $processEnvironment.LARGE_ISSUE_URL }}"
+ - name: "Visit large MR url"
+ flow:
+ - get:
+ url: "{{ $processEnvironment.LARGE_MR_URL }}"
diff --git a/qa/qa.rb b/qa/qa.rb
index ec8aef31e48..a79fecaab71 100644
--- a/qa/qa.rb
+++ b/qa/qa.rb
@@ -61,7 +61,6 @@ module QA
autoload :File, 'qa/resource/file'
autoload :Fork, 'qa/resource/fork'
autoload :SSHKey, 'qa/resource/ssh_key'
- autoload :Snippet, 'qa/resource/snippet'
module Events
autoload :Base, 'qa/resource/events/base'
@@ -143,12 +142,6 @@ module QA
module Dashboard
autoload :Projects, 'qa/page/dashboard/projects'
autoload :Groups, 'qa/page/dashboard/groups'
-
- module Snippet
- autoload :New, 'qa/page/dashboard/snippet/new'
- autoload :Index, 'qa/page/dashboard/snippet/index'
- autoload :Show, 'qa/page/dashboard/snippet/show'
- end
end
module Group
diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb
index 271c5456efe..0f434577b3b 100644
--- a/qa/qa/page/dashboard/projects.rb
+++ b/qa/qa/page/dashboard/projects.rb
@@ -2,6 +2,8 @@ module QA
module Page
module Dashboard
class Projects < Page::Base
+ view 'app/views/dashboard/projects/index.html.haml'
+
view 'app/views/shared/projects/_search_form.html.haml' do
element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/ # rubocop:disable QA/ElementWithPattern
end
diff --git a/qa/qa/page/dashboard/snippet/index.rb b/qa/qa/page/dashboard/snippet/index.rb
deleted file mode 100644
index 1f467fda9e1..00000000000
--- a/qa/qa/page/dashboard/snippet/index.rb
+++ /dev/null
@@ -1,21 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- module Page
- module Dashboard
- module Snippet
- class Index < Page::Base
- view 'app/views/layouts/header/_new_dropdown.haml' do
- element :new_menu_toggle
- element :global_new_snippet_link
- end
-
- def go_to_new_snippet_page
- click_element :new_menu_toggle
- click_element :global_new_snippet_link
- end
- end
- end
- end
- end
-end
diff --git a/qa/qa/page/dashboard/snippet/new.rb b/qa/qa/page/dashboard/snippet/new.rb
deleted file mode 100644
index a637b869d2f..00000000000
--- a/qa/qa/page/dashboard/snippet/new.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- module Page
- module Dashboard
- module Snippet
- class New < Page::Base
- view 'app/views/shared/form_elements/_description.html.haml' do
- element :issuable_form_description
- end
-
- view 'app/views/shared/snippets/_form.html.haml' do
- element :snippet_title
- element :snippet_file_name
- element :create_snippet_button
- end
-
- def fill_title(title)
- fill_element :snippet_title, title
- end
-
- def fill_description(description)
- fill_element :issuable_form_description, description
- end
-
- def set_visibility(visibility)
- choose visibility
- end
-
- def fill_file_name(name)
- finished_loading?
- fill_element :snippet_file_name, name
- end
-
- def fill_file_content(content)
- finished_loading?
- text_area.set content
- end
-
- def create_snippet
- click_element :create_snippet_button
- end
-
- private
-
- def text_area
- find('#editor>textarea', visible: false)
- end
- end
- end
- end
- end
-end
diff --git a/qa/qa/page/dashboard/snippet/show.rb b/qa/qa/page/dashboard/snippet/show.rb
deleted file mode 100644
index a75ea63eca7..00000000000
--- a/qa/qa/page/dashboard/snippet/show.rb
+++ /dev/null
@@ -1,63 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- module Page
- module Dashboard
- module Snippet
- class Show < Page::Base
- view 'app/views/shared/snippets/_header.html.haml' do
- element :snippet_title
- element :snippet_description
- element :embed_type
- element :snippet_box
- end
-
- view 'app/views/projects/blob/_header_content.html.haml' do
- element :file_title_name
- end
-
- view 'app/views/shared/_file_highlight.html.haml' do
- element :file_content
- end
-
- def has_snippet_title?(snippet_title)
- within_element(:snippet_title) do
- has_text?(snippet_title)
- end
- end
-
- def has_snippet_description?(snippet_description)
- within_element(:snippet_description) do
- has_text?(snippet_description)
- end
- end
-
- def has_embed_type?(embed_type)
- within_element(:embed_type) do
- has_text?(embed_type)
- end
- end
-
- def has_visibility_type?(visibility_type)
- within_element(:snippet_box) do
- has_text?(visibility_type)
- end
- end
-
- def has_file_name?(file_name)
- within_element(:file_title_name) do
- has_text?(file_name)
- end
- end
-
- def has_file_content?(file_content)
- finished_loading?
- within_element(:file_content) do
- has_text?(file_content)
- end
- end
- end
- end
- end
- end
-end
diff --git a/qa/qa/page/main/menu.rb b/qa/qa/page/main/menu.rb
index 1b3445b0064..55500e831c6 100644
--- a/qa/qa/page/main/menu.rb
+++ b/qa/qa/page/main/menu.rb
@@ -19,7 +19,6 @@ module QA
element :admin_area_link
element :projects_dropdown
element :groups_dropdown
- element :snippets_link
end
view 'app/views/layouts/nav/projects_dropdown/_show.html.haml' do
@@ -67,10 +66,6 @@ module QA
end
end
- def go_to_snippets
- click_element :snippets_link
- end
-
def has_personal_area?(wait: Capybara.default_max_wait_time)
has_element?(:user_avatar, wait: wait)
end
diff --git a/qa/qa/resource/snippet.rb b/qa/qa/resource/snippet.rb
deleted file mode 100644
index 1478f197570..00000000000
--- a/qa/qa/resource/snippet.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- module Resource
- class Snippet < Base
- attr_accessor :title, :description, :file_content, :visibility, :file_name
-
- def initialize
- @title = 'New snippet title'
- @description = 'The snippet description'
- @visibility = 'Public'
- @file_content = 'The snippet content'
- @file_name = 'New snippet file name'
- end
-
- def fabricate!
- Page::Dashboard::Snippet::Index.perform(&:go_to_new_snippet_page)
-
- Page::Dashboard::Snippet::New.perform do |page|
- page.fill_title(@title)
- page.fill_description(@description)
- page.set_visibility(@visibility)
- page.fill_file_name(@file_name)
- page.fill_file_content(@file_content)
- page.create_snippet
- end
- end
- end
- end
-end
diff --git a/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb b/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb
deleted file mode 100644
index ab53dff464e..00000000000
--- a/qa/qa/specs/features/browser_ui/3_create/snippet/create_snippet_spec.rb
+++ /dev/null
@@ -1,31 +0,0 @@
-# frozen_string_literal: true
-
-module QA
- context 'Create', :smoke do
- describe 'Snippet creation' do
- it 'User creates a snippet' do
- Runtime::Browser.visit(:gitlab, Page::Main::Login)
- Page::Main::Login.perform(&:sign_in_using_credentials)
-
- Page::Main::Menu.perform(&:go_to_snippets)
-
- Resource::Snippet.fabricate_via_browser_ui! do |snippet|
- snippet.title = 'Snippet title'
- snippet.description = 'Snippet description'
- snippet.visibility = 'Public'
- snippet.file_name = 'New snippet file name'
- snippet.file_content = 'Snippet file text'
- end
-
- Page::Dashboard::Snippet::Show.perform do |snippet|
- expect(snippet).to have_snippet_title('Snippet title')
- expect(snippet).to have_snippet_description('Snippet description')
- expect(snippet).to have_embed_type('Embed')
- expect(snippet).to have_visibility_type('Public')
- expect(snippet).to have_file_name('New snippet file name')
- expect(snippet).to have_file_content('Snippet file text')
- end
- end
- end
- end
-end
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