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
d1c142ed
Commit
d1c142ed
authored
Mar 24, 2021
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix remote_mirrors usage data metric
parent
a9f4517a
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
4 deletions
+40
-4
app/models/project.rb
app/models/project.rb
+1
-1
changelogs/unreleased/325803-usage-ping-syntax-errors.yml
changelogs/unreleased/325803-usage-ping-syntax-errors.yml
+5
-0
spec/lib/gitlab/usage_data_spec.rb
spec/lib/gitlab/usage_data_spec.rb
+6
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+28
-0
No files found.
app/models/project.rb
View file @
d1c142ed
...
@@ -579,7 +579,7 @@ class Project < ApplicationRecord
...
@@ -579,7 +579,7 @@ class Project < ApplicationRecord
with_issues_available_for_user
(
user
).
or
(
with_merge_requests_available_for_user
(
user
))
with_issues_available_for_user
(
user
).
or
(
with_merge_requests_available_for_user
(
user
))
end
end
scope
:with_merge_requests_enabled
,
->
{
with_feature_enabled
(
:merge_requests
)
}
scope
:with_merge_requests_enabled
,
->
{
with_feature_enabled
(
:merge_requests
)
}
scope
:with_remote_mirrors
,
->
{
joins
(
:remote_mirrors
).
where
(
remote_mirrors:
{
enabled:
true
})
.
distinct
}
scope
:with_remote_mirrors
,
->
{
joins
(
:remote_mirrors
).
where
(
remote_mirrors:
{
enabled:
true
})
}
scope
:with_limit
,
->
(
maximum
)
{
limit
(
maximum
)
}
scope
:with_limit
,
->
(
maximum
)
{
limit
(
maximum
)
}
scope
:with_group_runners_enabled
,
->
do
scope
:with_group_runners_enabled
,
->
do
...
...
changelogs/unreleased/325803-usage-ping-syntax-errors.yml
0 → 100644
View file @
d1c142ed
---
title
:
Fix remote_mirrors usage ping metric
merge_request
:
57332
author
:
type
:
fixed
spec/lib/gitlab/usage_data_spec.rb
View file @
d1c142ed
...
@@ -167,7 +167,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -167,7 +167,10 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
create
(
:key
,
user:
user
)
create
(
:key
,
user:
user
)
create
(
:project
,
creator:
user
,
disable_overriding_approvers_per_merge_request:
true
)
create
(
:project
,
creator:
user
,
disable_overriding_approvers_per_merge_request:
true
)
create
(
:project
,
creator:
user
,
disable_overriding_approvers_per_merge_request:
false
)
create
(
:project
,
creator:
user
,
disable_overriding_approvers_per_merge_request:
false
)
create
(
:remote_mirror
,
project:
project
)
create
(
:remote_mirror
,
project:
project
,
enabled:
true
)
another_user
=
create
(
:user
)
another_project
=
create
(
:project
,
:repository
,
creator:
another_user
)
create
(
:remote_mirror
,
project:
another_project
,
enabled:
false
)
create
(
:snippet
,
author:
user
)
create
(
:snippet
,
author:
user
)
end
end
...
@@ -176,7 +179,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -176,7 +179,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
keys:
2
,
keys:
2
,
merge_requests:
2
,
merge_requests:
2
,
projects_with_disable_overriding_approvers_per_merge_request:
2
,
projects_with_disable_overriding_approvers_per_merge_request:
2
,
projects_without_disable_overriding_approvers_per_merge_request:
4
,
projects_without_disable_overriding_approvers_per_merge_request:
6
,
remote_mirrors:
2
,
remote_mirrors:
2
,
snippets:
2
snippets:
2
)
)
...
@@ -185,7 +188,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
...
@@ -185,7 +188,7 @@ RSpec.describe Gitlab::UsageData, :aggregate_failures do
keys:
1
,
keys:
1
,
merge_requests:
1
,
merge_requests:
1
,
projects_with_disable_overriding_approvers_per_merge_request:
1
,
projects_with_disable_overriding_approvers_per_merge_request:
1
,
projects_without_disable_overriding_approvers_per_merge_request:
2
,
projects_without_disable_overriding_approvers_per_merge_request:
3
,
remote_mirrors:
1
,
remote_mirrors:
1
,
snippets:
1
snippets:
1
)
)
...
...
spec/models/project_spec.rb
View file @
d1c142ed
...
@@ -1351,6 +1351,34 @@ RSpec.describe Project, factory_default: :keep do
...
@@ -1351,6 +1351,34 @@ RSpec.describe Project, factory_default: :keep do
end
end
end
end
describe
'.with_remote_mirrors'
do
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
subject
{
described_class
.
with_remote_mirrors
}
context
'when some remote mirrors are enabled for the project'
do
let!
(
:remote_mirror
)
{
create
(
:remote_mirror
,
project:
project
,
enabled:
true
)
}
it
"returns a project"
do
is_expected
.
to
eq
([
project
])
end
end
context
'when some remote mirrors exists but disabled for the project'
do
let!
(
:remote_mirror
)
{
create
(
:remote_mirror
,
project:
project
,
enabled:
false
)
}
it
"returns a project"
do
is_expected
.
to
be_empty
end
end
context
'when no remote mirrors exist for the project'
do
it
"returns an empty list"
do
is_expected
.
to
be_empty
end
end
end
describe
'.with_active_jira_services'
do
describe
'.with_active_jira_services'
do
it
'returns the correct project'
do
it
'returns the correct project'
do
active_jira_service
=
create
(
:jira_service
)
active_jira_service
=
create
(
:jira_service
)
...
...
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