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
24e0354b
Commit
24e0354b
authored
Sep 27, 2020
by
mo khan
Committed by
James Fargher
Sep 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check if HEAD report is nil
parent
7e096de7
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
ee/changelogs/unreleased/208723-diff-nil-license-report.yml
ee/changelogs/unreleased/208723-diff-nil-license-report.yml
+5
-0
ee/spec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
...pec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
+8
-13
No files found.
ee/changelogs/unreleased/208723-diff-nil-license-report.yml
0 → 100644
View file @
24e0354b
---
title
:
Check if HEAD report is nil when diffing license_scanning reports
merge_request
:
43210
author
:
type
:
fixed
ee/spec/lib/gitlab/ci/reports/license_scanning/report_spec.rb
View file @
24e0354b
...
@@ -169,14 +169,15 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
...
@@ -169,14 +169,15 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
end
end
describe
'#diff_with'
do
describe
'#diff_with'
do
subject
{
base_report
.
diff_with
(
head_report
)
}
def
names_from
(
licenses
)
def
names_from
(
licenses
)
licenses
.
map
(
&
:name
)
licenses
.
map
(
&
:name
)
end
end
context
'when the other report is not available'
do
context
'when the other report is not available'
do
subject
{
base_report
.
diff_with
(
nil
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:head_report
)
{
nil
}
before
do
before
do
base_report
base_report
...
@@ -184,17 +185,17 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
...
@@ -184,17 +185,17 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
.
add_dependency
(
'rails'
)
.
add_dependency
(
'rails'
)
end
end
specify
{
expect
(
names_from
(
subject
[
:removed
])).
to
contain_exactly
(
'MIT License'
)
}
specify
do
specify
{
expect
(
subject
[
:added
]).
to
be_empty
}
expect
(
names_from
(
subject
[
:removed
])).
to
contain_exactly
(
'MIT License'
)
specify
{
expect
(
subject
[
:unchanged
]).
to
be_empty
}
expect
(
subject
[
:added
]).
to
be_empty
expect
(
subject
[
:unchanged
]).
to
be_empty
end
end
end
context
'when diffing two v1 reports'
do
context
'when diffing two v1 reports'
do
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
subject
{
base_report
.
diff_with
(
head_report
)
}
before
do
before
do
base_report
.
add_license
(
id:
nil
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
...
@@ -214,8 +215,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
...
@@ -214,8 +215,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
subject
{
base_report
.
diff_with
(
head_report
)
}
before
do
before
do
base_report
.
add_license
(
id:
'MIT'
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'MIT'
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'BSD-3-Clause'
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'BSD-3-Clause'
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
...
@@ -235,8 +234,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
...
@@ -235,8 +234,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
subject
{
base_report
.
diff_with
(
head_report
)
}
before
do
before
do
base_report
.
add_license
(
id:
nil
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
nil
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
...
@@ -256,8 +253,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
...
@@ -256,8 +253,6 @@ RSpec.describe Gitlab::Ci::Reports::LicenseScanning::Report do
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:base_report
)
{
build
(
:license_scan_report
,
:version_2
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
let
(
:head_report
)
{
build
(
:license_scan_report
,
:version_1
)
}
subject
{
base_report
.
diff_with
(
head_report
)
}
before
do
before
do
base_report
.
add_license
(
id:
'MIT'
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'MIT'
,
name:
'MIT'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'BSD-3-Clause'
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
base_report
.
add_license
(
id:
'BSD-3-Clause'
,
name:
'BSD'
).
add_dependency
(
'Library1'
)
...
...
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