Skip to content

Commit 4927dc0

Browse files
authored
Bump databricks-sdk-go to v0.40.0 (#3534)
* work * work * work * safer test
1 parent f58bf22 commit 4927dc0

File tree

6 files changed

+28
-22
lines changed

6 files changed

+28
-22
lines changed

clusters/resource_cluster_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -258,13 +258,13 @@ func TestResourceClusterCreate_WithLibraries(t *testing.T) {
258258
Package: "seaborn==1.2.4",
259259
},
260260
},
261-
Status: compute.LibraryFullStatusStatusPending,
261+
Status: compute.LibraryInstallStatusPending,
262262
},
263263
{
264264
Library: &compute.Library{
265265
Whl: "dbfs://baz.whl",
266266
},
267-
Status: compute.LibraryFullStatusStatusInstalled,
267+
Status: compute.LibraryInstallStatusInstalled,
268268
},
269269
},
270270
},
@@ -281,13 +281,13 @@ func TestResourceClusterCreate_WithLibraries(t *testing.T) {
281281
Package: "seaborn==1.2.4",
282282
},
283283
},
284-
Status: compute.LibraryFullStatusStatusInstalled,
284+
Status: compute.LibraryInstallStatusInstalled,
285285
},
286286
{
287287
Library: &compute.Library{
288288
Whl: "dbfs://baz.whl",
289289
},
290-
Status: compute.LibraryFullStatusStatusInstalled,
290+
Status: compute.LibraryInstallStatusInstalled,
291291
},
292292
},
293293
},
@@ -304,13 +304,13 @@ func TestResourceClusterCreate_WithLibraries(t *testing.T) {
304304
Package: "seaborn==1.2.4",
305305
},
306306
},
307-
Status: compute.LibraryFullStatusStatusInstalled,
307+
Status: compute.LibraryInstallStatusInstalled,
308308
},
309309
{
310310
Library: &compute.Library{
311311
Whl: "dbfs://baz.whl",
312312
},
313-
Status: compute.LibraryFullStatusStatusInstalled,
313+
Status: compute.LibraryInstallStatusInstalled,
314314
},
315315
},
316316
},
@@ -1072,13 +1072,13 @@ func TestResourceClusterUpdate_LibrariesChangeOnTerminatedCluster(t *testing.T)
10721072
Library: &compute.Library{
10731073
Jar: "dbfs://foo.jar",
10741074
},
1075-
Status: compute.LibraryFullStatusStatusInstalled,
1075+
Status: compute.LibraryInstallStatusInstalled,
10761076
},
10771077
{
10781078
Library: &compute.Library{
10791079
Egg: "dbfs://bar.egg",
10801080
},
1081-
Status: compute.LibraryFullStatusStatusInstalled,
1081+
Status: compute.LibraryInstallStatusInstalled,
10821082
},
10831083
},
10841084
},
@@ -1107,15 +1107,15 @@ func TestResourceClusterUpdate_LibrariesChangeOnTerminatedCluster(t *testing.T)
11071107
Library: &compute.Library{
11081108
Egg: "dbfs://bar.egg",
11091109
},
1110-
Status: compute.LibraryFullStatusStatusInstalled,
1110+
Status: compute.LibraryInstallStatusInstalled,
11111111
},
11121112
{
11131113
Library: &compute.Library{
11141114
Pypi: &compute.PythonPyPiLibrary{
11151115
Package: "requests",
11161116
},
11171117
},
1118-
Status: compute.LibraryFullStatusStatusInstalled,
1118+
Status: compute.LibraryInstallStatusInstalled,
11191119
},
11201120
},
11211121
},
@@ -1628,7 +1628,7 @@ func TestReadOnStoppedClusterWithLibrariesDoesNotFail(t *testing.T) {
16281628
Library: &compute.Library{
16291629
Jar: "foo.bar",
16301630
},
1631-
Status: compute.LibraryFullStatusStatusPending,
1631+
Status: compute.LibraryInstallStatusPending,
16321632
},
16331633
},
16341634
},
@@ -1665,14 +1665,14 @@ func TestRefreshOnRunningClusterWithFailedLibraryUninstallsIt(t *testing.T) {
16651665
Library: &compute.Library{
16661666
Jar: "foo.bar",
16671667
},
1668-
Status: compute.LibraryFullStatusStatusFailed,
1668+
Status: compute.LibraryInstallStatusFailed,
16691669
Messages: []string{"fails for the test"},
16701670
},
16711671
{
16721672
Library: &compute.Library{
16731673
Whl: "bar.whl",
16741674
},
1675-
Status: compute.LibraryFullStatusStatusInstalled,
1675+
Status: compute.LibraryInstallStatusInstalled,
16761676
},
16771677
},
16781678
},

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/databricks/terraform-provider-databricks
33
go 1.21
44

55
require (
6-
github.com/databricks/databricks-sdk-go v0.38.0
6+
github.com/databricks/databricks-sdk-go v0.40.0
77
github.com/golang-jwt/jwt/v4 v4.5.0
88
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
99
github.com/hashicorp/hcl v1.0.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBS
2424
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
2525
github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg=
2626
github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4=
27-
github.com/databricks/databricks-sdk-go v0.38.0 h1:MQhOCWTkdKItG+n6ZwcXQv9FWBVXq9fax8VSZns2e+0=
28-
github.com/databricks/databricks-sdk-go v0.38.0/go.mod h1:Yjy1gREDLK65g4axpVbVNKYAHYE2Sqzj0AB9QWHCBVM=
27+
github.com/databricks/databricks-sdk-go v0.40.0 h1:H9KAyRbM5lwnY8t9nY/xAYHVTBsLqFuIRwVaRGqYJe0=
28+
github.com/databricks/databricks-sdk-go v0.40.0/go.mod h1:Yjy1gREDLK65g4axpVbVNKYAHYE2Sqzj0AB9QWHCBVM=
2929
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3030
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3131
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

jobs/resource_job_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/databricks/terraform-provider-databricks/clusters"
1414
"github.com/databricks/terraform-provider-databricks/common"
1515
"github.com/databricks/terraform-provider-databricks/qa"
16+
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
1617

1718
"github.com/stretchr/testify/assert"
1819
"github.com/stretchr/testify/require"
@@ -1985,9 +1986,14 @@ func TestResourceJobRead(t *testing.T) {
19851986
assert.NoError(t, err)
19861987

19871988
assert.Equal(t, "Featurizer", d.Get("name"))
1988-
assert.Equal(t, 2, d.Get("library.#"))
1989-
assert.Equal(t, "dbfs://ff/gg/hh.jar", d.Get("library.1850263921.jar"))
1990-
assert.Equal(t, "dbfs://aa/bb/cc.jar", d.Get("library.587400796.jar"))
1989+
libraries := d.Get("library").(*schema.Set).List()
1990+
assert.Len(t, libraries, 2)
1991+
allDbfsLibs := []string{}
1992+
for _, lib := range libraries {
1993+
allDbfsLibs = append(allDbfsLibs, lib.(map[string]any)["jar"].(string))
1994+
}
1995+
assert.Contains(t, allDbfsLibs, "dbfs://ff/gg/hh.jar")
1996+
assert.Contains(t, allDbfsLibs, "dbfs://aa/bb/cc.jar")
19911997

19921998
assert.Equal(t, 2, d.Get("spark_jar_task.0.parameters.#"))
19931999
assert.Equal(t, "com.labs.BarMain", d.Get("spark_jar_task.0.main_class_name"))

libraries/libraries_api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func NewLibraryFromInstanceState(i any) (lib compute.Library) {
4343
}
4444

4545
// Diff returns install/uninstall lists given a cluster lib status
46-
func GetLibrariesToInstallAndUninstall(cll []compute.Library, cls *compute.ClusterLibraryStatuses) ([]compute.Library, []compute.Library) {
46+
func GetLibrariesToInstallAndUninstall(cll []compute.Library, cls *compute.ClusterStatusResponse) ([]compute.Library, []compute.Library) {
4747
inConfig := map[string]compute.Library{}
4848
for _, lib := range cll {
4949
inConfig[lib.String()] = lib

libraries/libraries_api_sdk.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616

1717
// Given a compute.Wait struct, returns library statuses based on the input parameter.
1818
// If wait.IsRunning is set to true, this function will wait until all of the libraries are installed to return. Otherwise, it will directly return the list of libraries.
19-
func WaitForLibrariesInstalledSdk(ctx context.Context, w *databricks.WorkspaceClient, wait compute.Wait, timeout time.Duration) (result *compute.ClusterLibraryStatuses, err error) {
19+
func WaitForLibrariesInstalledSdk(ctx context.Context, w *databricks.WorkspaceClient, wait compute.Wait, timeout time.Duration) (result *compute.ClusterStatusResponse, err error) {
2020
err = resource.RetryContext(ctx, timeout, func() *resource.RetryError {
2121
libsClusterStatus, err := w.Libraries.ClusterStatusByClusterId(ctx, wait.ClusterID)
2222
if err != nil {
@@ -67,7 +67,7 @@ func WaitForLibrariesInstalledSdk(ctx context.Context, w *databricks.WorkspaceCl
6767
// and result contains only the libraries that were successfully installed
6868
result.LibraryStatuses = installed
6969
if len(cleanup.Libraries) > 0 {
70-
w.Libraries.Uninstall(ctx, cleanup)
70+
err = w.Libraries.Uninstall(ctx, cleanup)
7171
if err != nil {
7272
err = fmt.Errorf("cannot cleanup libraries: %w", err)
7373
}

0 commit comments

Comments
 (0)