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,