diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-23 15:10:04 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-23 15:10:04 +0300 |
commit | d67a86595f0866927815e0945bff032a35c76da9 (patch) | |
tree | 37a3100a473b7a562b065a69e21e24e155985f9a /qa | |
parent | a95a8847071680f16dbd7c0c0511f6492d00fc45 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/resource/issue.rb | 7 | ||||
-rw-r--r-- | qa/qa/runtime/search.rb | 6 | ||||
-rw-r--r-- | qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb | 37 |
3 files changed, 32 insertions, 18 deletions
diff --git a/qa/qa/resource/issue.rb b/qa/qa/resource/issue.rb index c45ab7593b6..d20813e9f2a 100644 --- a/qa/qa/resource/issue.rb +++ b/qa/qa/resource/issue.rb @@ -18,12 +18,14 @@ module QA :iid, :assignee_ids, :labels, - :title + :title, + :description def initialize @assignee_ids = [] @labels = [] @title = "Issue title #{SecureRandom.hex(8)}" + @description = "Issue description #{SecureRandom.hex(8)}" end def fabricate! @@ -34,7 +36,7 @@ module QA Page::Project::Issue::New.perform do |new_page| new_page.fill_title(@title) new_page.choose_template(@template) if @template - new_page.fill_description(@description) if @description + new_page.fill_description(@description) if @description && !@template new_page.choose_milestone(@milestone) if @milestone new_page.create_new_issue end @@ -64,6 +66,7 @@ module QA }.tap do |hash| hash[:milestone_id] = @milestone.id if @milestone hash[:weight] = @weight if @weight + hash[:description] = @description if @description end end diff --git a/qa/qa/runtime/search.rb b/qa/qa/runtime/search.rb index f7f87d96e68..2a5db97cdad 100644 --- a/qa/qa/runtime/search.rb +++ b/qa/qa/runtime/search.rb @@ -8,6 +8,10 @@ module QA extend self extend Support::Api + RETRY_MAX_ITERATION = 10 + RETRY_SLEEP_INTERVAL = 12 + INSERT_RECALL_THRESHOLD = RETRY_MAX_ITERATION * RETRY_SLEEP_INTERVAL + ElasticSearchServerError = Class.new(RuntimeError) def assert_elasticsearch_responding @@ -85,7 +89,7 @@ module QA private def find_target_in_scope(scope, search_term) - QA::Support::Retrier.retry_until(max_attempts: 10, sleep_interval: 10, raise_on_failure: true, retry_on_exception: true) do + QA::Support::Retrier.retry_until(max_attempts: RETRY_MAX_ITERATION, sleep_interval: RETRY_SLEEP_INTERVAL, raise_on_failure: true, retry_on_exception: true) do result = search(scope, search_term) result && result.any? { |record| yield record } end diff --git a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb index 385908f2176..69222a23275 100644 --- a/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb +++ b/qa/qa/specs/features/api/1_manage/import_large_github_repo_spec.rb @@ -133,7 +133,7 @@ module QA it 'imports large Github repo via api' do start = Time.now - imported_project # import the project + Runtime::Logger.info("Importing project '#{imported_project.full_path}'") # import the project and log path fetch_github_objects # fetch all objects right after import has started import_status = lambda do @@ -221,32 +221,39 @@ module QA # @return [void] def verify_mrs_or_issues(type) msg = ->(title) { "expected #{type} with title '#{title}' to have" } + + # Compare length to have easy to read overview how many objects are missing expected = type == 'mr' ? mrs : gl_issues actual = type == 'mr' ? gh_prs : gh_issues + count_msg = "Expected to contain same amount of #{type}s. Gitlab: #{expected.length}, Github: #{actual.length}" + expect(expected.length).to eq(actual.length), count_msg - # Compare length to have easy to read overview how many objects are missing - expect(expected.length).to( - eq(actual.length), - "Expected to contain same amount of #{type}s. Expected: #{expected.length}, actual: #{actual.length}" - ) logger.debug("= Comparing #{type}s =") actual.each do |title, actual_item| print "." # indicate that it is still going but don't spam the output with newlines expected_item = expected[title] + # Print title in the error message to see which object is missing expect(expected_item).to be_truthy, "#{msg.call(title)} been imported" next unless expected_item - expect(expected_item[:body]).to( - include(actual_item[:body]), - "#{msg.call(title)} same description. diff:\n#{differ.diff(expected_item[:body], actual_item[:body])}" - ) - expect(expected_item[:comments].length).to( - eq(actual_item[:comments].length), - "#{msg.call(title)} same amount of comments" - ) - expect(expected_item[:comments]).to match_array(actual_item[:comments]) + # Print difference in the description + expected_body = expected_item[:body] + actual_body = actual_item[:body] + body_msg = <<~MSG + #{msg.call(title)} same description. diff:\n#{differ.diff(expected_item[:body], actual_item[:body])} + MSG + expect(expected_body).to include(actual_body), body_msg + + # Print amount difference first + expected_comments = expected_item[:comments] + actual_comments = actual_item[:comments] + comment_count_msg = <<~MSG + #{msg.call(title)} same amount of comments. Gitlab: #{expected_comments.length}, Github: #{actual_comments.length} + MSG + expect(expected_comments.length).to eq(actual_comments.length), comment_count_msg + expect(expected_comments).to match_array(actual_comments) end puts # print newline after last print to make output pretty end |