From 923bc96e276ff4d933b9e2ac65cba09adea2e4a0 Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Mon, 30 Dec 2024 17:02:00 +0530 Subject: [PATCH] remove unused arg infilerForVolume(context.Background(), b) --- bundle/libraries/filer.go | 2 +- bundle/libraries/filer_volume.go | 3 +-- bundle/libraries/filer_volume_test.go | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/bundle/libraries/filer.go b/bundle/libraries/filer.go index 4448ed325..e09c75e0e 100644 --- a/bundle/libraries/filer.go +++ b/bundle/libraries/filer.go @@ -24,7 +24,7 @@ func GetFilerForLibraries(ctx context.Context, b *bundle.Bundle) (filer.Filer, s switch { case IsVolumesPath(artifactPath): - return filerForVolume(ctx, b) + return filerForVolume(b) default: return filerForWorkspace(b) diff --git a/bundle/libraries/filer_volume.go b/bundle/libraries/filer_volume.go index 4ef574628..176f475c6 100644 --- a/bundle/libraries/filer_volume.go +++ b/bundle/libraries/filer_volume.go @@ -1,7 +1,6 @@ package libraries import ( - "context" "path" "github.com/databricks/cli/bundle" @@ -9,7 +8,7 @@ import ( "github.com/databricks/cli/libs/filer" ) -func filerForVolume(ctx context.Context, b *bundle.Bundle) (filer.Filer, string, diag.Diagnostics) { +func filerForVolume(b *bundle.Bundle) (filer.Filer, string, diag.Diagnostics) { w := b.WorkspaceClient() uploadPath := path.Join(b.Config.Workspace.ArtifactPath, InternalDirName) f, err := filer.NewFilesClient(w, uploadPath) diff --git a/bundle/libraries/filer_volume_test.go b/bundle/libraries/filer_volume_test.go index ee3523737..75d4595aa 100644 --- a/bundle/libraries/filer_volume_test.go +++ b/bundle/libraries/filer_volume_test.go @@ -38,7 +38,7 @@ func TestFilerForVolumeForErrorFromAPI(t *testing.T) { m.GetMockFilesAPI().EXPECT().GetDirectoryMetadataByDirectoryPath(mock.Anything, "/Volumes/main/my_schema/my_volume").Return(fmt.Errorf("error from API")) b.SetWorkpaceClient(m.WorkspaceClient) - _, _, diags := filerForVolume(context.Background(), b) + _, _, diags := filerForVolume(b) assert.Equal(t, diag.Diagnostics{ { Severity: diag.Error, @@ -65,7 +65,7 @@ func TestFilerForVolumeWithVolumeNotFound(t *testing.T) { m.GetMockFilesAPI().EXPECT().GetDirectoryMetadataByDirectoryPath(mock.Anything, "/Volumes/main/my_schema/doesnotexist").Return(apierr.NotFound("some error message")) b.SetWorkpaceClient(m.WorkspaceClient) - _, _, diags := filerForVolume(context.Background(), b) + _, _, diags := filerForVolume(b) assert.Equal(t, diag.Diagnostics{ { Severity: diag.Error, @@ -129,7 +129,7 @@ func TestFilerForVolumeWithInvalidPrefix(t *testing.T) { }, } - _, _, diags := filerForVolume(context.Background(), b) + _, _, diags := filerForVolume(b) require.EqualError(t, diags.Error(), "expected artifact_path to start with /Volumes/, got /Volume/main/my_schema/my_volume") } @@ -155,7 +155,7 @@ func TestFilerForVolumeWithValidVolumePaths(t *testing.T) { m.GetMockFilesAPI().EXPECT().GetDirectoryMetadataByDirectoryPath(mock.Anything, "/Volumes/main/my_schema/my_volume").Return(nil) b.SetWorkpaceClient(m.WorkspaceClient) - client, uploadPath, diags := filerForVolume(context.Background(), b) + client, uploadPath, diags := filerForVolume(b) require.NoError(t, diags.Error()) assert.Equal(t, path.Join(p, ".internal"), uploadPath) assert.IsType(t, &filer.FilesClient{}, client)