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
c4c513b8
Commit
c4c513b8
authored
Jun 10, 2021
by
alinamihaila
Committed by
Thong Kuah
Jun 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug where disabling usage ping via gitlab.rb did not work
Add alias method usage_ping_enabled? Changelog: fixed
parent
f1b36261
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
0 deletions
+88
-0
app/models/application_setting_implementation.rb
app/models/application_setting_implementation.rb
+1
-0
spec/models/application_setting_spec.rb
spec/models/application_setting_spec.rb
+79
-0
spec/services/submit_usage_ping_service_spec.rb
spec/services/submit_usage_ping_service_spec.rb
+8
-0
No files found.
app/models/application_setting_implementation.rb
View file @
c4c513b8
...
@@ -374,6 +374,7 @@ module ApplicationSettingImplementation
...
@@ -374,6 +374,7 @@ module ApplicationSettingImplementation
def
usage_ping_enabled
def
usage_ping_enabled
usage_ping_can_be_configured?
&&
super
usage_ping_can_be_configured?
&&
super
end
end
alias_method
:usage_ping_enabled?
,
:usage_ping_enabled
def
allowed_key_types
def
allowed_key_types
SUPPORTED_KEY_TYPES
.
select
do
|
type
|
SUPPORTED_KEY_TYPES
.
select
do
|
type
|
...
...
spec/models/application_setting_spec.rb
View file @
c4c513b8
...
@@ -363,6 +363,85 @@ RSpec.describe ApplicationSetting do
...
@@ -363,6 +363,85 @@ RSpec.describe ApplicationSetting do
.
is_less_than
(
65536
)
.
is_less_than
(
65536
)
end
end
describe
'usage_ping_enabled setting'
do
shared_examples
'usage ping enabled'
do
it
do
expect
(
setting
.
usage_ping_enabled
).
to
eq
(
true
)
expect
(
setting
.
usage_ping_enabled?
).
to
eq
(
true
)
end
end
shared_examples
'usage ping disabled'
do
it
do
expect
(
setting
.
usage_ping_enabled
).
to
eq
(
false
)
expect
(
setting
.
usage_ping_enabled?
).
to
eq
(
false
)
end
end
context
'when setting is in database'
do
context
'with usage_ping_enabled disabled'
do
before
do
setting
.
update!
(
usage_ping_enabled:
false
)
end
it_behaves_like
'usage ping disabled'
end
context
'with usage_ping_enabled enabled'
do
before
do
setting
.
update!
(
usage_ping_enabled:
true
)
end
it_behaves_like
'usage ping enabled'
end
end
context
'when setting is in GitLab config'
do
context
'with usage_ping_enabled disabled'
do
before
do
allow
(
Settings
.
gitlab
).
to
receive
(
:usage_ping_enabled
).
and_return
(
false
)
end
it_behaves_like
'usage ping disabled'
end
context
'with usage_ping_enabled enabled'
do
before
do
allow
(
Settings
.
gitlab
).
to
receive
(
:usage_ping_enabled
).
and_return
(
true
)
end
it_behaves_like
'usage ping enabled'
end
end
context
'when setting in database false and setting in GitLab config true'
do
before
do
setting
.
update!
(
usage_ping_enabled:
false
)
allow
(
Settings
.
gitlab
).
to
receive
(
:usage_ping_enabled
).
and_return
(
true
)
end
it_behaves_like
'usage ping disabled'
end
context
'when setting database true and setting in GitLab config false'
do
before
do
setting
.
update!
(
usage_ping_enabled:
true
)
allow
(
Settings
.
gitlab
).
to
receive
(
:usage_ping_enabled
).
and_return
(
false
)
end
it_behaves_like
'usage ping disabled'
end
context
'when setting database true and setting in GitLab config true'
do
before
do
setting
.
update!
(
usage_ping_enabled:
true
)
allow
(
Settings
.
gitlab
).
to
receive
(
:usage_ping_enabled
).
and_return
(
true
)
end
it_behaves_like
'usage ping enabled'
end
end
context
'key restrictions'
do
context
'key restrictions'
do
it
'supports all key types'
do
it
'supports all key types'
do
expect
(
described_class
::
SUPPORTED_KEY_TYPES
).
to
contain_exactly
(
:rsa
,
:dsa
,
:ecdsa
,
:ed25519
)
expect
(
described_class
::
SUPPORTED_KEY_TYPES
).
to
contain_exactly
(
:rsa
,
:dsa
,
:ecdsa
,
:ed25519
)
...
...
spec/services/submit_usage_ping_service_spec.rb
View file @
c4c513b8
...
@@ -90,6 +90,14 @@ RSpec.describe SubmitUsagePingService do
...
@@ -90,6 +90,14 @@ RSpec.describe SubmitUsagePingService do
it_behaves_like
'does not run'
it_behaves_like
'does not run'
end
end
context
'when usage ping is disabled from GitLab config file'
do
before
do
stub_config_setting
(
usage_ping_enabled:
false
)
end
it_behaves_like
'does not run'
end
context
'when usage ping is enabled'
do
context
'when usage ping is enabled'
do
before
do
before
do
stub_usage_data_connections
stub_usage_data_connections
...
...
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