From ea1cc388537aad2dea253743811ce56f1d99c0b2 Mon Sep 17 00:00:00 2001 From: Vivek Singh Date: Tue, 5 Aug 2025 19:03:06 +0200 Subject: [PATCH] Update new `kubectl-mongodb` path in the precommit hook --- .githooks/pre-commit | 4 ++-- pkg/kubectl-mongodb/common/common_test.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 4f6af7b50..f53972553 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -117,9 +117,9 @@ function update_release_json() { } function regenerate_public_rbac_multi_cluster() { - if echo "$git_last_changed" | grep -q 'public/tools/multicluster'; then + if echo "$git_last_changed" | grep -q 'cmd/kubectl-mongodb'; then echo 'regenerating multicluster RBAC public example' - pushd public/tools/multicluster + pushd pkg/kubectl-mongodb/common/ EXPORT_RBAC_SAMPLES="true" go test ./... -run TestPrintingOutRolesServiceAccountsAndRoleBindings popd git add public/samples/multi-cluster-cli-gitops diff --git a/pkg/kubectl-mongodb/common/common_test.go b/pkg/kubectl-mongodb/common/common_test.go index fd176e220..31932530d 100644 --- a/pkg/kubectl-mongodb/common/common_test.go +++ b/pkg/kubectl-mongodb/common/common_test.go @@ -486,7 +486,7 @@ func TestPrintingOutRolesServiceAccountsAndRoleBindings(t *testing.T) { sb = marshalToYaml(t, sb, "Central Cluster, cluster-scoped resources", "rbac.authorization.k8s.io/v1", "ClusterRoleBinding", crb.Items) sb = marshalToYaml(t, sb, "Central Cluster, cluster-scoped resources", "v1", "ServiceAccount", sa.Items) - err = os.WriteFile("../../../../samples/multi-cluster-cli-gitops/resources/rbac/cluster_scoped_central_cluster.yaml", []byte(sb.String()), os.ModePerm) + err = os.WriteFile("../../../public/samples/multi-cluster-cli-gitops/resources/rbac/cluster_scoped_central_cluster.yaml", []byte(sb.String()), os.ModePerm) assert.NoError(t, err) } @@ -505,7 +505,7 @@ func TestPrintingOutRolesServiceAccountsAndRoleBindings(t *testing.T) { sb = marshalToYaml(t, sb, "Member Cluster, cluster-scoped resources", "rbac.authorization.k8s.io/v1", "ClusterRoleBinding", crb.Items) sb = marshalToYaml(t, sb, "Member Cluster, cluster-scoped resources", "v1", "ServiceAccount", sa.Items) - err = os.WriteFile("../../../../samples/multi-cluster-cli-gitops/resources/rbac/cluster_scoped_member_cluster.yaml", []byte(sb.String()), os.ModePerm) + err = os.WriteFile("../../../public/samples/multi-cluster-cli-gitops/resources/rbac/cluster_scoped_member_cluster.yaml", []byte(sb.String()), os.ModePerm) assert.NoError(t, err) } @@ -526,7 +526,7 @@ func TestPrintingOutRolesServiceAccountsAndRoleBindings(t *testing.T) { sb = marshalToYaml(t, sb, "Central Cluster, namespace-scoped resources", "rbac.authorization.k8s.io/v1", "RoleBinding", rb.Items) sb = marshalToYaml(t, sb, "Central Cluster, namespace-scoped resources", "v1", "ServiceAccount", sa.Items) - err = os.WriteFile("../../../../samples/multi-cluster-cli-gitops/resources/rbac/namespace_scoped_central_cluster.yaml", []byte(sb.String()), os.ModePerm) + err = os.WriteFile("../../../public/samples/multi-cluster-cli-gitops/resources/rbac/namespace_scoped_central_cluster.yaml", []byte(sb.String()), os.ModePerm) assert.NoError(t, err) } @@ -547,7 +547,7 @@ func TestPrintingOutRolesServiceAccountsAndRoleBindings(t *testing.T) { sb = marshalToYaml(t, sb, "Member Cluster, namespace-scoped resources", "rbac.authorization.k8s.io/v1", "RoleBinding", rb.Items) sb = marshalToYaml(t, sb, "Member Cluster, namespace-scoped resources", "v1", "ServiceAccount", sa.Items) - err = os.WriteFile("../../../../samples/multi-cluster-cli-gitops/resources/rbac/namespace_scoped_member_cluster.yaml", []byte(sb.String()), os.ModePerm) + err = os.WriteFile("../../../public/samples/multi-cluster-cli-gitops/resources/rbac/namespace_scoped_member_cluster.yaml", []byte(sb.String()), os.ModePerm) assert.NoError(t, err) } }