Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
ad9d2b97
Unverified
Commit
ad9d2b97
authored
10 months ago
by
RahulGautamSingh
Committed by
GitHub
10 months ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(versioning/pep440): log debug message if `newVersion` is excluded from range (#28950)
parent
5de7eee2
No related branches found
Branches containing commit
Tags
37.351.4
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/versioning/pep440/range.spec.ts
+32
-15
32 additions, 15 deletions
lib/modules/versioning/pep440/range.spec.ts
lib/modules/versioning/pep440/range.ts
+13
-0
13 additions, 0 deletions
lib/modules/versioning/pep440/range.ts
with
45 additions
and
15 deletions
lib/modules/versioning/pep440/range.spec.ts
+
32
−
15
View file @
ad9d2b97
import
{
checkRangeAndRemoveUnnecessaryRangeLimit
}
from
'
./range
'
;
import
{
logger
}
from
'
../../../logger
'
;
import
{
checkRangeAndRemoveUnnecessaryRangeLimit
,
getNewValue
}
from
'
./range
'
;
it
.
each
`
describe
(
'
modules/versioning/pep440/range
'
,
()
=>
{
rangeInput | newVersion | expected
it
.
each
`
${
'
==4.1.*,>=3.2.2
'
}
|
${
'
4.1.1
'
}
|
${
'
==4.1.*
'
}
rangeInput | newVersion | expected
${
'
==4.0.*,>=3.2.2
'
}
|
${
'
4.0.0
'
}
|
${
'
==4.0.*
'
}
${
'
==4.1.*,>=3.2.2
'
}
|
${
'
4.1.1
'
}
|
${
'
==4.1.*
'
}
${
'
==7.2.*
'
}
|
${
'
7.2.0
'
}
|
${
'
==7.2.*
'
}
${
'
==4.0.*,>=3.2.2
'
}
|
${
'
4.0.0
'
}
|
${
'
==4.0.*
'
}
`
(
${
'
==7.2.*
'
}
|
${
'
7.2.0
'
}
|
${
'
==7.2.*
'
}
'
checkRange("$rangeInput, "$newVersion"") === "$expected"
'
,
`
(
({
rangeInput
,
newVersion
,
expected
})
=>
{
'
checkRange("$rangeInput, "$newVersion"") === "$expected"
'
,
const
res
=
checkRangeAndRemoveUnnecessaryRangeLimit
(
({
rangeInput
,
newVersion
,
expected
})
=>
{
rangeInput
,
const
res
=
checkRangeAndRemoveUnnecessaryRangeLimit
(
newVersion
,
rangeInput
,
newVersion
,
);
expect
(
res
).
toEqual
(
expected
);
},
);
it
(
'
returns null without warning if new version is excluded from range
'
,
()
=>
{
const
res
=
getNewValue
({
currentValue
:
'
>=1.25.0,<2,!=1.32.0
'
,
rangeStrategy
:
'
auto
'
,
newVersion
:
'
1.32.0
'
,
currentVersion
:
'
1.25.0
'
,
});
expect
(
res
).
toBeNull
();
expect
(
logger
.
debug
).
toHaveBeenCalledWith
(
'
Cannot calculate new value as the newVersion:`1.32.0` is excluded from range: `>=1.25.0,<2,!=1.32.0`
'
,
);
);
expect
(
res
).
toEqual
(
expect
ed
);
expect
(
logger
.
warn
).
not
.
toHaveBeenCall
ed
(
);
}
,
}
);
);
}
);
This diff is collapsed.
Click to expand it.
lib/modules/versioning/pep440/range.ts
+
13
−
0
View file @
ad9d2b97
...
@@ -129,6 +129,18 @@ export function getNewValue({
...
@@ -129,6 +129,18 @@ export function getNewValue({
return
null
;
return
null
;
}
}
// return early if newVersion is excluded from range
if
(
ranges
.
some
(
(
range
)
=>
range
.
operator
===
'
!=
'
&&
range
.
version
===
newVersion
,
)
)
{
logger
.
debug
(
`Cannot calculate new value as the newVersion:
\`
${
newVersion
}
\`
is excluded from range:
\`
${
currentValue
}
\`
`
,
);
return
null
;
}
switch
(
rangeStrategy
)
{
switch
(
rangeStrategy
)
{
case
'
auto
'
:
case
'
auto
'
:
case
'
replace
'
:
case
'
replace
'
:
...
@@ -191,6 +203,7 @@ export function getNewValue({
...
@@ -191,6 +203,7 @@ export function getNewValue({
newVersion
,
newVersion
,
);
);
// istanbul ignore if
if
(
!
satisfies
(
newVersion
,
checkedResult
))
{
if
(
!
satisfies
(
newVersion
,
checkedResult
))
{
// we failed at creating the range
// we failed at creating the range
logger
.
warn
(
logger
.
warn
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment