Skip to content

Commit

Permalink
remove unused arg infilerForVolume(context.Background(), b)
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas-goenka committed Dec 30, 2024
1 parent 56cd37b commit 923bc96
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion bundle/libraries/filer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions bundle/libraries/filer_volume.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package libraries

import (
"context"
"path"

"github.com/databricks/cli/bundle"
"github.com/databricks/cli/libs/diag"
"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)
Expand Down
8 changes: 4 additions & 4 deletions bundle/libraries/filer_volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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")
}

Expand All @@ -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)
Expand Down

0 comments on commit 923bc96

Please sign in to comment.