Commit 1679d31f authored by Andrejs Cunskis's avatar Andrejs Cunskis Committed by Dan Davison

Additional validations for github import e2e spec

parent 2621790e
...@@ -72,7 +72,7 @@ module QA ...@@ -72,7 +72,7 @@ module QA
# TODO: set reload:false and remove skip_finished_loading_check_on_refresh when # TODO: set reload:false and remove skip_finished_loading_check_on_refresh when
# https://gitlab.com/gitlab-org/gitlab/-/issues/292861 is fixed # https://gitlab.com/gitlab-org/gitlab/-/issues/292861 is fixed
wait_until( wait_until(
max_duration: 60, max_duration: 90,
sleep_interval: 5.0, sleep_interval: 5.0,
reload: true, reload: true,
skip_finished_loading_check_on_refresh: true skip_finished_loading_check_on_refresh: true
......
...@@ -131,6 +131,18 @@ module QA ...@@ -131,6 +131,18 @@ module QA
"/projects/#{id}" "/projects/#{id}"
end end
def api_put_path
"/projects/#{id}"
end
def api_post_path
'/projects'
end
def api_delete_path
"/projects/#{id}"
end
def api_get_archive_path(type = 'tar.gz') def api_get_archive_path(type = 'tar.gz')
"#{api_get_path}/repository/archive.#{type}" "#{api_get_path}/repository/archive.#{type}"
end end
...@@ -183,12 +195,16 @@ module QA ...@@ -183,12 +195,16 @@ module QA
"#{api_get_path}/issues" "#{api_get_path}/issues"
end end
def api_put_path def api_labels_path
"/projects/#{id}" "#{api_get_path}/labels"
end end
def api_post_path def api_milestones_path
'/projects' "#{api_get_path}/milestones"
end
def api_wikis_path
"#{api_get_path}/wikis"
end end
def api_post_body def api_post_body
...@@ -211,10 +227,6 @@ module QA ...@@ -211,10 +227,6 @@ module QA
post_body post_body
end end
def api_delete_path
"/projects/#{id}"
end
def change_repository_storage(new_storage) def change_repository_storage(new_storage)
put_body = { repository_storage: new_storage } put_body = { repository_storage: new_storage }
response = put(request_url(api_put_path), put_body) response = put(request_url(api_put_path), put_body)
...@@ -236,11 +248,6 @@ module QA ...@@ -236,11 +248,6 @@ module QA
) )
end end
def commits
response = get(request_url(api_commits_path))
parse_body(response)
end
def default_branch def default_branch
reload!.api_response[:default_branch] || Runtime::Env.default_branch reload!.api_response[:default_branch] || Runtime::Env.default_branch
end end
...@@ -259,6 +266,11 @@ module QA ...@@ -259,6 +266,11 @@ module QA
result[:import_status] result[:import_status]
end end
def commits
response = get(request_url(api_commits_path))
parse_body(response)
end
def merge_requests def merge_requests
response = get(request_url(api_merge_requests_path)) response = get(request_url(api_merge_requests_path))
parse_body(response) parse_body(response)
...@@ -269,11 +281,8 @@ module QA ...@@ -269,11 +281,8 @@ module QA
end end
def runners(tag_list: nil) def runners(tag_list: nil)
response = if tag_list url = tag_list ? "#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}" : api_runners_path
get(request_url("#{api_runners_path}?tag_list=#{tag_list.compact.join(',')}", per_page: '100')) response = get(request_url(url, per_page: '100'))
else
get(request_url(api_runners_path, per_page: '100'))
end
parse_body(response) parse_body(response)
end end
...@@ -318,6 +327,21 @@ module QA ...@@ -318,6 +327,21 @@ module QA
parse_body(response) parse_body(response)
end end
def labels
response = get(request_url(api_labels_path))
parse_body(response)
end
def milestones
response = get(request_url(api_milestones_path))
parse_body(response)
end
def wikis
response = get(request_url(api_wikis_path))
parse_body(response)
end
private private
def transform_api_resource(api_resource) def transform_api_resource(api_resource)
......
...@@ -37,7 +37,11 @@ module QA ...@@ -37,7 +37,11 @@ module QA
aggregate_failures do aggregate_failures do
verify_repository_import verify_repository_import
verify_commits_import
verify_labels_import
verify_issues_import verify_issues_import
verify_milestones_import
verify_wikis_import
verify_merge_requests_import verify_merge_requests_import
end end
end end
...@@ -50,6 +54,29 @@ module QA ...@@ -50,6 +54,29 @@ module QA
) )
end end
def verify_commits_import
expect(imported_project.commits.length).to eq(20)
end
def verify_labels_import
labels = imported_project.labels.map { |label| label.slice(:name, :color) }
expect(labels).to eq(
[
{ name: 'bug', color: '#d73a4a' },
{ name: 'custom new label', color: '#fc8f91' },
{ name: 'documentation', color: '#0075ca' },
{ name: 'duplicate', color: '#cfd3d7' },
{ name: 'enhancement', color: '#a2eeef' },
{ name: 'good first issue', color: '#7057ff' },
{ name: 'help wanted', color: '#008672' },
{ name: 'invalid', color: '#e4e669' },
{ name: 'question', color: '#d876e3' },
{ name: 'wontfix', color: '#ffffff' }
]
)
end
def verify_issues_import def verify_issues_import
issues = imported_project.issues issues = imported_project.issues
...@@ -62,6 +89,20 @@ module QA ...@@ -62,6 +89,20 @@ module QA
) )
end end
def verify_milestones_import
milestones = imported_project.milestones
expect(milestones.length).to eq(1)
expect(milestones.first).to include(title: 'v1.0', description: nil, state: 'active')
end
def verify_wikis_import
wikis = imported_project.wikis
expect(wikis.length).to eq(1)
expect(wikis.first).to include(title: 'Home', format: 'markdown')
end
def verify_merge_requests_import def verify_merge_requests_import
merge_requests = imported_project.merge_requests merge_requests = imported_project.merge_requests
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment