From dd78ab8e81b8f27a016d7c9e9940c98ae38e98ed Mon Sep 17 00:00:00 2001 From: Vuong Date: Thu, 20 Jun 2024 18:14:58 +0100 Subject: [PATCH] tidy up --- catalog/resource_sql_table_test.go | 4 ++++ clusters/clusters_api.go | 14 ++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/catalog/resource_sql_table_test.go b/catalog/resource_sql_table_test.go index 58d4b0ddd6..fdf3fd4162 100644 --- a/catalog/resource_sql_table_test.go +++ b/catalog/resource_sql_table_test.go @@ -1254,6 +1254,10 @@ var baseClusterFixture = []qa.HTTPFixture{ Key: "7.1.x-cpu-ml-scala2.12", Name: "7.1 ML (includes Apache Spark 3.0.0, Scala 2.12)", }, + { + Key: "7.3.x-scala2.12", + Name: "7.3 LTS (includes Apache Spark 3.0.1, Scala 2.12)", + }, }, }, }, diff --git a/clusters/clusters_api.go b/clusters/clusters_api.go index dd4708aec1..1b7192390d 100644 --- a/clusters/clusters_api.go +++ b/clusters/clusters_api.go @@ -881,7 +881,6 @@ var getOrCreateClusterMutex sync.Mutex // GetOrCreateRunningCluster creates an autoterminating cluster if it doesn't exist func (a ClustersAPI) GetOrCreateRunningCluster(name string, custom ...Cluster) (c ClusterInfo, err error) { - w, err := a.client.WorkspaceClient() getOrCreateClusterMutex.Lock() defer getOrCreateClusterMutex.Unlock() @@ -915,14 +914,13 @@ func (a ClustersAPI) GetOrCreateRunningCluster(name string, custom ...Cluster) ( LocalDisk: true, }) log.Printf("[INFO] Creating an autoterminating cluster with node type %s", smallestNodeType) - latestVersion, _ := w.Clusters.SelectSparkVersion(a.context, compute.SparkVersionRequest{ - Latest: true, - LongTermSupport: true, - }) r := Cluster{ - NumWorkers: 1, - ClusterName: name, - SparkVersion: latestVersion, + NumWorkers: 1, + ClusterName: name, + SparkVersion: LatestSparkVersionOrDefault(a.Context(), a.WorkspaceClient(), compute.SparkVersionRequest{ + Latest: true, + LongTermSupport: true, + }), NodeTypeID: smallestNodeType, AutoterminationMinutes: 10, }