diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 21:10:40 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-02-23 21:10:40 +0300 |
commit | c37dd28c4afd33fee46cff8ddfdada8a3f54564c (patch) | |
tree | c4fb2a3f93338991784cf89b3b1547ab23c1b5e1 /qa | |
parent | 5ff5047fdc2c614f347de5c388424b50a5460165 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/Gemfile | 1 | ||||
-rw-r--r-- | qa/Gemfile.lock | 22 | ||||
-rw-r--r-- | qa/qa/page/project/import/github.rb | 8 | ||||
-rw-r--r-- | qa/qa/page/project/settings/services/jira.rb | 23 | ||||
-rw-r--r-- | qa/qa/resource/project_imported_from_github.rb | 4 | ||||
-rw-r--r-- | qa/qa/service/praefect_manager.rb | 42 | ||||
-rw-r--r-- | qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb | 15 |
7 files changed, 81 insertions, 34 deletions
diff --git a/qa/Gemfile b/qa/Gemfile index f55d27c159b..21ca945a500 100644 --- a/qa/Gemfile +++ b/qa/Gemfile @@ -21,6 +21,7 @@ gem 'rotp', '~> 3.1.0' gem 'timecop', '~> 0.9.1' gem 'parallel', '~> 1.19' gem 'rspec-parameterized', '~> 0.4.2' +gem 'github_api', '~> 0.18.2' group :development do gem 'pry-byebug', '~> 3.5.1', platform: :mri diff --git a/qa/Gemfile.lock b/qa/Gemfile.lock index 3b532d90526..4eeaca1f1a6 100644 --- a/qa/Gemfile.lock +++ b/qa/Gemfile.lock @@ -39,19 +39,31 @@ GEM adamantium (~> 0.2.0) equalizer (~> 0.0.9) concurrent-ruby (1.1.7) + descendants_tracker (0.0.4) + thread_safe (~> 0.3, >= 0.3.1) diff-lcs (1.3) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) equalizer (0.0.11) faker (1.9.3) i18n (>= 0.7) + faraday (0.17.3) + multipart-post (>= 1.2, < 3) + github_api (0.18.2) + addressable (~> 2.4) + descendants_tracker (~> 0.0.4) + faraday (~> 0.8) + hashie (~> 3.5, >= 3.5.2) + oauth2 (~> 1.0) gitlab-qa (4.0.0) + hashie (3.6.0) http-accept (1.7.0) http-cookie (1.0.3) domain_name (~> 0.5) i18n (1.8.5) concurrent-ruby (~> 1.0) ice_nine (0.11.2) + jwt (2.2.2) knapsack (1.17.1) rake launchy (2.4.3) @@ -65,10 +77,19 @@ GEM mini_mime (1.0.2) mini_portile2 (2.5.0) minitest (5.14.2) + multi_json (1.15.0) + multi_xml (0.6.0) + multipart-post (2.1.1) netrc (0.11.0) nokogiri (1.11.1) mini_portile2 (~> 2.5.0) racc (~> 1.4) + oauth2 (1.4.4) + faraday (>= 0.8, < 2.0) + jwt (>= 1.0, < 3.0) + multi_json (~> 1.3) + multi_xml (~> 0.5) + rack (>= 1.2, < 3) parallel (1.19.2) parallel_tests (2.29.0) parallel @@ -155,6 +176,7 @@ DEPENDENCIES capybara (~> 3.29.0) capybara-screenshot (~> 1.0.23) faker (~> 1.6, >= 1.6.6) + github_api (~> 0.18.2) gitlab-qa knapsack (~> 1.17) nokogiri (~> 1.11.1) diff --git a/qa/qa/page/project/import/github.rb b/qa/qa/page/project/import/github.rb index 6890c7de9f8..081d5303cbb 100644 --- a/qa/qa/page/project/import/github.rb +++ b/qa/qa/page/project/import/github.rb @@ -30,6 +30,7 @@ module QA set_path(full_path, name) import_project(full_path) wait_for_success + go_to_project(name) end private @@ -73,6 +74,13 @@ module QA page.has_content?('Done', wait: 1.0) end end + + def go_to_project(name) + Page::Main::Menu.perform(&:go_to_projects) + Page::Dashboard::Projects.perform do |dashboard| + dashboard.go_to_project(name) + end + end end end end diff --git a/qa/qa/page/project/settings/services/jira.rb b/qa/qa/page/project/settings/services/jira.rb index a9409d0223a..eaa3e90db78 100644 --- a/qa/qa/page/project/settings/services/jira.rb +++ b/qa/qa/page/project/settings/services/jira.rb @@ -10,12 +10,7 @@ module QA element :service_url_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern element :service_username_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern element :service_password_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern - end - - view 'app/assets/javascripts/integrations/edit/components/jira_trigger_fields.vue' do - element :service_issue_transition_mode_auto, ':data-qa-selector="`service_issue_transition_mode_${issueTransitionOption.value}`"' # rubocop:disable QA/ElementWithPattern - element :service_issue_transition_mode_custom, ':data-qa-selector="`service_issue_transition_mode_${issueTransitionOption.value}`"' # rubocop:disable QA/ElementWithPattern - element :service_jira_issue_transition_id_field + element :service_jira_issue_transition_id_field, ':data-qa-selector="`${fieldId}_field`"' # rubocop:disable QA/ElementWithPattern end view 'app/assets/javascripts/integrations/edit/components/integration_form.vue' do @@ -28,9 +23,7 @@ module QA set_jira_server_url(url) set_username(Runtime::Env.jira_admin_username) set_password(Runtime::Env.jira_admin_password) - - use_custom_transitions - set_transition_ids('11,21,31,41') + set_transaction_ids('11,21,31,41') click_save_changes_button wait_until(reload: false) do @@ -52,16 +45,8 @@ module QA fill_element(:service_password_field, password) end - def use_automatic_transitions - click_element :service_issue_transition_mode_auto - end - - def use_custom_transitions - click_element :service_issue_transition_mode_custom - end - - def set_transition_ids(transition_ids) - fill_element(:service_jira_issue_transition_id_field, transition_ids) + def set_transaction_ids(transaction_ids) + fill_element(:service_jira_issue_transition_id_field, transaction_ids) end def click_save_changes_button diff --git a/qa/qa/resource/project_imported_from_github.rb b/qa/qa/resource/project_imported_from_github.rb index 0b817b345fd..b06a7fe4e3d 100644 --- a/qa/qa/resource/project_imported_from_github.rb +++ b/qa/qa/resource/project_imported_from_github.rb @@ -12,7 +12,7 @@ module QA group.visit! Page::Group::Show.perform(&:go_to_new_project) - go_to_import_tab + go_to_import_page Page::Project::New.perform(&:click_github_link) Page::Project::Import::Github.perform do |import_page| @@ -21,7 +21,7 @@ module QA end end - def go_to_import_tab + def go_to_import_page Page::Project::New.perform(&:click_import_project) end end diff --git a/qa/qa/service/praefect_manager.rb b/qa/qa/service/praefect_manager.rb index ab4f28c292f..119013175c0 100644 --- a/qa/qa/service/praefect_manager.rb +++ b/qa/qa/service/praefect_manager.rb @@ -353,15 +353,47 @@ module QA Support::Waiter.wait_until(sleep_interval: 1) { replication_queue_incomplete_count == 0 && replicated?(project_id) } end + def replication_pending? + result = [] + shell sql_to_docker_exec_cmd( + <<~SQL + select job from replication_queue + where state = 'ready' + and job ->> 'change' = 'update' + and job ->> 'source_node_storage' = '#{current_primary_node}' + and job ->> 'target_node_storage' = '#{@primary_node}'; + SQL + ) do |line| + result << line + end + + # The result looks like: + # + # job + # ----------- + # {"change": "update", "params": null, "relative_path": "@hashed/4b/22/4b227777d4dd1fc61c6f884f48641d02b4d121d3fd328cb08b5531fcacdabf8a.git", "virtual_storage": "default", "source_node_storage": "gitaly3", "target_node_storage": "gitaly1"} + # (1 row) + # <blank row> + # + # Therefore when replication is pending there is at least 1 row of data plus 4 rows of metadata/layout + + result.size >= 5 + end + private def current_primary_node - shell dataloss_command do |line| - QA::Runtime::Logger.debug(line.chomp) - - match = line.match(/Primary: (.*)/) - break match[1] if match + result = [] + shell sql_to_docker_exec_cmd("select node_name from shard_primaries where shard_name = '#{@virtual_storage}';") do |line| + result << line end + # The result looks like: + # node_name + # ----------- + # gitaly1 + # (1 row) + + result[2].strip end def dataloss_command diff --git a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb index 89bf92cd3af..a240f72944f 100644 --- a/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb +++ b/qa/qa/specs/features/api/3_create/gitaly/backend_node_recovery_spec.rb @@ -3,7 +3,7 @@ module QA RSpec.describe 'Create' do context 'Gitaly' do - describe 'Backend node recovery', :orchestrated, :gitaly_cluster, :skip_live_env, quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/238186', type: :investigating } do + describe 'Backend node recovery', :orchestrated, :gitaly_cluster, :skip_live_env do let(:praefect_manager) { Service::PraefectManager.new } let(:project) do Resource::Project.fabricate! do |project| @@ -50,18 +50,17 @@ module QA push.file_content = 'new file' end + # Confirm that the commit is waiting to be replicated + expect(praefect_manager).to be_replication_pending + # Start the old primary node again praefect_manager.start_primary_node - praefect_manager.wait_for_health_check_current_primary_node - - # Confirm dataloss (i.e., inconsistent nodes) - expect(praefect_manager.replicated?(project.id)).to be false + praefect_manager.wait_for_health_check_all_nodes - # Reconcile nodes to recover from dataloss - praefect_manager.reconcile_nodes + # Wait for automatic replication praefect_manager.wait_for_replication(project.id) - # Confirm that both commits are available after reconciliation + # Confirm that both commits are available expect(project.commits.map { |commit| commit[:message].chomp }) .to include("Initial commit").and include("pushed after failover") end |