diff --git a/client/service/commands.go b/client/service/commands.go index 857bfed89..827ce524a 100644 --- a/client/service/commands.go +++ b/client/service/commands.go @@ -16,6 +16,11 @@ type CommandsAPI struct { Client *DBApiClient } +// CommandExecutor creates a spark context and executes a command and then closes context +type CommandExecutor interface { + Execute(clusterID, language, commandStr string) (model.Command, error) +} + // Execute creates a spark context and executes a command and then closes context func (a CommandsAPI) Execute(clusterID, language, commandStr string) (model.Command, error) { var resp model.Command diff --git a/client/service/commands_test.go b/client/service/commands_test.go index 6481e7487..673625275 100644 --- a/client/service/commands_test.go +++ b/client/service/commands_test.go @@ -7,6 +7,9 @@ import ( "github.com/databrickslabs/databricks-terraform/client/model" ) +// Test interface compliance +var _ CommandExecutor = (*CommandsAPI)(nil) + func TestCommandsAPI_Execute(t *testing.T) { type context struct { Language string `json:"language,omitempty"` diff --git a/databricks/mounts.go b/databricks/mounts.go index e53932c07..a5a3cedbd 100644 --- a/databricks/mounts.go +++ b/databricks/mounts.go @@ -30,13 +30,13 @@ func NewAWSIamMount(s3BucketName string, mountName string) *AWSIamMount { } // Create creates an aws iam mount given a cluster ID -func (m AWSIamMount) Create(client *service.DBApiClient, clusterID string) error { +func (m AWSIamMount) Create(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` dbutils.fs.mount("s3a://%s", "/mnt/%s") dbutils.fs.ls("/mnt/%s") dbutils.notebook.exit("success") `, m.S3BucketName, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -48,13 +48,13 @@ dbutils.notebook.exit("success") } // Delete deletes an aws iam mount given a cluster ID -func (m AWSIamMount) Delete(client *service.DBApiClient, clusterID string) error { +func (m AWSIamMount) Delete(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` dbutils.fs.unmount("/mnt/%s") dbutils.fs.refreshMounts() dbutils.notebook.exit("success") `, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -66,14 +66,14 @@ dbutils.notebook.exit("success") } // Read verifies an aws iam mount given a cluster ID -func (m AWSIamMount) Read(client *service.DBApiClient, clusterID string) (string, error) { +func (m AWSIamMount) Read(exec service.CommandExecutor, clusterID string) (string, error) { iamMountCommand := fmt.Sprintf(` dbutils.fs.ls("/mnt/%s") for mount in dbutils.fs.mounts(): if mount.mountPoint == "/mnt/%s": dbutils.notebook.exit(mount.source) `, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return "", err } @@ -109,7 +109,7 @@ func NewAzureBlobMount(containerName string, storageAccountName string, director } // Create creates a azure blob storage mount given a cluster id -func (m AzureBlobMount) Create(client *service.DBApiClient, clusterID string) error { +func (m AzureBlobMount) Create(exec service.CommandExecutor, clusterID string) error { var confKey string if m.AuthType == "SAS" { @@ -133,7 +133,7 @@ except Exception as e: raise e dbutils.notebook.exit("success") `, m.ContainerName, m.StorageAccountName, m.Directory, m.MountName, confKey, m.SecretScope, m.SecretKey) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -145,13 +145,13 @@ dbutils.notebook.exit("success") } // Delete deletes a azure blob storage mount given a cluster id -func (m AzureBlobMount) Delete(client *service.DBApiClient, clusterID string) error { +func (m AzureBlobMount) Delete(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` dbutils.fs.unmount("/mnt/%s") dbutils.fs.refreshMounts() dbutils.notebook.exit("success") `, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -163,14 +163,13 @@ dbutils.notebook.exit("success") } // Read verifies a azure blob storage mount given a cluster id -func (m AzureBlobMount) Read(client *service.DBApiClient, clusterID string) (string, error) { +func (m AzureBlobMount) Read(exec service.CommandExecutor, clusterID string) (string, error) { iamMountCommand := fmt.Sprintf(` -dbutils.fs.ls("/mnt/%s") for mount in dbutils.fs.mounts(): - if mount.mountPoint == "/mnt/%s": - dbutils.notebook.exit(mount.source) -`, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + if mount.mountPoint == "/mnt/%s": + dbutils.notebook.exit(mount.source) +`, m.MountName) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return "", err } @@ -214,7 +213,7 @@ func NewAzureADLSGen1Mount(storageResource string, directory string, mountName s } // Create creates a azure datalake gen 1 storage mount given a cluster id -func (m AzureADLSGen1Mount) Create(client *service.DBApiClient, clusterID string) error { +func (m AzureADLSGen1Mount) Create(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` for mount in dbutils.fs.mounts(): if mount.mountPoint == "/mnt/%[8]s" and mount.source=="adl://%[6]s.azuredatalakestore.net%[7]s": @@ -235,7 +234,7 @@ except Exception as e: raise e dbutils.notebook.exit("success") `, m.PrefixType, m.ClientID, m.SecretScope, m.SecretKey, m.TenantID, m.StorageResource, m.Directory, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -247,13 +246,13 @@ dbutils.notebook.exit("success") } // Delete deletes a azure datalake gen 1 storage mount given a cluster id -func (m AzureADLSGen1Mount) Delete(client *service.DBApiClient, clusterID string) error { +func (m AzureADLSGen1Mount) Delete(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` dbutils.fs.unmount("/mnt/%s") dbutils.fs.refreshMounts() dbutils.notebook.exit("success") `, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -265,14 +264,13 @@ dbutils.notebook.exit("success") } // Read verifies the azure datalake gen 1 storage mount given a cluster id -func (m AzureADLSGen1Mount) Read(client *service.DBApiClient, clusterID string) (string, error) { +func (m AzureADLSGen1Mount) Read(exec service.CommandExecutor, clusterID string) (string, error) { iamMountCommand := fmt.Sprintf(` -dbutils.fs.ls("/mnt/%s") for mount in dbutils.fs.mounts(): - if mount.mountPoint == "/mnt/%s": - dbutils.notebook.exit(mount.source) -`, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + if mount.mountPoint == "/mnt/%s": + dbutils.notebook.exit(mount.source) +`, m.MountName) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return "", err } @@ -316,7 +314,7 @@ func NewAzureADLSGen2Mount(containerName string, storageAccountName string, dire } // Create creates a azure datalake gen 2 storage mount -func (m AzureADLSGen2Mount) Create(client *service.DBApiClient, clusterID string) error { +func (m AzureADLSGen2Mount) Create(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` for mount in dbutils.fs.mounts(): if mount.mountPoint == "/mnt/%[9]s" and mount.source=="abfss://%[6]s@%[7]s.dfs.core.windows.net%[8]s": @@ -342,7 +340,7 @@ except Exception as e: raise e dbutils.notebook.exit("success") `, m.ClientID, m.SecretScope, m.SecretKey, m.TenantID, m.InitializeFileSystem, m.ContainerName, m.StorageAccountName, m.Directory, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -354,13 +352,13 @@ dbutils.notebook.exit("success") } // Delete deletes a azure datalake gen 2 storage mount -func (m AzureADLSGen2Mount) Delete(client *service.DBApiClient, clusterID string) error { +func (m AzureADLSGen2Mount) Delete(exec service.CommandExecutor, clusterID string) error { iamMountCommand := fmt.Sprintf(` dbutils.fs.unmount("/mnt/%s") dbutils.fs.refreshMounts() dbutils.notebook.exit("success") `, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return err } @@ -372,14 +370,13 @@ dbutils.notebook.exit("success") } // Read verifies the azure datalake gen 2 storage mount -func (m AzureADLSGen2Mount) Read(client *service.DBApiClient, clusterID string) (string, error) { +func (m AzureADLSGen2Mount) Read(exec service.CommandExecutor, clusterID string) (string, error) { iamMountCommand := fmt.Sprintf(` -dbutils.fs.ls("/mnt/%s") for mount in dbutils.fs.mounts(): - if mount.mountPoint == "/mnt/%s": - dbutils.notebook.exit(mount.source) -`, m.MountName, m.MountName) - resp, err := client.Commands().Execute(clusterID, "python", iamMountCommand) + if mount.mountPoint == "/mnt/%s": + dbutils.notebook.exit(mount.source) +`, m.MountName) + resp, err := exec.Execute(clusterID, "python", iamMountCommand) if err != nil { return "", err } diff --git a/databricks/mounts_test.go b/databricks/mounts_test.go index a8dd4f7eb..173e7f578 100644 --- a/databricks/mounts_test.go +++ b/databricks/mounts_test.go @@ -1,11 +1,243 @@ package databricks import ( + "errors" + "fmt" "testing" + "github.com/databrickslabs/databricks-terraform/client/model" "github.com/stretchr/testify/assert" ) +var executeMock func(clusterID, language, commandStr string) (model.Command, error) + +type commandExecutorMock struct{} + +func (a commandExecutorMock) Execute(clusterID, language, commandStr string) (model.Command, error) { + return executeMock(clusterID, language, commandStr) +} + +func TestAzureBlobMountReadRetrievesMountInformation(t *testing.T) { + const cn = "mycontainer" + const sacc = "mystorage" + const dir = "mydirectory" + + testCases := []struct { + Name string + ExpectedResult string + ExpectedError error + CommandResult *model.CommandResults + }{ + { + Name: "Mount found successfully", + ExpectedResult: fmt.Sprintf("abfss://%s@%s.dfs.core.windows.net/%s", cn, sacc, dir), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: fmt.Sprintf("abfss://%s@%s.dfs.core.windows.net/%s", cn, sacc, dir), + }, + }, + { + Name: "Mount not found - no match in db", + ExpectedError: errors.New("unable to find mount point"), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "", + }, + }, + { + Name: "Mount found - but does not match configuration", + ExpectedError: fmt.Errorf("does not match uri with storage account and container values %s@%s != abfss://x@y.dfs.core.windows.net/z!", cn, sacc), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "abfss://x@y.dfs.core.windows.net/z", + }, + }, + { + Name: "Error - db returns error", + ExpectedError: errors.New("out of wibble error"), + CommandResult: &model.CommandResults{ + ResultType: "error", + Summary: "out of wibble error", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + executeMock = func(clusterID, language, commandStr string) (model.Command, error) { + return model.Command{ + Results: tc.CommandResult, + }, nil + } + executorMock := commandExecutorMock{} + + blobMount := NewAzureBlobMount(cn, sacc, dir, "mount", "", "", "") + + result, err := blobMount.Read(executorMock, "wibble") + + assert.Equal(t, tc.ExpectedResult, result) + assert.Equal(t, tc.ExpectedError, err) + }) + } +} + +func TestAzureADLSGen1MountReadRetrievesMountInformation(t *testing.T) { + const sacc = "mystorage" + const dir = "mydirectory" + + testCases := []struct { + Name string + ExpectedResult string + ExpectedError error + CommandResult *model.CommandResults + }{ + { + Name: "Mount found successfully", + ExpectedResult: fmt.Sprintf("adl://%s.azuredatalakestore.net/%s", sacc, dir), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: fmt.Sprintf("adl://%s.azuredatalakestore.net/%s", sacc, dir), + }, + }, + { + Name: "Mount not found - no match in db", + ExpectedError: errors.New("unable to find mount point"), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "", + }, + }, + { + Name: "Mount found - but does not match configuration", + ExpectedError: fmt.Errorf("does not match uri with storage account and container values %s@%s != adl://x.azuredatalakestore.net/z!", sacc, dir), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "adl://x.azuredatalakestore.net/z", + }, + }, + { + Name: "Error - db returns error", + ExpectedError: errors.New("out of wibble error"), + CommandResult: &model.CommandResults{ + ResultType: "error", + Summary: "out of wibble error", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + executeMock = func(clusterID, language, commandStr string) (model.Command, error) { + return model.Command{ + Results: tc.CommandResult, + }, nil + } + executorMock := commandExecutorMock{} + + adlsGen2Mount := NewAzureADLSGen1Mount(sacc, dir, "mount", "", "", "", "", "") + + result, err := adlsGen2Mount.Read(executorMock, "wibble") + + assert.Equal(t, tc.ExpectedResult, result) + assert.Equal(t, tc.ExpectedError, err) + }) + } +} + +func TestAzureADLSGen2MountReadRetrievesMountInformation(t *testing.T) { + const cn = "mycontainer" + const sacc = "mystorage" + const dir = "mydirectory" + + testCases := []struct { + Name string + ExpectedResult string + ExpectedError error + CommandResult *model.CommandResults + }{ + { + Name: "Mount found successfully", + ExpectedResult: fmt.Sprintf("abfss://%s@%s.dfs.core.windows.net/%s", cn, sacc, dir), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: fmt.Sprintf("abfss://%s@%s.dfs.core.windows.net/%s", cn, sacc, dir), + }, + }, + { + Name: "Mount not found - no match in db", + ExpectedError: errors.New("unable to find mount point"), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "", + }, + }, + { + Name: "Mount found - but does not match configuration", + ExpectedError: fmt.Errorf("does not match uri with storage account and container values %s@%s != abfss://x@y.dfs.core.windows.net/z!", cn, sacc), + CommandResult: &model.CommandResults{ + ResultType: "text", + Data: "abfss://x@y.dfs.core.windows.net/z", + }, + }, + { + Name: "Error - db returns error", + ExpectedError: errors.New("out of wibble error"), + CommandResult: &model.CommandResults{ + ResultType: "error", + Summary: "out of wibble error", + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.Name, func(t *testing.T) { + executeMock = func(clusterID, language, commandStr string) (model.Command, error) { + return model.Command{ + Results: tc.CommandResult, + }, nil + } + executorMock := commandExecutorMock{} + + adlsGen2Mount := NewAzureADLSGen2Mount(cn, sacc, dir, "mount", "", "", "", "", true) + + result, err := adlsGen2Mount.Read(executorMock, "wibble") + + assert.Equal(t, tc.ExpectedResult, result) + assert.Equal(t, tc.ExpectedError, err) + }) + } +} + +func TestProcessAzureWasbAbfssUrisCorrectlySplitsURI(t *testing.T) { + testCases := []struct { + URI string + ExpectedContainer string + ExpectedStorageAcc string + ExpectedDirectory string + }{ + { + URI: "abfss://wibble@mystorage.dfs.core.windows.net/wobble", + ExpectedContainer: "wibble", + ExpectedStorageAcc: "mystorage", + ExpectedDirectory: "/wobble", + }, + { + URI: "abfss://wibble@mystorage.dfs.core.windows.net", + ExpectedContainer: "wibble", + ExpectedStorageAcc: "mystorage", + ExpectedDirectory: "", + }, + } + + for _, tc := range testCases { + container, storageAcc, dir, err := ProcessAzureWasbAbfssUris(tc.URI) + assert.Equal(t, tc.ExpectedContainer, container) + assert.Equal(t, tc.ExpectedStorageAcc, storageAcc) + assert.Equal(t, tc.ExpectedDirectory, dir) + assert.Nil(t, err) + } +} + func TestValidateMountDirectory(t *testing.T) { testCases := []struct { directory string diff --git a/databricks/resource_databricks_aws_s3_mount.go b/databricks/resource_databricks_aws_s3_mount.go index 5a9b20bba..f1712ecf1 100644 --- a/databricks/resource_databricks_aws_s3_mount.go +++ b/databricks/resource_databricks_aws_s3_mount.go @@ -43,7 +43,7 @@ func resourceAWSS3Create(d *schema.ResourceData, m interface{}) error { s3BucketMount := NewAWSIamMount(s3BucketName, mountName) - err = s3BucketMount.Create(client, clusterID) + err = s3BucketMount.Create(client.Commands(), clusterID) if err != nil { return err } @@ -74,7 +74,7 @@ func resourceAWSS3Read(d *schema.ResourceData, m interface{}) error { s3BucketMount := NewAWSIamMount(s3BucketName, mountName) - s3BucketNameMounted, err := s3BucketMount.Read(client, clusterID) + s3BucketNameMounted, err := s3BucketMount.Read(client.Commands(), clusterID) if err != nil { return err } @@ -93,5 +93,5 @@ func resourceAWSS3Delete(d *schema.ResourceData, m interface{}) error { s3BucketName := d.Get("s3_bucket_name").(string) mountName := d.Get("mount_name").(string) s3BucketMount := NewAWSIamMount(s3BucketName, mountName) - return s3BucketMount.Delete(client, clusterID) + return s3BucketMount.Delete(client.Commands(), clusterID) } diff --git a/databricks/resource_databricks_azure_adls_gen1_mount.go b/databricks/resource_databricks_azure_adls_gen1_mount.go index 1218eeac7..385e95e4f 100644 --- a/databricks/resource_databricks_azure_adls_gen1_mount.go +++ b/databricks/resource_databricks_azure_adls_gen1_mount.go @@ -90,7 +90,7 @@ func resourceAzureAdlsGen1Create(d *schema.ResourceData, m interface{}) error { adlsGen1Mount := NewAzureADLSGen1Mount(storageResourceName, directory, mountName, sparkConfPrefix, clientID, tenantID, clientSecretScope, clientSecretKey) - err = adlsGen1Mount.Create(client, clusterID) + err = adlsGen1Mount.Create(client.Commands(), clusterID) if err != nil { return err } @@ -151,7 +151,7 @@ func resourceAzureAdlsGen1Read(d *schema.ResourceData, m interface{}) error { adlsGen1Mount := NewAzureADLSGen1Mount(storageResourceName, directory, mountName, sparkConfPrefix, clientID, tenantID, clientSecretScope, clientSecretKey) - url, err := adlsGen1Mount.Read(client, clusterID) + url, err := adlsGen1Mount.Read(client.Commands(), clusterID) if err != nil { //Reset id in case of inability to find mount if strings.Contains(err.Error(), "Unable to find mount point!") || @@ -191,5 +191,5 @@ func resourceAzureAdlsGen1Delete(d *schema.ResourceData, m interface{}) error { adlsGen1Mount := NewAzureADLSGen1Mount(storageResourceName, directory, mountName, sparkConfPrefix, clientID, tenantID, clientSecretScope, clientSecretKey) - return adlsGen1Mount.Delete(client, clusterID) + return adlsGen1Mount.Delete(client.Commands(), clusterID) } diff --git a/databricks/resource_databricks_azure_adls_gen2_mount.go b/databricks/resource_databricks_azure_adls_gen2_mount.go index 0f75df9b7..3f63c4ed2 100644 --- a/databricks/resource_databricks_azure_adls_gen2_mount.go +++ b/databricks/resource_databricks_azure_adls_gen2_mount.go @@ -92,7 +92,7 @@ func resourceAzureAdlsGen2Create(d *schema.ResourceData, m interface{}) error { adlsGen2Mount := NewAzureADLSGen2Mount(containerName, storageAccountName, directory, mountName, clientID, tenantID, clientSecretScope, clientSecretKey, initializeFileSystem) - err = adlsGen2Mount.Create(client, clusterID) + err = adlsGen2Mount.Create(client.Commands(), clusterID) if err != nil { return err } @@ -155,7 +155,7 @@ func resourceAzureAdlsGen2Read(d *schema.ResourceData, m interface{}) error { adlsGen2Mount := NewAzureADLSGen2Mount(containerName, storageAccountName, directory, mountName, clientID, tenantID, clientSecretScope, clientSecretKey, initializeFileSystem) - url, err := adlsGen2Mount.Read(client, clusterID) + url, err := adlsGen2Mount.Read(client.Commands(), clusterID) if err != nil { //Reset id in case of inability to find mount if strings.Contains(err.Error(), "Unable to find mount point!") || @@ -200,5 +200,5 @@ func resourceAzureAdlsGen2Delete(d *schema.ResourceData, m interface{}) error { adlsGen2Mount := NewAzureADLSGen2Mount(containerName, storageAccountName, directory, mountName, clientID, tenantID, clientSecretScope, clientSecretKey, initializeFileSystem) - return adlsGen2Mount.Delete(client, clusterID) + return adlsGen2Mount.Delete(client.Commands(), clusterID) } diff --git a/databricks/resource_databricks_azure_blob_mount.go b/databricks/resource_databricks_azure_blob_mount.go index 760f2d245..a23a5c748 100644 --- a/databricks/resource_databricks_azure_blob_mount.go +++ b/databricks/resource_databricks_azure_blob_mount.go @@ -83,7 +83,7 @@ func resourceAzureBlobMountCreate(d *schema.ResourceData, m interface{}) error { blobMount := NewAzureBlobMount(containerName, storageAccountName, directory, mountName, authType, tokenSecretScope, tokenSecretKey) - err = blobMount.Create(client, clusterID) + err = blobMount.Create(client.Commands(), clusterID) if err != nil { return err } @@ -137,7 +137,7 @@ func resourceAzureBlobMountRead(d *schema.ResourceData, m interface{}) error { blobMount := NewAzureBlobMount(containerName, storageAccountName, directory, mountName, authType, tokenSecretScope, tokenSecretKey) - url, err := blobMount.Read(client, clusterID) + url, err := blobMount.Read(client.Commands(), clusterID) if err != nil { //Reset id in case of inability to find mount if strings.Contains(err.Error(), "Unable to find mount point!") || @@ -180,5 +180,5 @@ func resourceAzureBlobMountDelete(d *schema.ResourceData, m interface{}) error { blobMount := NewAzureBlobMount(containerName, storageAccountName, directory, mountName, authType, tokenSecretScope, tokenSecretKey) - return blobMount.Delete(client, clusterID) + return blobMount.Delete(client.Commands(), clusterID) } diff --git a/databricks/resource_databricks_azure_blob_mount_test.go b/databricks/resource_databricks_azure_blob_mount_test.go index f7f8a0b15..5cc1853b4 100644 --- a/databricks/resource_databricks_azure_blob_mount_test.go +++ b/databricks/resource_databricks_azure_blob_mount_test.go @@ -30,7 +30,7 @@ func TestAccAzureBlobMount_correctly_mounts(t *testing.T) { { PreConfig: func() { client := testAccProvider.Meta().(*service.DBApiClient) - err := azureBlobMount.Delete(client, clusterInfo.ClusterID) + err := azureBlobMount.Delete(client.Commands(), clusterInfo.ClusterID) assert.NoError(t, err, "TestAccAzureBlobMount_correctly_mounts: Failed to remove the mount.") }, Config: terraformToApply, @@ -115,7 +115,8 @@ func testAccAzureBlobMountMountExists(n string, azureBlobMount *AzureBlobMount, client := testAccProvider.Meta().(*service.DBApiClient) clusterID := clusterInfo.ClusterID - message, err := blobMount.Read(client, clusterID) + message, err := blobMount.Read(client.Commands(), clusterID) + if err != nil { return fmt.Errorf("Error reading the mount %s: error %s", message, err) }