From 53c0ad07d975198f57106b4fd79b6c0db1835179 Mon Sep 17 00:00:00 2001 From: jgs_bankdata Date: Mon, 2 Mar 2026 11:44:52 +0100 Subject: [PATCH] exclude _test.rego files from bundles --- internal/controller/styra/library_controller.go | 1 + internal/controller/styra/system_controller.go | 1 + test/integration/controller/system_controller_test.go | 3 +++ 3 files changed, 5 insertions(+) diff --git a/internal/controller/styra/library_controller.go b/internal/controller/styra/library_controller.go index 2d25e8ff..593f3f87 100644 --- a/internal/controller/styra/library_controller.go +++ b/internal/controller/styra/library_controller.go @@ -134,6 +134,7 @@ func (r *LibraryReconciler) reconcileLibrarySource( gitConfig := &ocp.GitConfig{ Repo: k8sLib.Spec.SourceControl.LibraryOrigin.URL, IncludedFiles: []string{"*.rego"}, + ExcludedFiles: []string{"*_test.rego"}, Path: ".", } if k8sLib.Spec.SourceControl.LibraryOrigin.Path != "" { diff --git a/internal/controller/styra/system_controller.go b/internal/controller/styra/system_controller.go index 71cd8a5a..e6634fda 100644 --- a/internal/controller/styra/system_controller.go +++ b/internal/controller/styra/system_controller.go @@ -851,6 +851,7 @@ func (r *SystemReconciler) reconcileSystemSource( gitConfig := &ocp.GitConfig{ Repo: system.Spec.SourceControl.Origin.URL, IncludedFiles: []string{"*.rego"}, + ExcludedFiles: []string{"*_test.rego"}, } if system.Spec.SourceControl.Origin.Commit != "" { gitConfig.Commit = system.Spec.SourceControl.Origin.Commit diff --git a/test/integration/controller/system_controller_test.go b/test/integration/controller/system_controller_test.go index 7313c567..da9e66fd 100644 --- a/test/integration/controller/system_controller_test.go +++ b/test/integration/controller/system_controller_test.go @@ -2600,6 +2600,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int Path: "policy", CredentialID: expectedGitCredentialsID, IncludedFiles: []string{"*.rego"}, + ExcludedFiles: []string{"*_test.rego"}, }, }).Return(&ocp.PutSourceResponse{ StatusCode: http.StatusOK, @@ -2658,6 +2659,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int Path: "policy", CredentialID: expectedGitCredentialsID, IncludedFiles: []string{"*.rego"}, + ExcludedFiles: []string{"*_test.rego"}, }, }).Return(&ocp.PutSourceResponse{ StatusCode: http.StatusOK, @@ -2710,6 +2712,7 @@ var _ = ginkgo.Describe("SystemReconciler.ReconcileOCPSystem", ginkgo.Label("int Path: "policy", CredentialID: expectedGitCredentialsID, IncludedFiles: []string{"*.rego"}, + ExcludedFiles: []string{"*_test.rego"}, }, }).Return(&ocp.PutSourceResponse{ StatusCode: http.StatusOK,