Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
b479f65a
Commit
b479f65a
authored
Sep 11, 2019
by
Mark Lapierre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add E2E test of pull mirroring
Using password auth. Also update the QA selectors used for push mirroring
parent
c12be945
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
73 additions
and
13 deletions
+73
-13
app/views/projects/mirrors/_mirror_repos.html.haml
app/views/projects/mirrors/_mirror_repos.html.haml
+3
-3
ee/app/views/projects/mirrors/_table_pull_row.html.haml
ee/app/views/projects/mirrors/_table_pull_row.html.haml
+4
-4
qa/qa/ee/page/project/settings/mirroring_repositories.rb
qa/qa/ee/page/project/settings/mirroring_repositories.rb
+7
-0
qa/qa/page/project/settings/mirroring_repositories.rb
qa/qa/page/project/settings/mirroring_repositories.rb
+5
-5
qa/qa/resource/repository/project_push.rb
qa/qa/resource/repository/project_push.rb
+3
-1
qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb
...r_ui/3_create/repository/pull_mirroring_over_http_spec.rb
+51
-0
No files found.
app/views/projects/mirrors/_mirror_repos.html.haml
View file @
b479f65a
...
...
@@ -49,12 +49,12 @@
=
render_if_exists
'projects/mirrors/table_pull_row'
-
@project
.
remote_mirrors
.
each_with_index
do
|
mirror
,
index
|
-
next
if
mirror
.
new_record?
%tr
.
qa-mirrored-repository-row.rspec-mirrored-repository-row
{
class:
(
'bg-secondary'
if
mirror
.
disabled?
)
}
%td
.qa-mirror-repository-url
=
mirror
.
safe_url
||
_
(
'Invalid URL'
)
%tr
.
rspec-mirrored-repository-row
{
class:
(
'bg-secondary'
if
mirror
.
disabled?
),
data:
{
qa_selector:
'mirrored_repository_row'
}
}
%td
{
data:
{
qa_selector:
'mirror_repository_url_cell'
}
}
=
mirror
.
safe_url
||
_
(
'Invalid URL'
)
%td
=
_
(
'Push'
)
%td
=
mirror
.
last_update_started_at
.
present?
?
time_ago_with_tooltip
(
mirror
.
last_update_started_at
)
:
_
(
'Never'
)
%td
.qa-mirror-last-update-at
=
mirror
.
last_update_at
.
present?
?
time_ago_with_tooltip
(
mirror
.
last_update_at
)
:
_
(
'Never'
)
%td
{
data:
{
qa_selector:
'mirror_last_update_at_cell'
}
}
=
mirror
.
last_update_at
.
present?
?
time_ago_with_tooltip
(
mirror
.
last_update_at
)
:
_
(
'Never'
)
%td
-
if
mirror
.
disabled?
=
render
'projects/mirrors/disabled_mirror_badge'
...
...
ee/app/views/projects/mirrors/_table_pull_row.html.haml
View file @
b479f65a
...
...
@@ -6,12 +6,12 @@
-
return
unless
import_state
%tr
%td
.mirror-url
=
@project
.
safe_import_url
%tr
{
data:
{
qa_selector:
'mirrored_repository_row'
}
}
%td
.mirror-url
{
data:
{
qa_selector:
'mirror_repository_url_cell'
}
}
=
@project
.
safe_import_url
%td
=
_
(
'Pull'
)
%td
=
import_state
.
last_update_started_at
.
present?
?
time_ago_with_tooltip
(
import_state
.
last_update_started_at
)
:
_
(
'Never'
)
%td
=
import_state
.
last_update_at
.
present?
?
time_ago_with_tooltip
(
import_state
.
last_update_at
)
:
_
(
'Never'
)
%td
{
data:
{
qa_selector:
'mirror_last_update_at_cell'
}
}
=
import_state
.
last_update_at
.
present?
?
time_ago_with_tooltip
(
import_state
.
last_update_at
)
:
_
(
'Never'
)
%td
-
if
import_state
&
.
last_error
.
present?
.badge.badge-danger
{
data:
{
toggle:
'tooltip'
,
html:
'true'
},
title:
html_escape
(
import_state
.
last_error
.
try
(
:strip
))
}=
_
(
'Error'
)
...
...
@@ -23,6 +23,6 @@
-
if
import_state
.
mirror_update_due?
||
import_state
.
updating_mirror?
%button
.btn.disabled
{
type:
'button'
,
data:
{
container:
'body'
,
toggle:
'tooltip'
},
title:
_
(
'Updating'
)
}=
icon
(
"refresh spin"
)
-
else
=
link_to
update_now_project_mirror_path
(
@project
),
method: :post
,
class:
'btn js-force-update-mirror'
,
data:
{
container:
'body'
,
toggle:
'tooltip'
},
title:
_
(
'Update now'
)
do
=
link_to
update_now_project_mirror_path
(
@project
),
method: :post
,
class:
'btn js-force-update-mirror'
,
data:
{
container:
'body'
,
toggle:
'tooltip'
,
qa_selector:
'update_now_button'
},
title:
_
(
'Update now'
)
do
=
icon
(
"refresh"
)
%button
.js-delete-mirror.js-delete-pull-mirror.btn.btn-danger
{
type:
'button'
,
data:
{
toggle:
'tooltip'
,
container:
'body'
},
title:
_
(
'Remove'
)
}=
icon
(
'trash-o'
)
qa/qa/ee/page/project/settings/mirroring_repositories.rb
View file @
b479f65a
...
...
@@ -11,6 +11,13 @@ module QA
view
'ee/app/views/projects/mirrors/_mirror_repos_form.html.haml'
do
element
:mirror_direction
end
view
'ee/app/views/projects/mirrors/_table_pull_row.html.haml'
do
element
:mirror_last_update_at_cell
element
:mirror_repository_url_cell
element
:mirrored_repository_row
element
:update_now_button
end
end
end
end
...
...
qa/qa/page/project/settings/mirroring_repositories.rb
View file @
b479f65a
...
...
@@ -13,8 +13,8 @@ module QA
view
'app/views/projects/mirrors/_mirror_repos.html.haml'
do
element
:mirror_repository_url_input
element
:mirror_repository_button
element
:mirror_repository_url
element
:mirror_last_update_at
element
:mirror_repository_url
_cell
element
:mirror_last_update_at
_cell
element
:mirrored_repository_row
end
...
...
@@ -64,21 +64,21 @@ module QA
wait
(
interval:
1
)
do
within_element_by_index
(
:mirrored_repository_row
,
row_index
)
do
last_update
=
find_element
(
:mirror_last_update_at
,
wait:
0
)
last_update
=
find_element
(
:mirror_last_update_at
_cell
,
wait:
0
)
last_update
.
has_text?
(
'just now'
)
||
last_update
.
has_text?
(
'seconds'
)
end
end
# Fail early if the page still shows that there has been no update
within_element_by_index
(
:mirrored_repository_row
,
row_index
)
do
find_element
(
:mirror_last_update_at
,
wait:
0
).
assert_no_text
(
'Never'
)
find_element
(
:mirror_last_update_at
_cell
,
wait:
0
).
assert_no_text
(
'Never'
)
end
end
private
def
find_repository_row_index
(
target_url
)
all_elements
(
:mirror_repository_url
).
index
do
|
url
|
all_elements
(
:mirror_repository_url
_cell
).
index
do
|
url
|
# The url might be a sanitized url but the target_url won't be so
# we compare just the paths instead of the full url
URI
.
parse
(
url
.
text
).
path
==
target_url
.
path
...
...
qa/qa/resource/repository/project_push.rb
View file @
b479f65a
...
...
@@ -4,11 +4,12 @@ module QA
module
Resource
module
Repository
class
ProjectPush
<
Repository
::
Push
attr_accessor
:project_name
attr_writer
:wait_for_push
attribute
:project
do
Project
.
fabricate!
do
|
resource
|
resource
.
name
=
'project-with-code'
resource
.
name
=
project_name
resource
.
description
=
'Project with repository'
end
end
...
...
@@ -19,6 +20,7 @@ module QA
@commit_message
=
"This is a test commit"
@branch_name
=
'master'
@new_branch
=
true
@project_name
=
'project-with-code'
@wait_for_push
=
true
end
...
...
qa/qa/specs/features/ee/browser_ui/3_create/repository/pull_mirroring_over_http_spec.rb
0 → 100644
View file @
b479f65a
# frozen_string_literal: true
module
QA
context
'Create'
do
describe
'Pull mirror a repository over HTTP'
do
it
'configures and syncs a (pull) mirrored repository with password auth'
do
Runtime
::
Browser
.
visit
(
:gitlab
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_credentials
)
source
=
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
project_push
|
project_push
.
project_name
=
'pull-mirror-source-project'
project_push
.
file_name
=
'README.md'
project_push
.
file_content
=
'# This is a pull mirroring test project'
project_push
.
commit_message
=
'Add README.md'
end
source_project_uri
=
source
.
project
.
repository_http_location
.
uri
source_project_uri
.
user
=
Runtime
::
User
.
username
target_project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'pull-mirror-target-project'
end
target_project
.
visit!
Page
::
Project
::
Menu
.
perform
(
&
:go_to_repository_settings
)
Page
::
Project
::
Settings
::
Repository
.
perform
do
|
settings
|
settings
.
expand_mirroring_repositories
do
|
mirror_settings
|
# Configure the target project to pull from the source project
mirror_settings
.
repository_url
=
source_project_uri
mirror_settings
.
mirror_direction
=
:pull
mirror_settings
.
authentication_method
=
:password
mirror_settings
.
password
=
Runtime
::
User
.
password
mirror_settings
.
mirror_repository
mirror_settings
.
update
source_project_uri
end
end
# Check that the target project has the commit from the source
target_project
.
visit!
expect
(
page
).
to
have_content
(
"README.md"
)
expect
(
page
).
to
have_content
(
"This is a pull mirroring test project"
)
expect
(
page
).
to
have_content
(
"Mirrored from
#{
masked_url
(
source_project_uri
)
}
"
)
end
def
masked_url
(
url
)
url
.
password
=
'*****'
url
.
user
=
'*****'
url
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment