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
5a015efb
Commit
5a015efb
authored
Jun 11, 2020
by
Jennifer Louie
Committed by
Mark Lapierre
Jun 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use API for SSH key check in Geo specs
parent
aa82f724
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
64 deletions
+43
-64
qa/qa/resource/ssh_key.rb
qa/qa/resource/ssh_key.rb
+16
-1
qa/qa/specs/features/ee/browser_ui/geo/ssh_push_spec.rb
qa/qa/specs/features/ee/browser_ui/geo/ssh_push_spec.rb
+7
-20
qa/qa/specs/features/ee/browser_ui/geo/ssh_push_to_secondary_spec.rb
.../features/ee/browser_ui/geo/ssh_push_to_secondary_spec.rb
+9
-21
qa/qa/specs/features/ee/browser_ui/geo/wiki_ssh_push_spec.rb
qa/qa/specs/features/ee/browser_ui/geo/wiki_ssh_push_spec.rb
+4
-12
qa/qa/specs/features/ee/browser_ui/geo/wiki_ssh_push_to_secondary_spec.rb
...ures/ee/browser_ui/geo/wiki_ssh_push_to_secondary_spec.rb
+7
-10
No files found.
qa/qa/resource/ssh_key.rb
View file @
5a015efb
...
...
@@ -6,6 +6,7 @@ module QA
extend
Forwardable
attr_reader
:title
attr_accessor
:expires_at
attribute
:id
...
...
@@ -53,13 +54,27 @@ module QA
def
api_post_body
{
title:
title
,
key:
public_key
key:
public_key
,
expires_at:
expires_at
}
end
def
api_delete_path
"/user/keys/
#{
id
}
"
end
def
replicated?
api_client
=
Runtime
::
API
::
Client
.
new
(
:geo_secondary
)
QA
::
Runtime
::
Logger
.
debug
(
'Checking for SSH key replication'
)
Support
::
Retrier
.
retry_until
(
max_duration:
QA
::
EE
::
Runtime
::
Geo
.
max_db_replication_time
,
sleep_interval:
3
)
do
response
=
get
Runtime
::
API
::
Request
.
new
(
api_client
,
api_get_path
).
url
response
.
code
==
QA
::
Support
::
Api
::
HTTP_STATUS_OK
&&
parse_body
(
response
)[
:title
].
include?
(
title
)
end
end
end
end
end
qa/qa/specs/features/ee/browser_ui/geo/ssh_push_spec.rb
View file @
5a015efb
...
...
@@ -7,7 +7,7 @@ module QA
context
'regular git commit'
do
it
"is replicated to the secondary"
do
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo SSH
#{
Time
.
now
.
to_f
}
"
file_content
=
'This is a Geo project! Commit from primary.'
project
=
nil
key
=
nil
...
...
@@ -16,12 +16,13 @@ module QA
# Create a new SSH key for the user
key
=
Resource
::
SSHKey
.
fabricate_via_api!
do
|
resource
|
resource
.
title
=
key_title
resource
.
expires_at
=
Date
.
today
+
2
end
# Create a new Project
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'geo-project'
project
.
description
=
'Geo test project for
ssh
push'
project
.
description
=
'Geo test project for
SSH
push'
end
# Perform a git push over SSH directly to the primary
...
...
@@ -42,20 +43,13 @@ module QA
end
end
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
expect
(
banner
).
to
have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
act
{
click_settings_link
}
Page
::
Profile
::
Menu
.
act
{
click_ssh_keys
}
expect
(
page
).
to
have_content
(
key
.
title
)
expect
(
page
).
to
have_content
(
key
.
md5_fingerprint
)
# Ensure project has replicated
Page
::
Main
::
Menu
.
perform
{
|
menu
|
menu
.
go_to_projects
}
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
...
...
@@ -76,7 +70,7 @@ module QA
context
'git-lfs commit'
do
it
"is replicated to the secondary"
do
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo SSH LFS
#{
Time
.
now
.
to_f
}
"
file_content
=
'The rendered file could not be displayed because it is stored in LFS.'
project
=
nil
key
=
nil
...
...
@@ -90,7 +84,7 @@ module QA
# Create a new Project
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'geo-project'
project
.
description
=
'Geo test project for
ssh lfs
push'
project
.
description
=
'Geo test project for
SSH LFS
push'
end
# Perform a git push over SSH directly to the primary
...
...
@@ -115,20 +109,13 @@ module QA
end
end
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
expect
(
banner
).
to
have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
act
{
click_settings_link
}
Page
::
Profile
::
Menu
.
act
{
click_ssh_keys
}
expect
(
page
).
to
have_content
(
key
.
title
)
expect
(
page
).
to
have_content
(
key
.
md5_fingerprint
)
# Ensure project has replicated
Page
::
Main
::
Menu
.
perform
{
|
menu
|
menu
.
go_to_projects
}
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
...
...
qa/qa/specs/features/ee/browser_ui/geo/ssh_push_to_secondary_spec.rb
View file @
5a015efb
...
...
@@ -9,7 +9,7 @@ module QA
context
'regular git commit'
do
it
'is proxied to the primary and ultimately replicated to the secondary'
do
file_name
=
'README.md'
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo SSH to 2nd
#{
Time
.
now
.
to_f
}
"
project
=
nil
key
=
nil
...
...
@@ -17,12 +17,13 @@ module QA
# Create a new SSH key for the user
key
=
Resource
::
SSHKey
.
fabricate_via_api!
do
|
resource
|
resource
.
title
=
key_title
resource
.
expires_at
=
Date
.
today
+
2
end
# Create a new Project
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
'geo-project'
project
.
description
=
'Geo test project for
ssh
push to 2nd'
project
.
description
=
'Geo test project for
SSH
push to 2nd'
end
# Perform a git push over SSH directly to the primary
...
...
@@ -39,7 +40,7 @@ module QA
project
.
visit!
end
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
...
...
@@ -47,14 +48,7 @@ module QA
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
perform
(
&
:click_settings_link
)
Page
::
Profile
::
Menu
.
perform
do
|
menu
|
menu
.
click_ssh_keys
menu
.
wait_for_key_to_replicate
(
key_title
)
end
expect
(
page
).
to
have_content
(
key
.
title
)
expect
(
page
).
to
have_content
(
key
.
md5_fingerprint
)
expect
(
key
).
to
be_replicated
# Ensure project has replicated
Page
::
Main
::
Menu
.
perform
(
&
:go_to_projects
)
...
...
@@ -97,7 +91,7 @@ module QA
context
'git-lfs commit'
do
it
'is proxied to the primary and ultimately replicated to the secondary'
do
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo SSH LFS to 2nd
#{
Time
.
now
.
to_f
}
"
file_name_primary
=
'README.md'
file_name_secondary
=
'README_MORE.md'
project
=
nil
...
...
@@ -107,6 +101,7 @@ module QA
# Create a new SSH key for the user
key
=
Resource
::
SSHKey
.
fabricate_via_api!
do
|
resource
|
resource
.
title
=
key_title
resource
.
expires_at
=
Date
.
today
+
2
end
# Create a new Project
...
...
@@ -129,7 +124,7 @@ module QA
end
end
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
...
...
@@ -137,14 +132,7 @@ module QA
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
perform
(
&
:click_settings_link
)
Page
::
Profile
::
Menu
.
perform
do
|
menu
|
menu
.
click_ssh_keys
menu
.
wait_for_key_to_replicate
(
key_title
)
end
expect
(
page
).
to
have_content
(
key
.
title
)
expect
(
page
).
to
have_content
(
key
.
md5_fingerprint
)
expect
(
key
).
to
be_replicated
# Ensure project has replicated
Page
::
Main
::
Menu
.
perform
(
&
:go_to_projects
)
...
...
qa/qa/specs/features/ee/browser_ui/geo/wiki_ssh_push_spec.rb
View file @
5a015efb
...
...
@@ -9,7 +9,7 @@ module QA
wiki_content
=
'This tests replication of wikis via SSH'
push_content
=
'This is from the Geo wiki push via SSH!'
project_name
=
"geo-wiki-project-
#{
SecureRandom
.
hex
(
8
)
}
"
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo wiki SSH
#{
Time
.
now
.
to_f
}
"
project
=
nil
key
=
nil
...
...
@@ -17,12 +17,13 @@ module QA
# Create a new SSH key
key
=
Resource
::
SSHKey
.
fabricate_via_api!
do
|
resource
|
resource
.
title
=
key_title
resource
.
expires_at
=
Date
.
today
+
2
end
# Create a new project and wiki
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
project_name
project
.
description
=
'Geo project for wiki
ssh
spec'
project
.
description
=
'Geo project for wiki
SSH
spec'
end
wiki
=
Resource
::
Wiki
::
ProjectPage
.
fabricate_via_api!
do
|
wiki
|
...
...
@@ -47,22 +48,13 @@ module QA
validate_content
(
push_content
)
end
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
expect
(
banner
).
to
have_secondary_read_only_banner
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
perform
(
&
:click_settings_link
)
Page
::
Profile
::
Menu
.
perform
(
&
:click_ssh_keys
)
Page
::
Profile
::
SSHKeys
.
perform
do
|
ssh
|
expect
(
ssh
.
keys_list
).
to
have_content
(
key
.
title
)
expect
(
ssh
.
keys_list
).
to
have_content
(
key
.
md5_fingerprint
)
end
Page
::
Main
::
Menu
.
perform
(
&
:go_to_projects
)
Page
::
Dashboard
::
Projects
.
perform
do
|
dashboard
|
...
...
qa/qa/specs/features/ee/browser_ui/geo/wiki_ssh_push_to_secondary_spec.rb
View file @
5a015efb
...
...
@@ -7,7 +7,7 @@ module QA
wiki_content
=
'This tests replication of wikis via SSH to secondary'
push_content
=
'This is from the Geo wiki push via SSH to secondary!'
project_name
=
"geo-wiki-project-
#{
SecureRandom
.
hex
(
8
)
}
"
key_title
=
"
key for ssh tests
#{
Time
.
now
.
to_f
}
"
key_title
=
"
Geo wiki SSH to 2nd
#{
Time
.
now
.
to_f
}
"
wiki
=
nil
key
=
nil
...
...
@@ -16,12 +16,13 @@ module QA
# Create a new SSH key
key
=
Resource
::
SSHKey
.
fabricate_via_api!
do
|
resource
|
resource
.
title
=
key_title
resource
.
expires_at
=
Date
.
today
+
2
end
# Create a new project and wiki
project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
name
=
project_name
project
.
description
=
'Geo project for wiki
ssh
spec'
project
.
description
=
'Geo project for wiki
SSH
spec'
end
wiki
=
Resource
::
Wiki
::
ProjectPage
.
fabricate_via_api!
do
|
wiki
|
...
...
@@ -36,7 +37,7 @@ module QA
end
it
'proxies wiki commit to primary node and ultmately replicates to secondary node'
do
QA
::
Runtime
::
Logger
.
debug
(
'
Visiting the secondary geo node
'
)
QA
::
Runtime
::
Logger
.
debug
(
'
*****Visiting the secondary geo node*****
'
)
QA
::
Flow
::
Login
.
while_signed_in
(
address: :geo_secondary
)
do
EE
::
Page
::
Main
::
Banner
.
perform
do
|
banner
|
...
...
@@ -44,13 +45,7 @@ module QA
end
# Ensure the SSH key has replicated
Page
::
Main
::
Menu
.
perform
(
&
:click_settings_link
)
Page
::
Profile
::
Menu
.
perform
(
&
:click_ssh_keys
)
Page
::
Profile
::
SSHKeys
.
perform
do
|
ssh
|
expect
(
ssh
.
keys_list
).
to
have_content
(
key
.
title
)
expect
(
ssh
.
keys_list
).
to
have_content
(
key
.
md5_fingerprint
)
end
expect
(
key
).
to
be_replicated
Page
::
Main
::
Menu
.
perform
(
&
:go_to_projects
)
...
...
@@ -99,6 +94,8 @@ module QA
end
end
private
def
validate_content
(
content
)
Page
::
Project
::
Wiki
::
Show
.
perform
do
|
show
|
expect
(
show
).
to
have_content
(
content
)
...
...
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