@@ -213,3 +213,91 @@ func TestMountPoint_Delete(t *testing.T) {
213213 return expectedCommandResp , mp .Delete ()
214214 }, nil , mountName , expectedCommand )
215215}
216+
217+ func TestDeletedMountClusterRecreates (t * testing.T ) {
218+ qa .HTTPFixturesApply (t , []qa.HTTPFixture {
219+ {
220+ Method : "GET" ,
221+ Resource : "/api/2.0/clusters/get?cluster_id=abc" ,
222+ Status : 404 ,
223+ },
224+ {
225+ Method : "GET" ,
226+ ReuseRequest : true ,
227+ Resource : "/api/2.0/clusters/list" ,
228+ Response : map [string ]interface {}{},
229+ },
230+ {
231+ Method : "GET" ,
232+ ReuseRequest : true ,
233+ Resource : "/api/2.0/clusters/spark-versions" ,
234+ Response : compute.SparkVersionsList {
235+ SparkVersions : []compute.SparkVersion {
236+ {
237+ Version : "7.1.x-cpu-ml-scala2.12" ,
238+ Description : "7.1 ML (includes Apache Spark 3.0.0, Scala 2.12)" ,
239+ },
240+ },
241+ },
242+ },
243+ {
244+ Method : "GET" ,
245+ ReuseRequest : true ,
246+ Resource : "/api/2.0/clusters/list-node-types" ,
247+ Response : compute.NodeTypeList {
248+ NodeTypes : []compute.NodeType {
249+ {
250+ NodeTypeID : "Standard_F4s" ,
251+ InstanceTypeID : "Standard_F4s" ,
252+ MemoryMB : 8192 ,
253+ NumCores : 4 ,
254+ NodeInstanceType : & compute.NodeInstanceType {
255+ LocalDisks : 1 ,
256+ InstanceTypeID : "Standard_F4s" ,
257+ LocalDiskSizeGB : 16 ,
258+ LocalNVMeDisks : 0 ,
259+ },
260+ },
261+ },
262+ },
263+ },
264+ {
265+ Method : "POST" ,
266+ ReuseRequest : true ,
267+ Resource : "/api/2.0/clusters/create" ,
268+ ExpectedRequest : compute.Cluster {
269+ AutoterminationMinutes : 10 ,
270+ ClusterName : "terraform-mount" ,
271+ NodeTypeID : "Standard_F4s" ,
272+ SparkVersion : "7.3.x-scala2.12" ,
273+ CustomTags : map [string ]string {
274+ "ResourceClass" : "SingleNode" ,
275+ },
276+ SparkConf : map [string ]string {
277+ "spark.databricks.cluster.profile" : "singleNode" ,
278+ "spark.master" : "local[*]" ,
279+ },
280+ },
281+ Response : compute.ClusterID {
282+ ClusterID : "bcd" ,
283+ },
284+ },
285+ {
286+ Method : "GET" ,
287+ ReuseRequest : true ,
288+ Resource : "/api/2.0/clusters/get?cluster_id=bcd" ,
289+ Response : compute.ClusterInfo {
290+ ClusterID : "bcd" ,
291+ State : "RUNNING" ,
292+ SparkConf : map [string ]string {
293+ "spark.databricks.acl.dfAclsEnabled" : "true" ,
294+ "spark.databricks.cluster.profile" : "singleNode" ,
295+ },
296+ },
297+ },
298+ }, func (ctx context.Context , client * common.DatabricksClient ) {
299+ clusterID , err := getMountingClusterID (ctx , client , "abc" )
300+ assert .NoError (t , err )
301+ assert .Equal (t , "bcd" , clusterID )
302+ })
303+ }
0 commit comments