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
f76e5313
Commit
f76e5313
authored
Aug 27, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
4f6c4758
4a55138e
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
120 additions
and
7 deletions
+120
-7
app/views/admin/application_settings/_ip_limits.html.haml
app/views/admin/application_settings/_ip_limits.html.haml
+4
-4
app/views/admin/application_settings/network.html.haml
app/views/admin/application_settings/network.html.haml
+1
-1
app/views/layouts/nav/sidebar/_admin.html.haml
app/views/layouts/nav/sidebar/_admin.html.haml
+1
-1
qa/README.md
qa/README.md
+11
-0
qa/qa.rb
qa/qa.rb
+2
-0
qa/qa/page/admin/menu.rb
qa/qa/page/admin/menu.rb
+8
-0
qa/qa/page/admin/settings/component/ip_limits.rb
qa/qa/page/admin/settings/component/ip_limits.rb
+30
-0
qa/qa/page/admin/settings/network.rb
qa/qa/page/admin/settings/network.rb
+23
-0
qa/qa/runtime/api/client.rb
qa/qa/runtime/api/client.rb
+20
-1
qa/qa/specs/features/api/1_manage/rate_limits_spec.rb
qa/qa/specs/features/api/1_manage/rate_limits_spec.rb
+20
-0
No files found.
app/views/admin/application_settings/_ip_limits.html.haml
View file @
f76e5313
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
%fieldset
%fieldset
.form-group
.form-group
.form-check
.form-check
=
f
.
check_box
:throttle_unauthenticated_enabled
,
class:
'form-check-input'
=
f
.
check_box
:throttle_unauthenticated_enabled
,
class:
'form-check-input'
,
data:
{
qa_selector:
'throttle_unauthenticated_checkbox'
}
=
f
.
label
:throttle_unauthenticated_enabled
,
class:
'form-check-label'
do
=
f
.
label
:throttle_unauthenticated_enabled
,
class:
'form-check-label'
do
Enable unauthenticated request rate limit
Enable unauthenticated request rate limit
%span
.form-text.text-muted
%span
.form-text.text-muted
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
f
.
number_field
:throttle_unauthenticated_period_in_seconds
,
class:
'form-control'
=
f
.
number_field
:throttle_unauthenticated_period_in_seconds
,
class:
'form-control'
.form-group
.form-group
.form-check
.form-check
=
f
.
check_box
:throttle_authenticated_api_enabled
,
class:
'form-check-input'
=
f
.
check_box
:throttle_authenticated_api_enabled
,
class:
'form-check-input'
,
data:
{
qa_selector:
'throttle_authenticated_api_checkbox'
}
=
f
.
label
:throttle_authenticated_api_enabled
,
class:
'form-check-label'
do
=
f
.
label
:throttle_authenticated_api_enabled
,
class:
'form-check-label'
do
Enable authenticated API request rate limit
Enable authenticated API request rate limit
%span
.form-text.text-muted
%span
.form-text.text-muted
...
@@ -30,7 +30,7 @@
...
@@ -30,7 +30,7 @@
=
f
.
number_field
:throttle_authenticated_api_period_in_seconds
,
class:
'form-control'
=
f
.
number_field
:throttle_authenticated_api_period_in_seconds
,
class:
'form-control'
.form-group
.form-group
.form-check
.form-check
=
f
.
check_box
:throttle_authenticated_web_enabled
,
class:
'form-check-input'
=
f
.
check_box
:throttle_authenticated_web_enabled
,
class:
'form-check-input'
,
data:
{
qa_selector:
'throttle_authenticated_web_checkbox'
}
=
f
.
label
:throttle_authenticated_web_enabled
,
class:
'form-check-label'
do
=
f
.
label
:throttle_authenticated_web_enabled
,
class:
'form-check-label'
do
Enable authenticated web request rate limit
Enable authenticated web request rate limit
%span
.form-text.text-muted
%span
.form-text.text-muted
...
@@ -42,4 +42,4 @@
...
@@ -42,4 +42,4 @@
=
f
.
label
:throttle_authenticated_web_period_in_seconds
,
'Rate limit period in seconds'
,
class:
'label-bold'
=
f
.
label
:throttle_authenticated_web_period_in_seconds
,
'Rate limit period in seconds'
,
class:
'label-bold'
=
f
.
number_field
:throttle_authenticated_web_period_in_seconds
,
class:
'form-control'
=
f
.
number_field
:throttle_authenticated_web_period_in_seconds
,
class:
'form-control'
=
f
.
submit
'Save changes'
,
class:
"btn btn-success"
=
f
.
submit
'Save changes'
,
class:
"btn btn-success"
,
data:
{
qa_selector:
'save_changes_button'
}
app/views/admin/application_settings/network.html.haml
View file @
f76e5313
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
.settings-content
.settings-content
=
render
'performance'
=
render
'performance'
%section
.settings.as-ip-limits.no-animate
#js-ip-limits-settings
{
class:
(
'expanded'
if
expanded_by_default?
)
}
%section
.settings.as-ip-limits.no-animate
#js-ip-limits-settings
{
class:
(
'expanded'
if
expanded_by_default?
)
,
data:
{
qa_selector:
'ip_limits_section'
}
}
.settings-header
.settings-header
%h4
%h4
=
_
(
'User and IP Rate Limits'
)
=
_
(
'User and IP Rate Limits'
)
...
...
app/views/layouts/nav/sidebar/_admin.html.haml
View file @
f76e5313
...
@@ -261,7 +261,7 @@
...
@@ -261,7 +261,7 @@
%span
%span
=
_
(
'Metrics and profiling'
)
=
_
(
'Metrics and profiling'
)
=
nav_link
(
path:
'application_settings#network'
)
do
=
nav_link
(
path:
'application_settings#network'
)
do
=
link_to
network_admin_application_settings_path
,
title:
_
(
'Network'
)
do
=
link_to
network_admin_application_settings_path
,
title:
_
(
'Network'
)
,
data:
{
qa_selector:
'admin_settings_network_item'
}
do
%span
%span
=
_
(
'Network'
)
=
_
(
'Network'
)
-
if
template_exists?
(
'admin/application_settings/geo'
)
-
if
template_exists?
(
'admin/application_settings/geo'
)
...
...
qa/README.md
View file @
f76e5313
...
@@ -105,6 +105,17 @@ If you need to authenticate as a different user, you can provide the
...
@@ -105,6 +105,17 @@ If you need to authenticate as a different user, you can provide the
GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bundle exec bin/qa Test::Instance::All https://gitlab.example.com
GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bundle exec bin/qa Test::Instance::All https://gitlab.example.com
```
```
Some QA tests require logging in as an admin user. By default, the QA
tests will use the the same
`root`
user seeded by the GDK.
If you need to authenticate with different admin credentials, you can
provide the
`GITLAB_ADMIN_USERNAME`
and
`GITLAB_ADMIN_PASSWORD`
environment variables:
```
GITLAB_ADMIN_USERNAME=admin GITLAB_ADMIN_PASSWORD=myadminpassword GITLAB_USERNAME=jsmith GITLAB_PASSWORD=password bundle exec bin/qa Test::Instance::All https://gitlab.example.com
```
If your user doesn't have permission to default sandbox group
If your user doesn't have permission to default sandbox group
`gitlab-qa-sandbox`
, you could also use another sandbox group by giving
`gitlab-qa-sandbox`
, you could also use another sandbox group by giving
`GITLAB_SANDBOX_NAME`
:
`GITLAB_SANDBOX_NAME`
:
...
...
qa/qa.rb
View file @
f76e5313
...
@@ -304,8 +304,10 @@ module QA
...
@@ -304,8 +304,10 @@ module QA
autoload
:Repository
,
'qa/page/admin/settings/repository'
autoload
:Repository
,
'qa/page/admin/settings/repository'
autoload
:General
,
'qa/page/admin/settings/general'
autoload
:General
,
'qa/page/admin/settings/general'
autoload
:MetricsAndProfiling
,
'qa/page/admin/settings/metrics_and_profiling'
autoload
:MetricsAndProfiling
,
'qa/page/admin/settings/metrics_and_profiling'
autoload
:Network
,
'qa/page/admin/settings/network'
module
Component
module
Component
autoload
:IpLimits
,
'qa/page/admin/settings/component/ip_limits'
autoload
:RepositoryStorage
,
'qa/page/admin/settings/component/repository_storage'
autoload
:RepositoryStorage
,
'qa/page/admin/settings/component/repository_storage'
autoload
:AccountAndLimit
,
'qa/page/admin/settings/component/account_and_limit'
autoload
:AccountAndLimit
,
'qa/page/admin/settings/component/account_and_limit'
autoload
:PerformanceBar
,
'qa/page/admin/settings/component/performance_bar'
autoload
:PerformanceBar
,
'qa/page/admin/settings/component/performance_bar'
...
...
qa/qa/page/admin/menu.rb
View file @
f76e5313
...
@@ -51,6 +51,14 @@ module QA
...
@@ -51,6 +51,14 @@ module QA
end
end
end
end
def
go_to_network_settings
hover_settings
do
within_submenu
do
click_element
:admin_settings_network_item
end
end
end
private
private
def
hover_settings
def
hover_settings
...
...
qa/qa/page/admin/settings/component/ip_limits.rb
0 → 100644
View file @
f76e5313
# frozen_string_literal: true
module
QA
module
Page
module
Admin
module
Settings
module
Component
class
IpLimits
<
Page
::
Base
view
'app/views/admin/application_settings/_ip_limits.html.haml'
do
element
:throttle_unauthenticated_checkbox
element
:throttle_authenticated_api_checkbox
element
:throttle_authenticated_web_checkbox
element
:save_changes_button
end
def
enable_throttles
check_element
:throttle_unauthenticated_checkbox
check_element
:throttle_authenticated_api_checkbox
check_element
:throttle_authenticated_web_checkbox
end
def
save_settings
click_element
:save_changes_button
end
end
end
end
end
end
end
qa/qa/page/admin/settings/network.rb
0 → 100644
View file @
f76e5313
# frozen_string_literal: true
module
QA
module
Page
module
Admin
module
Settings
class
Network
<
Page
::
Base
include
QA
::
Page
::
Settings
::
Common
view
'app/views/admin/application_settings/network.html.haml'
do
element
:ip_limits_section
end
def
expand_ip_limits
(
&
block
)
expand_section
(
:ip_limits_section
)
do
Component
::
IpLimits
.
perform
(
&
block
)
end
end
end
end
end
end
end
qa/qa/runtime/api/client.rb
View file @
f76e5313
...
@@ -8,11 +8,12 @@ module QA
...
@@ -8,11 +8,12 @@ module QA
class
Client
class
Client
attr_reader
:address
,
:user
attr_reader
:address
,
:user
def
initialize
(
address
=
:gitlab
,
personal_access_token:
nil
,
is_new_session:
true
,
user:
nil
)
def
initialize
(
address
=
:gitlab
,
personal_access_token:
nil
,
is_new_session:
true
,
user:
nil
,
ip_limits:
false
)
@address
=
address
@address
=
address
@personal_access_token
=
personal_access_token
@personal_access_token
=
personal_access_token
@is_new_session
=
is_new_session
@is_new_session
=
is_new_session
@user
=
user
@user
=
user
enable_ip_limits
if
ip_limits
end
end
def
personal_access_token
def
personal_access_token
...
@@ -26,6 +27,24 @@ module QA
...
@@ -26,6 +27,24 @@ module QA
private
private
def
enable_ip_limits
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
if
Page
::
Main
::
Menu
.
perform
{
|
p
|
p
.
has_personal_area?
(
wait:
0
)
}
Runtime
::
Browser
.
visit
(
@address
,
Page
::
Main
::
Login
)
Page
::
Main
::
Login
.
perform
(
&
:sign_in_using_admin_credentials
)
Page
::
Main
::
Menu
.
perform
(
&
:click_admin_area
)
Page
::
Admin
::
Menu
.
perform
(
&
:go_to_network_settings
)
Page
::
Admin
::
Settings
::
Network
.
perform
do
|
setting
|
setting
.
expand_ip_limits
do
|
page
|
page
.
enable_throttles
page
.
save_settings
end
end
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
end
def
create_personal_access_token
def
create_personal_access_token
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
if
@is_new_session
&&
Page
::
Main
::
Menu
.
perform
{
|
p
|
p
.
has_personal_area?
(
wait:
0
)
}
Page
::
Main
::
Menu
.
perform
(
&
:sign_out
)
if
@is_new_session
&&
Page
::
Main
::
Menu
.
perform
{
|
p
|
p
.
has_personal_area?
(
wait:
0
)
}
...
...
qa/qa/specs/features/api/1_manage/rate_limits_spec.rb
0 → 100644
View file @
f76e5313
# frozen_string_literal: true
module
QA
context
'Manage with IP rate limits'
,
:requires_admin
do
describe
'Users API'
do
before
(
:context
)
do
@api_client
=
Runtime
::
API
::
Client
.
new
(
:gitlab
,
ip_limits:
true
)
end
let
(
:request
)
{
Runtime
::
API
::
Request
.
new
(
@api_client
,
'/users'
)
}
it
'GET /users'
do
5
.
times
do
get
request
.
url
expect_status
(
200
)
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