Skip to content

Commit 55a42ca

Browse files
Add benchmark
1 parent a1512c6 commit 55a42ca

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// SPDX-FileCopyrightText: 2023 SAP SE or an SAP affiliate company
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
package keppel
5+
6+
import (
7+
"bytes"
8+
"io"
9+
"os"
10+
"testing"
11+
"time"
12+
13+
"github.com/sapcc/keppel/internal/trivy"
14+
15+
"github.com/sapcc/go-bits/must"
16+
)
17+
18+
func BenchmarkEnrichReport(b *testing.B) {
19+
for b.Loop() {
20+
policies := SecurityScanPolicySet{}
21+
content := must.Return(os.ReadFile("../tasks/fixtures/trivy/report-vulnerable-with-fixes.json"))
22+
report := trivy.ReportPayload{
23+
Format: "json",
24+
Contents: io.NopCloser(bytes.NewReader(content)),
25+
}
26+
_ = must.Return(policies.EnrichReport(&report, time.Now()))
27+
}
28+
}

0 commit comments

Comments
 (0)