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
elsif
group
packages_for_multiple_projects
else
packages
::
Packages
::
Package
.
none
end
end
...
...
@@ -35,11 +35,6 @@ module Packages
base
.
only_maven_packages_with_path
(
path
)
end
# Produces a query that returns all packages.
def
packages
::
Packages
::
Package
.
all
end
# Produces a query that retrieves packages from a single project.
def
packages_for_a_single_project
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 @@
require
'spec_helper'
RSpec
.
describe
::
Packages
::
Maven
::
PackageFinder
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
)
}
let
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
let
(
:package
)
{
create
(
:maven_package
,
project:
project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
let_it_be
(
:project
)
{
create
(
:project
,
namespace:
group
)
}
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
group
.
add_developer
(
user
)
end
describe
'#execute!'
do
context
'within the project'
do
it
'returns a package'
do
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
,
project:
project
)
expect
(
finder
.
execute!
).
to
eq
(
package
)
end
subject
{
finder
.
execute!
}
it
'raises an error'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
,
project:
project
)
shared_examples
'handling valid and invalid paths'
do
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
context
'across all projects'
do
it
'returns a package'
do
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
)
context
'with an invalid path'
do
let
(
:param_path
)
{
'com/example/my-app/1.0-SNAPSHOT'
}
expect
(
finder
.
execute!
).
to
eq
(
package
)
it
'raises an error'
do
expect
{
subject
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
end
end
it
'raises an error
'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
)
context
'within the project
'
do
let
(
:param_project
)
{
project
}
expect
{
finder
.
execute!
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
end
it_behaves_like
'handling valid and invalid paths'
end
context
'within a group'
do
it
'returns a package'
do
finder
=
described_class
.
new
(
package
.
maven_metadatum
.
path
,
user
,
group:
group
)
let
(
:param_group
)
{
group
}
expect
(
finder
.
execute!
).
to
eq
(
package
)
end
it_behaves_like
'handling valid and invalid paths'
end
context
'across all projects'
do
it
'raises an error'
do
finder
=
described_class
.
new
(
'com/example/my-app/1.0-SNAPSHOT'
,
user
,
group:
group
)
expect
{
finder
.
execute!
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
expect
{
subject
}.
to
raise_error
(
ActiveRecord
::
RecordNotFound
)
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