remove unused arg infilerForVolume(context.Background(), b)

This commit is contained in:
Shreyas Goenka 2024-12-30 17:02:00 +05:30
parent 56cd37b1aa
commit 923bc96e27
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
3 changed files with 6 additions and 7 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)