Skip to content
代码片段 群组 项目
未验证 提交 e279a1f8 编辑于 作者: Olivier Gonzalez's avatar Olivier Gonzalez
浏览文件

Return ids of created vulnerabilities with SBOM scanning

Changelog: changed
EE: true
上级 71840599
No related branches found
No related tags found
无相关合并请求
......@@ -55,6 +55,8 @@ def create_vulnerabilities(findings)
else
log_error(response.payload[:error], project_ids_with_upsert: project_ids_with_upsert)
end
response.payload[:vulnerability_ids] || []
end
def log_success(project_ids_with_upsert:)
......
......@@ -152,14 +152,19 @@
let(:finding_map) { create(:vs_finding_map, pipeline: pipeline) }
it 'creates new vulnerabilities' do
it 'creates new vulnerabilities and returns their id' do
expect(Gitlab::AppJsonLogger).to receive(:debug)
.with(
message: "Successfully created vulnerabilities on advisory ingestion",
project_ids_with_upsert: [pipeline.project.id])
.once
expect { create_vulnerabilities }.to change { Vulnerability.count }.by(1)
expect do
created_ids = create_vulnerabilities
expect(created_ids).to be_an(Array)
.and all(be_a(Integer))
.and be_present
end.to change { Vulnerability.count }.by(1)
end
context 'when exception is raised' do
......@@ -175,7 +180,10 @@
project_ids_with_upsert: [])
.once
expect { create_vulnerabilities }.not_to change { Vulnerability.count }
expect do
created_ids = create_vulnerabilities
expect(created_ids).to eq([])
end.not_to change { Vulnerability.count }
end
end
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册