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
2ab3318d
Commit
2ab3318d
authored
Mar 24, 2021
by
Anastasia McDonald
Committed by
Mark Lapierre
Mar 24, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
E2E to test Group Wiki repository storage move
See
https://gitlab.com/gitlab-org/gitlab/-/issues/300539
parent
211cccbe
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
111 additions
and
6 deletions
+111
-6
qa/qa/ee/page/group/wiki/show.rb
qa/qa/ee/page/group/wiki/show.rb
+1
-0
qa/qa/resource/group.rb
qa/qa/resource/group.rb
+13
-0
qa/qa/resource/wiki/group_page.rb
qa/qa/resource/wiki/group_page.rb
+22
-0
qa/qa/runtime/api/repository_storage_moves.rb
qa/qa/runtime/api/repository_storage_moves.rb
+2
-0
qa/qa/service/praefect_manager.rb
qa/qa/service/praefect_manager.rb
+15
-4
qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb
...s/api/3_create/gitaly/changing_repository_storage_spec.rb
+1
-1
qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb
.../3_create/snippet/snippet_repository_storage_move_spec.rb
+1
-1
qa/qa/specs/features/ee/api/3_create/.gitkeep
qa/qa/specs/features/ee/api/3_create/.gitkeep
+0
-0
qa/qa/specs/features/ee/api/3_create/wiki/group_wiki_repository_storage_move_spec.rb
.../3_create/wiki/group_wiki_repository_storage_move_spec.rb
+56
-0
No files found.
qa/qa/ee/page/group/wiki/show.rb
View file @
2ab3318d
...
...
@@ -9,6 +9,7 @@ module QA
include
QA
::
Page
::
Component
::
Wiki
include
QA
::
Page
::
Component
::
WikiSidebar
include
QA
::
Page
::
Component
::
LazyLoader
include
QA
::
Page
::
Component
::
LegacyClonePanel
end
end
end
...
...
qa/qa/resource/group.rb
View file @
2ab3318d
...
...
@@ -89,6 +89,19 @@ module QA
raise
ResourceUpdateFailedError
,
"Could not update require_two_factor_authentication to
#{
value
}
. Request returned (
#{
response
.
code
}
): `
#{
response
}
`."
end
end
def
change_repository_storage
(
new_storage
)
post_body
=
{
destination_storage_name:
new_storage
}
response
=
post
Runtime
::
API
::
Request
.
new
(
api_client
,
"/groups/
#{
id
}
/repository_storage_moves"
).
url
,
post_body
unless
response
.
code
.
between?
(
200
,
300
)
raise
ResourceUpdateFailedError
,
"Could not change repository storage to
#{
new_storage
}
. Request returned (
#{
response
.
code
}
): `
#{
response
}
`."
end
wait_until
(
sleep_interval:
1
)
{
Runtime
::
API
::
RepositoryStorageMoves
.
has_status?
(
self
,
'finished'
,
new_storage
)
}
rescue
Support
::
Repeater
::
RepeaterConditionExceededError
raise
Runtime
::
API
::
RepositoryStorageMoves
::
RepositoryStorageMovesError
,
'Timed out while waiting for the group repository storage move to finish'
end
end
end
end
qa/qa/resource/wiki/group_page.rb
View file @
2ab3318d
...
...
@@ -16,6 +16,14 @@ module QA
end
end
attribute
:repository_http_location
do
EE
::
Page
::
Group
::
Wiki
::
Show
.
perform
do
|
show
|
show
.
click_clone_repository
show
.
choose_repository_clone_http
show
.
repository_location
end
end
def
initialize
@title
=
'Home'
@content
=
'This wiki page is created via API'
...
...
@@ -42,6 +50,20 @@ module QA
title:
title
}
end
def
api_list_wiki_pages_path
"/groups/
#{
group
.
id
}
/wikis"
end
def
has_page_content?
(
page_title
,
page_content
)
response
=
get
Runtime
::
API
::
Request
.
new
(
api_client
,
"
#{
api_list_wiki_pages_path
}
?with_content=1"
).
url
unless
response
.
code
==
HTTP_STATUS_OK
raise
ResourceQueryError
,
"Could not get a list of all wiki pages for a given group. Request returned (
#{
response
.
code
}
): `
#{
response
}
`."
end
parse_body
(
response
).
any?
{
|
page
|
page
[
:title
]
==
page_title
&&
page
[
:content
]
==
page_content
}
end
end
end
end
...
...
qa/qa/runtime/api/repository_storage_moves.rb
View file @
2ab3318d
...
...
@@ -33,6 +33,8 @@ module QA
def
resource_equals?
(
resource
,
move
)
if
resource
.
class
.
name
.
include?
(
'Snippet'
)
move
[
:snippet
][
:id
]
==
resource
.
id
elsif
resource
.
class
.
name
.
include?
(
'Group'
)
move
[
:group
][
:id
]
==
resource
.
id
else
move
[
:project
][
:path_with_namespace
]
==
resource
.
path_with_namespace
end
...
...
qa/qa/service/praefect_manager.rb
View file @
2ab3318d
...
...
@@ -180,10 +180,10 @@ module QA
wait_for_reliable_connection
end
def
verify_storage_move
(
source_storage
,
destination_storage
)
def
verify_storage_move
(
source_storage
,
destination_storage
,
repo_type: :project
)
return
if
QA
::
Runtime
::
Env
.
dot_com?
repo_path
=
verify_storage_move_from_gitaly
(
source_storage
[
:name
])
repo_path
=
verify_storage_move_from_gitaly
(
source_storage
[
:name
]
,
repo_type:
repo_type
)
destination_storage
[
:type
]
==
:praefect
?
verify_storage_move_to_praefect
(
repo_path
,
destination_storage
[
:name
])
:
verify_storage_move_to_gitaly
(
repo_path
,
destination_storage
[
:name
])
end
...
...
@@ -404,13 +404,13 @@ module QA
Service
::
Shellout
.
sql_to_docker_exec_cmd
(
sql
,
'postgres'
,
'SQL_PASSWORD'
,
'praefect_production'
,
'postgres.test'
,
@postgres
)
end
def
verify_storage_move_from_gitaly
(
storage
)
def
verify_storage_move_from_gitaly
(
storage
,
repo_type: :project
)
wait_until_shell_command
(
"docker exec
#{
@gitlab
}
bash -c 'tail -n 50 /var/log/gitlab/gitaly/current'"
)
do
|
line
|
log
=
JSON
.
parse
(
line
)
if
(
log
[
'grpc.method'
]
==
'RenameRepository'
||
log
[
'grpc.method'
]
==
'RemoveRepository'
)
&&
log
[
'grpc.request.repoStorage'
]
==
storage
&&
!
log
[
'grpc.request.repoPath'
].
include?
(
'wiki'
)
repo_type
(
log
[
'grpc.request.repoPath'
])
==
repo_type
break
log
[
'grpc.request.repoPath'
]
end
rescue
JSON
::
ParserError
...
...
@@ -444,6 +444,17 @@ module QA
yield
JSON
.
parse
(
line
)
end
end
def
repo_type
(
repo_path
)
return
:snippet
if
repo_path
.
start_with?
(
'@snippets'
)
return
:design
if
repo_path
.
end_with?
(
'.design.git'
)
if
repo_path
.
end_with?
(
'.wiki.git'
)
return
repo_path
.
start_with?
(
'@groups'
)
?
:group_wiki
:
:wiki
end
:project
end
end
end
end
qa/qa/specs/features/api/3_create/gitaly/changing_repository_storage_spec.rb
View file @
2ab3318d
...
...
@@ -9,7 +9,7 @@ module QA
it
'confirms a `finished` status after moving project repository storage'
do
expect
(
project
).
to
have_file
(
'README.md'
)
expect
{
project
.
change_repository_storage
(
destination_storage
[
:name
])
}.
not_to
raise_error
expect
{
praefect_manager
.
verify_storage_move
(
source_storage
,
destination_storage
)
}.
not_to
raise_error
expect
{
praefect_manager
.
verify_storage_move
(
source_storage
,
destination_storage
,
repo_type: :project
)
}.
not_to
raise_error
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
project
...
...
qa/qa/specs/features/api/3_create/snippet/snippet_repository_storage_move_spec.rb
View file @
2ab3318d
...
...
@@ -24,7 +24,7 @@ module QA
it
'moves snippet repository from one Gitaly storage to another'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1700'
do
expect
(
snippet
).
to
have_file
(
'original_file'
)
expect
{
snippet
.
change_repository_storage
(
destination_storage
[
:name
])
}.
not_to
raise_error
expect
{
praefect_manager
.
verify_storage_move
(
source_storage
,
destination_storage
)
}.
not_to
raise_error
expect
{
praefect_manager
.
verify_storage_move
(
source_storage
,
destination_storage
,
repo_type: :snippet
)
}.
not_to
raise_error
# verifies you can push commits to the moved snippet
Resource
::
Repository
::
Push
.
fabricate!
do
|
push
|
...
...
qa/qa/specs/features/ee/api/3_create/.gitkeep
deleted
100644 → 0
View file @
211cccbe
qa/qa/specs/features/ee/api/3_create/wiki/group_wiki_repository_storage_move_spec.rb
0 → 100644
View file @
2ab3318d
# frozen_string_literal: true
module
QA
RSpec
.
describe
'Create'
do
describe
'Group Wiki repository storage'
,
:requires_admin
,
:orchestrated
,
:repository_storage
do
let
(
:source_storage
)
{
{
type: :gitaly
,
name:
'default'
}
}
let
(
:destination_storage
)
{
{
type: :gitaly
,
name:
QA
::
Runtime
::
Env
.
additional_repository_storage
}
}
let
(
:original_page_title
)
{
'Wiki page to move storage of'
}
let
(
:original_page_content
)
{
'Original wiki content'
}
let
(
:group
)
do
Resource
::
Group
.
fabricate_via_api!
do
|
group
|
group
.
path
=
"group-to-move-storage-of-
#{
SecureRandom
.
hex
(
8
)
}
"
group
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
end
end
let
(
:wiki
)
do
Resource
::
Wiki
::
GroupPage
.
fabricate_via_api!
do
|
wiki
|
wiki
.
title
=
original_page_title
wiki
.
content
=
original_page_content
wiki
.
group
=
group
wiki
.
api_client
=
Runtime
::
API
::
Client
.
as_admin
end
end
praefect_manager
=
Service
::
PraefectManager
.
new
before
do
praefect_manager
.
gitlab
=
'gitlab'
end
it
'moves group Wiki repository from one Gitaly storage to another'
,
testcase:
'https://gitlab.com/gitlab-org/quality/testcases/-/issues/1733'
do
expect
(
wiki
).
to
have_page_content
(
original_page_title
,
original_page_content
)
expect
{
group
.
change_repository_storage
(
destination_storage
[
:name
])
}.
not_to
raise_error
expect
{
praefect_manager
.
verify_storage_move
(
source_storage
,
destination_storage
,
repo_type: :group_wiki
)
}.
not_to
raise_error
# verifies you can push commits to the moved Wiki
Resource
::
Repository
::
WikiPush
.
fabricate!
do
|
push
|
push
.
wiki
=
wiki
push
.
repository_http_uri
=
"
#{
wiki
.
group
.
web_url
.
sub
(
'/groups/'
,
'/'
)
}
.wiki.git"
push
.
file_name
=
'new-page.md'
push
.
file_content
=
'new page content'
push
.
commit_message
=
'Adding a new Wiki page'
push
.
new_branch
=
false
end
aggregate_failures
do
expect
(
wiki
).
to
have_page_content
(
original_page_title
,
original_page_content
)
expect
(
wiki
).
to
have_page_content
(
'new page'
,
'new page content'
)
end
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