From 34765088cf6715bd6005e247698850de133f3bb0 Mon Sep 17 00:00:00 2001 From: Tanvir Tatla Date: Tue, 16 Jan 2024 12:44:01 -0800 Subject: [PATCH] expect for variadic arguments --- pkg/clustermanager/cluster_creator.go | 4 ++-- pkg/clustermanager/cluster_creator_test.go | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/clustermanager/cluster_creator.go b/pkg/clustermanager/cluster_creator.go index 5ab080fbfc2f9..acd932b3e8465 100644 --- a/pkg/clustermanager/cluster_creator.go +++ b/pkg/clustermanager/cluster_creator.go @@ -44,10 +44,10 @@ func (cc ClusterCreator) buildClusterAccess(ctx context.Context, clusterName str Name: clusterName, } + fsOptions := []filewriter.FileOptionsFunc{filewriter.PersistentFile, filewriter.Permission0600} fh, path, err := cc.fs.Create( kubeconfig.FormatWorkloadClusterKubeconfigFilename(clusterName), - filewriter.PersistentFile, - filewriter.Permission0600, + fsOptions..., ) if err != nil { return nil, err diff --git a/pkg/clustermanager/cluster_creator_test.go b/pkg/clustermanager/cluster_creator_test.go index 8a16344584da2..f43b306eb77c2 100644 --- a/pkg/clustermanager/cluster_creator_test.go +++ b/pkg/clustermanager/cluster_creator_test.go @@ -14,6 +14,7 @@ import ( "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/clustermanager" "github.com/aws/eks-anywhere/pkg/clustermanager/mocks" + "github.com/aws/eks-anywhere/pkg/filewriter" mockswriter "github.com/aws/eks-anywhere/pkg/filewriter/mocks" "github.com/aws/eks-anywhere/pkg/kubeconfig" mockskubeconfig "github.com/aws/eks-anywhere/pkg/kubeconfig/mocks" @@ -50,7 +51,8 @@ func newClusterCreator(t *testing.T) (*clustermanager.ClusterCreator, *clusterCr } func (cct *clusterCreatorTest) expectFileCreate(clusterName, path string, w io.WriteCloser) { - cct.writer.EXPECT().Create(kubeconfig.FormatWorkloadClusterKubeconfigFilename(clusterName), gomock.Any(), gomock.Any()).Return(w, path, nil) + //opts := []interface{}{filewriter.PersistentFile, filewriter.Permission0600} + cct.writer.EXPECT().Create(kubeconfig.FormatWorkloadClusterKubeconfigFilename(clusterName), gomock.AssignableToTypeOf([]filewriter.FileOptionsFunc{})).Return(w, path, nil) } func (cct *clusterCreatorTest) expectWriteKubeconfig(ctx context.Context, clusterName, kubeconfig string, w io.Writer) {