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
d4e7fb04
Commit
d4e7fb04
authored
Jan 24, 2022
by
Maxime Orefice
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ci_decompose_for_namespace_monthly_usage_query feature flag
Changelog: other
parent
18d6c174
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
45 deletions
+16
-45
config/feature_flags/development/ci_decompose_for_namespace_monthly_usage_query.yml
...opment/ci_decompose_for_namespace_monthly_usage_query.yml
+0
-8
ee/app/models/ci/minutes/project_monthly_usage.rb
ee/app/models/ci/minutes/project_monthly_usage.rb
+4
-11
ee/spec/models/ci/minutes/project_monthly_usage_spec.rb
ee/spec/models/ci/minutes/project_monthly_usage_spec.rb
+12
-26
No files found.
config/feature_flags/development/ci_decompose_for_namespace_monthly_usage_query.yml
deleted
100644 → 0
View file @
18d6c174
---
name
:
ci_decompose_for_namespace_monthly_usage_query
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/77952
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/350146
milestone
:
'
14.7'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
ee/app/models/ci/minutes/project_monthly_usage.rb
View file @
d4e7fb04
...
@@ -12,17 +12,10 @@ module Ci
...
@@ -12,17 +12,10 @@ module Ci
scope
:current_month
,
->
{
where
(
date:
beginning_of_month
)
}
scope
:current_month
,
->
{
where
(
date:
beginning_of_month
)
}
scope
:for_namespace_monthly_usage
,
->
(
namespace_monthly_usage
)
do
scope
:for_namespace_monthly_usage
,
->
(
namespace_monthly_usage
)
do
if
Feature
.
enabled?
(
:ci_decompose_for_namespace_monthly_usage_query
,
namespace_monthly_usage
.
namespace
,
default_enabled: :yaml
)
where
(
where
(
date:
namespace_monthly_usage
.
date
,
date:
namespace_monthly_usage
.
date
,
project:
Ci
::
ProjectMirror
.
by_namespace_id
(
namespace_monthly_usage
.
namespace_id
).
select
(
:project_id
)
project:
Ci
::
ProjectMirror
.
by_namespace_id
(
namespace_monthly_usage
.
namespace_id
).
select
(
:project_id
)
)
)
else
where
(
date:
namespace_monthly_usage
.
date
,
project:
namespace_monthly_usage
.
namespace
.
projects
).
allow_cross_joins_across_databases
(
url:
'https://gitlab.com/gitlab-org/gitlab/-/issues/343301'
)
end
end
end
def
self
.
beginning_of_month
(
time
=
Time
.
current
)
def
self
.
beginning_of_month
(
time
=
Time
.
current
)
...
...
ee/spec/models/ci/minutes/project_monthly_usage_spec.rb
View file @
d4e7fb04
...
@@ -77,38 +77,24 @@ RSpec.describe Ci::Minutes::ProjectMonthlyUsage do
...
@@ -77,38 +77,24 @@ RSpec.describe Ci::Minutes::ProjectMonthlyUsage do
end
end
describe
'.for_namespace_monthly_usage'
do
describe
'.for_namespace_monthly_usage'
do
shared_examples
'namespace monthly usage'
do
let
(
:date_for_usage
)
{
Date
.
new
(
2021
,
5
,
1
)
}
let
(
:date_for_usage
)
{
Date
.
new
(
2021
,
5
,
1
)
}
let
(
:namespace_usage
)
{
create
(
:ci_namespace_monthly_usage
,
namespace:
project
.
namespace
,
amount_used:
50
,
date:
date_for_usage
)
}
let
(
:namespace_usage
)
{
create
(
:ci_namespace_monthly_usage
,
namespace:
project
.
namespace
,
amount_used:
50
,
date:
date_for_usage
)
}
it
"fetches project monthly usages matching the namespace monthly usage's date and namespace"
do
it
"fetches project monthly usages matching the namespace monthly usage's date and namespace"
do
date_not_for_usage
=
date_for_usage
+
1
.
month
date_not_for_usage
=
date_for_usage
+
1
.
month
matching_project_usage
=
create
(
:ci_project_monthly_usage
,
project:
project
,
amount_used:
50
,
date:
date_for_usage
)
matching_project_usage
=
create
(
:ci_project_monthly_usage
,
project:
project
,
amount_used:
50
,
date:
date_for_usage
)
create
(
:ci_project_monthly_usage
,
project:
project
,
amount_used:
50
,
date:
date_not_for_usage
)
create
(
:ci_project_monthly_usage
,
project:
project
,
amount_used:
50
,
date:
date_not_for_usage
)
create
(
:ci_project_monthly_usage
,
project:
create
(
:project
),
amount_used:
50
,
date:
date_for_usage
)
create
(
:ci_project_monthly_usage
,
project:
create
(
:project
),
amount_used:
50
,
date:
date_for_usage
)
project_usages
=
described_class
.
for_namespace_monthly_usage
(
namespace_usage
)
project_usages
=
described_class
.
for_namespace_monthly_usage
(
namespace_usage
)
expect
(
project_usages
).
to
contain_exactly
(
matching_project_usage
)
expect
(
project_usages
).
to
contain_exactly
(
matching_project_usage
)
end
it
'does not join across databases'
do
with_cross_joins_prevented
do
described_class
.
for_namespace_monthly_usage
(
namespace_usage
)
end
end
end
end
context
'when ci_decompose_for_namespace_monthly_usage_query is enabled'
do
it
'does not join across databases'
do
it_behaves_like
'namespace monthly usage'
with_cross_joins_prevented
do
end
described_class
.
for_namespace_monthly_usage
(
namespace_usage
)
context
'when ci_decompose_for_namespace_monthly_usage_query is disabled'
do
before
do
stub_feature_flags
(
ci_decompose_for_namespace_monthly_usage_query:
false
)
end
end
it_behaves_like
'namespace monthly usage'
end
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