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
229f0cc0
Commit
229f0cc0
authored
Jun 10, 2020
by
Sanad Liaquat (Personal)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ip restriced ssh access spec
Add user to the project and use user's access token to create ssh key
parent
d1362100
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
17 deletions
+24
-17
qa/qa/specs/features/ee/browser_ui/1_manage/group/restrict_by_ip_address_spec.rb
.../browser_ui/1_manage/group/restrict_by_ip_address_spec.rb
+24
-17
No files found.
qa/qa/specs/features/ee/browser_ui/1_manage/group/restrict_by_ip_address_spec.rb
View file @
229f0cc0
...
...
@@ -18,6 +18,16 @@ module QA
group
.
sandbox
=
@sandbox_group
end
@project
=
Resource
::
Project
.
fabricate_via_api!
do
|
project
|
project
.
group
=
@group
project
.
name
=
'project-in-ip-restricted-group'
project
.
initialize_with_readme
=
true
end
@project
.
add_member
(
@user
)
@api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
@user
)
enable_plan_on_group
(
@sandbox_group
.
path
,
"Gold"
)
if
Runtime
::
Env
.
dot_com?
end
...
...
@@ -52,10 +62,6 @@ module QA
end
context
'via the API'
do
before
do
@api_client
||=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
@user
)
end
it
'denies access'
do
request
=
create_request
(
"/groups/
#{
@sandbox_group
.
id
}
"
)
response
=
get
request
.
url
...
...
@@ -70,11 +76,14 @@ module QA
# Note: If you run this test against GDK make sure you've enabled sshd
# See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md
context
'via the SSH'
do
let
(
:key
)
{
Resource
::
SSHKey
.
fabricate_via_api!
}
let
(
:key
)
do
Resource
::
SSHKey
.
fabricate_via_api!
do
|
ssh_key
|
ssh_key
.
api_client
=
@api_client
ssh_key
.
title
=
"ssh key for allowed ip restricted access
#{
Time
.
now
.
to_f
}
"
end
end
it
'denies access'
do
Flow
::
Login
.
sign_in
expect
{
push_a_project_with_ssh_key
(
key
)
}.
to
raise_error
(
QA
::
Git
::
Repository
::
RepositoryCommandError
,
/fatal: Could not read from remote repository/
)
end
end
...
...
@@ -96,10 +105,6 @@ module QA
end
context
'via the API'
do
before
do
@api_client
||=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
user:
@user
)
end
it
'allows access'
do
request
=
create_request
(
"/groups/
#{
@sandbox_group
.
id
}
"
)
response
=
get
request
.
url
...
...
@@ -114,11 +119,14 @@ module QA
# Note: If you run this test against GDK make sure you've enabled sshd
# See: https://gitlab.com/gitlab-org/gitlab-qa/blob/master/docs/run_qa_against_gdk.md
context
'via the SSH'
do
let
(
:key
)
{
Resource
::
SSHKey
.
fabricate_via_api!
}
let
(
:key
)
do
Resource
::
SSHKey
.
fabricate_via_api!
do
|
ssh_key
|
ssh_key
.
api_client
=
@api_client
ssh_key
.
title
=
"ssh key for allowed ip restricted access
#{
Time
.
now
.
to_f
}
"
end
end
it
'allows access'
do
Flow
::
Login
.
sign_in
expect
{
push_a_project_with_ssh_key
(
key
)
}.
not_to
raise_error
end
end
...
...
@@ -128,11 +136,10 @@ module QA
def
push_a_project_with_ssh_key
(
key
)
Resource
::
Repository
::
ProjectPush
.
fabricate!
do
|
push
|
push
.
project
=
@project
push
.
group
=
@sandbox_group
push
.
ssh_key
=
key
push
.
file_name
=
'README.md'
push
.
file_content
=
'# Test Use SSH Key'
push
.
commit_message
=
'Add README.md'
push
.
branch_name
=
"new_branch_
#{
SecureRandom
.
hex
(
8
)
}
"
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