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
f6b97b6c
Commit
f6b97b6c
authored
Aug 11, 2021
by
Oghenerukevwe Kofi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Place calls to composer cache worker behind feature flag
parent
2749cc72
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
10 deletions
+37
-10
app/services/packages/composer/create_package_service.rb
app/services/packages/composer/create_package_service.rb
+3
-1
config/feature_flags/development/remove_composer_v1_cache_code.yml
...ature_flags/development/remove_composer_v1_cache_code.yml
+8
-0
spec/services/packages/composer/create_package_service_spec.rb
...services/packages/composer/create_package_service_spec.rb
+26
-9
No files found.
app/services/packages/composer/create_package_service.rb
View file @
f6b97b6c
...
...
@@ -17,7 +17,9 @@ module Packages
})
end
unless
Feature
.
enabled?
(
:remove_composer_v1_cache_code
,
project
)
::
Packages
::
Composer
::
CacheUpdateWorker
.
perform_async
(
created_package
.
project_id
,
created_package
.
name
,
nil
)
end
created_package
end
...
...
config/feature_flags/development/remove_composer_v1_cache_code.yml
0 → 100644
View file @
f6b97b6c
---
name
:
remove_composer_v1_cache_code
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/67843
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/338264
milestone
:
'
14.2'
type
:
development
group
:
group::package
default_enabled
:
false
spec/services/packages/composer/create_package_service_spec.rb
View file @
f6b97b6c
...
...
@@ -6,7 +6,7 @@ RSpec.describe Packages::Composer::CreatePackageService do
let_it_be
(
:package_name
)
{
'composer-package-name'
}
let_it_be
(
:json
)
{
{
name:
package_name
}.
to_json
}
let_it_be
(
:project
)
{
create
(
:project
,
:custom_repo
,
files:
{
'composer.json'
=>
json
}
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:custom_repo
,
files:
{
'composer.json'
=>
json
})
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:params
)
do
...
...
@@ -24,13 +24,30 @@ RSpec.describe Packages::Composer::CreatePackageService do
let
(
:created_package
)
{
Packages
::
Package
.
composer
.
last
}
shared_examples
'using the cache update worker'
do
context
'with remove_composer_v1_cache_code enabled'
do
it
'does not enqueue a cache update job'
do
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
not_to
receive
(
:perform_async
)
subject
end
end
context
'with remove_composer_v1_cache_code disabled'
do
it
'enqueues a cache update job'
do
stub_feature_flags
(
remove_composer_v1_cache_code:
true
)
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
not_to
receive
(
:perform_async
)
subject
end
end
end
context
'without an existing package'
do
context
'with a branch'
do
let
(
:branch
)
{
project
.
repository
.
find_branch
(
'master'
)
}
it
'creates the package'
do
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
package_name
,
nil
)
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
composer
.
count
}.
by
(
1
)
.
and
change
{
Packages
::
Composer
::
Metadatum
.
count
}.
by
(
1
)
...
...
@@ -47,6 +64,7 @@ RSpec.describe Packages::Composer::CreatePackageService do
it_behaves_like
'assigns build to package'
it_behaves_like
'assigns status to package'
it_behaves_like
'using the cache update worker'
end
context
'with a tag'
do
...
...
@@ -57,8 +75,6 @@ RSpec.describe Packages::Composer::CreatePackageService do
end
it
'creates the package'
do
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
package_name
,
nil
)
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
composer
.
count
}.
by
(
1
)
.
and
change
{
Packages
::
Composer
::
Metadatum
.
count
}.
by
(
1
)
...
...
@@ -73,6 +89,7 @@ RSpec.describe Packages::Composer::CreatePackageService do
it_behaves_like
'assigns build to package'
it_behaves_like
'assigns status to package'
it_behaves_like
'using the cache update worker'
end
end
...
...
@@ -85,12 +102,12 @@ RSpec.describe Packages::Composer::CreatePackageService do
end
it
'does not create a new package'
do
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
package_name
,
nil
)
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
composer
.
count
}.
by
(
0
)
.
and
change
{
Packages
::
Composer
::
Metadatum
.
count
}.
by
(
0
)
end
it_behaves_like
'using the cache update worker'
end
context
'belonging to another project'
do
...
...
@@ -108,12 +125,12 @@ RSpec.describe Packages::Composer::CreatePackageService do
let!
(
:other_package
)
{
create
(
:package
,
name:
package_name
,
version:
'dev-master'
,
project:
other_project
)
}
it
'creates the package'
do
expect
(
::
Packages
::
Composer
::
CacheUpdateWorker
).
to
receive
(
:perform_async
).
with
(
project
.
id
,
package_name
,
nil
)
expect
{
subject
}
.
to
change
{
Packages
::
Package
.
composer
.
count
}.
by
(
1
)
.
and
change
{
Packages
::
Composer
::
Metadatum
.
count
}.
by
(
1
)
end
it_behaves_like
'using the cache update worker'
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