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
f9690ffb
Commit
f9690ffb
authored
Jan 05, 2021
by
David Fernandez
Committed by
Markus Koller
Jan 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update the maven package finder
A group or project is now required for the finder to return packages
parent
f006fea3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
35 deletions
+34
-35
app/finders/packages/maven/package_finder.rb
app/finders/packages/maven/package_finder.rb
+1
-6
changelogs/unreleased/284686-fix-the-maven-packages-finder.yml
...elogs/unreleased/284686-fix-the-maven-packages-finder.yml
+5
-0
spec/finders/packages/maven/package_finder_spec.rb
spec/finders/packages/maven/package_finder_spec.rb
+28
-29
No files found.
app/finders/packages/maven/package_finder.rb
View file @
f9690ffb
...
@@ -27,7 +27,7 @@ module Packages
...
@@ -27,7 +27,7 @@ module Packages
elsif
group
elsif
group
packages_for_multiple_projects
packages_for_multiple_projects
else
else
packages
::
Packages
::
Package
.
none
end
end
end
end
...
@@ -35,11 +35,6 @@ module Packages
...
@@ -35,11 +35,6 @@ module Packages
base
.
only_maven_packages_with_path
(
path
)
base
.
only_maven_packages_with_path
(
path
)
end
end
# Produces a query that returns all packages.
def
packages
::
Packages
::
Package
.
all
end
# Produces a query that retrieves packages from a single project.
# Produces a query that retrieves packages from a single project.
def
packages_for_a_single_project
def
packages_for_a_single_project
project
.
packages
project
.
packages
...
...
changelogs/unreleased/284686-fix-the-maven-packages-finder.yml
0 → 100644
View file @
f9690ffb
---
title
:
Update the maven package finder
merge_request
:
50774
author
:
type
:
changed
spec/finders/packages/maven/package_finder_spec.rb
View file @
f9690ffb
...
@@ -2,55 +2,54 @@
...
@@ -2,55 +2,54 @@
require
'spec_helper'
require
'spec_helper'
RSpec
.
describe
::
Packages
::
Maven
::
PackageFinder
do
RSpec
.
describe
::
Packages
::
Maven
::
PackageFinder
do
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:package
)
{
create
(
:maven_package
,
project:
project
)
}
let_it_be
(
:package
)
{
create
(
:maven_package
,
project:
project
)
}
let
(
:param_path
)
{
nil
}
let
(
:param_project
)
{
nil
}
let
(
:param_group
)
{
nil
}
let
(
:finder
)
{
described_class
.
new
(
param_path
,
user
,
project:
param_project
,
group:
param_group
)
}
before
do
before
do
group
.
add_developer
(
user
)
group
.
add_developer
(
user
)
end
end
describe
'#execute!'
do
describe
'#execute!'
do
context
'within the project'
do
subject
{
finder
.
execute!
}
it
'returns a package'
do
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
,
project:
project
)
expect
(
finder
.
execute!
).
to
eq
(
package
)
end
it
'raises an error'
do
shared_examples
'handling valid and invalid paths'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
,
project:
project
)
context
'with a valid path'
do
let
(
:param_path
)
{
package
.
maven_metadatum
.
path
}
expect
{
finder
.
execute!
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
it
{
is_expected
.
to
eq
(
package
)
}
end
end
end
context
'across all projects'
do
context
'with an invalid path'
do
it
'returns a package'
do
let
(
:param_path
)
{
'com/example/my-app/1.0-SNAPSHOT'
}
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
)
expect
(
finder
.
execute!
).
to
eq
(
package
)
it
'raises an error'
do
expect
{
subject
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
end
it
'raises an error
'
do
context
'within the project
'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
)
let
(
:param_project
)
{
project
}
expect
{
finder
.
execute!
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
it_behaves_like
'handling valid and invalid paths'
end
end
end
context
'within a group'
do
context
'within a group'
do
it
'returns a package'
do
let
(
:param_group
)
{
group
}
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
,
group:
group
)
expect
(
finder
.
execute!
).
to
eq
(
package
)
it_behaves_like
'handling valid and invalid paths'
end
end
context
'across all projects'
do
it
'raises an error'
do
it
'raises an error'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
,
group:
group
)
expect
{
subject
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
expect
{
finder
.
execute!
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
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