Skip to content

Commit cbc0a1b

Browse files
committed
ci: add GitLab CI/CD pipeline for image builds
1 parent 9be2114 commit cbc0a1b

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

pkg/metrics/filesystem_integration_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ import (
1111
"github.com/aquasecurity/trivy-operator/pkg/operator/etc"
1212
"github.com/go-logr/logr"
1313
"github.com/prometheus/client_golang/prometheus"
14-
"github.com/prometheus/client_golang/prometheus/testutil"
1514
)
1615

1716
// TestMetricsCollectionFromFilesystem tests end-to-end metrics collection from filesystem storage
1817
func TestMetricsCollectionFromFilesystem(t *testing.T) {
1918
// Create temporary directory structure
2019
tmpDir := t.TempDir()
21-
vulnDir := filepath.Join(tmpDir, "vulnerability_report")
22-
configDir := filepath.Join(tmpDir, "configaudit_report")
20+
vulnDir := filepath.Join(tmpDir, "vulnerability_reports")
21+
configDir := filepath.Join(tmpDir, "config_audit_reports")
2322

2423
if err := os.MkdirAll(vulnDir, 0755); err != nil {
2524
t.Fatalf("failed to create vuln dir: %v", err)

pkg/metrics/storage_reader_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ func TestFilesystemStorageReader_AllReportTypes(t *testing.T) {
364364
ObjectMeta: metav1.ObjectMeta{
365365
Name: "test-rbac",
366366
Namespace: "default",
367+
Labels: map[string]string{
368+
"trivy-operator.resource.kind": "Role",
369+
"trivy-operator.resource.name": "test-role",
370+
},
367371
},
368372
}
369373

@@ -384,6 +388,10 @@ func TestFilesystemStorageReader_AllReportTypes(t *testing.T) {
384388
ObjectMeta: metav1.ObjectMeta{
385389
Name: "test-infra",
386390
Namespace: "default",
391+
Labels: map[string]string{
392+
"trivy-operator.resource.kind": "Pod",
393+
"trivy-operator.resource.name": "test-pod",
394+
},
387395
},
388396
}
389397

@@ -403,6 +411,10 @@ func TestFilesystemStorageReader_AllReportTypes(t *testing.T) {
403411
crar := v1alpha1.ClusterRbacAssessmentReport{
404412
ObjectMeta: metav1.ObjectMeta{
405413
Name: "test-cluster-rbac",
414+
Labels: map[string]string{
415+
"trivy-operator.resource.kind": "ClusterRole",
416+
"trivy-operator.resource.name": "test-cluster-role",
417+
},
406418
},
407419
}
408420

0 commit comments

Comments
 (0)