From b39cf7d5de3311d88c9beef08cdeece22491a6b0 Mon Sep 17 00:00:00 2001 From: Tanvir Tatla Date: Tue, 16 Jan 2024 09:27:45 -0800 Subject: [PATCH] fix file descriptor --- pkg/clustermanager/cluster_creator_test.go | 2 +- pkg/kubeconfig/kubeconfig_writer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/clustermanager/cluster_creator_test.go b/pkg/clustermanager/cluster_creator_test.go index 9c049926a5ea9..8a16344584da2 100644 --- a/pkg/clustermanager/cluster_creator_test.go +++ b/pkg/clustermanager/cluster_creator_test.go @@ -65,7 +65,7 @@ func TestClusterCreatorCreateSync(t *testing.T) { clusCreator, tt := newClusterCreator(t) clusterName := tt.spec.Cluster.Name path := "testpath" - writer := os.NewFile(uintptr(*pointer.Uint(1)), "test") + writer := os.NewFile(uintptr(*pointer.Uint(0)), "test") tt.expectApplierRun(tt.ctx, tt.spec, *tt.mgmtCluster) tt.expectWriteKubeconfig(tt.ctx, clusterName, tt.mgmtCluster.KubeconfigFile, writer) tt.expectFileCreate(clusterName, path, writer) diff --git a/pkg/kubeconfig/kubeconfig_writer_test.go b/pkg/kubeconfig/kubeconfig_writer_test.go index 67a700d2f4137..8c7f727a3328b 100644 --- a/pkg/kubeconfig/kubeconfig_writer_test.go +++ b/pkg/kubeconfig/kubeconfig_writer_test.go @@ -86,7 +86,7 @@ func TestWriteKubeconfig(t *testing.T) { } for _, tc := range tests { writer, tt := newKubeconfigWriter(t) - buf := bytes.NewBuffer([]byte{}) + buf := bytes.NewBuffer(make([]byte, tc.secret.Size())) tt.buildClient(tc.buildErr, tc.secret) err := writer.WriteKubeconfig(tt.ctx, tc.clusterName, tt.mgmtCluster.KubeconfigFile, buf) if !tc.expectErr {