-
Notifications
You must be signed in to change notification settings - Fork 393
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate
databricks_global_init_script
to Go SDK (#2036)
* Migrate `databricks_global_init_script` to Go SDK * Finish porting of global init scripts to SDK * Remove not necessary files --------- Co-authored-by: Alex Ott <[email protected]>
- Loading branch information
Showing
6 changed files
with
88 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ import ( | |
"testing" | ||
|
||
"github.com/databricks/databricks-sdk-go/apierr" | ||
"github.com/databricks/databricks-sdk-go/service/compute" | ||
"github.com/databricks/terraform-provider-databricks/qa" | ||
|
||
"github.com/stretchr/testify/assert" | ||
|
@@ -19,17 +20,17 @@ func TestResourceGlobalInitScriptRead(t *testing.T) { | |
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: http.MethodGet, | ||
Resource: "/api/2.0/global-init-scripts/1234", | ||
Response: GlobalInitScriptInfo{ | ||
ScriptID: "1234", | ||
Name: "Test", | ||
Position: 0, | ||
Enabled: true, | ||
CreatedBy: "[email protected]", | ||
CreatedAt: 1612520583493, | ||
UpdatedBy: "[email protected]", | ||
UpdatedAt: 1612520583493, | ||
ContentBase64: "ZWNobyBoZWxsbw==", | ||
Resource: "/api/2.0/global-init-scripts/1234?", | ||
Response: compute.GlobalInitScriptDetailsWithContent{ | ||
ScriptId: "1234", | ||
Name: "Test", | ||
Position: 0, | ||
Enabled: true, | ||
CreatedBy: "[email protected]", | ||
CreatedAt: 1612520583493, | ||
UpdatedBy: "[email protected]", | ||
UpdatedAt: 1612520583493, | ||
Script: "ZWNobyBoZWxsbw==", | ||
}, | ||
}, | ||
}, | ||
|
@@ -51,7 +52,7 @@ func TestResourceGlobalInitScriptDelete(t *testing.T) { | |
Fixtures: []qa.HTTPFixture{ | ||
{ | ||
Method: http.MethodDelete, | ||
Resource: "/api/2.0/global-init-scripts/" + scriptID + "?script_id=" + scriptID, | ||
Resource: "/api/2.0/global-init-scripts/1234?", | ||
Status: http.StatusOK, | ||
}, | ||
}, | ||
|
@@ -68,7 +69,7 @@ func TestResourceGlobalInitScriptRead_NotFound(t *testing.T) { | |
Fixtures: []qa.HTTPFixture{ | ||
{ // read log output for correct url... | ||
Method: "GET", | ||
Resource: "/api/2.0/global-init-scripts/1234", | ||
Resource: "/api/2.0/global-init-scripts/1234?", | ||
Response: apierr.APIErrorBody{ | ||
ErrorCode: "RESOURCE_DOES_NOT_EXIST", | ||
Message: "The global unit script with ID 1234 does not exist.", | ||
|
@@ -89,23 +90,22 @@ func TestResourceGlobalInitScriptCreate(t *testing.T) { | |
{ | ||
Method: "POST", | ||
Resource: "/api/2.0/global-init-scripts", | ||
ExpectedRequest: GlobalInitScriptPayload{ | ||
Name: "test", | ||
ContentBase64: "ZWNobyBoZWxsbw==", | ||
ExpectedRequest: compute.GlobalInitScriptCreateRequest{ | ||
Name: "test", | ||
Script: "ZWNobyBoZWxsbw==", | ||
}, | ||
Response: globalInitScriptCreateResponse{ | ||
ScriptID: "1234", | ||
Response: compute.CreateResponse{ | ||
ScriptId: "1234", | ||
}, | ||
}, | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/global-init-scripts/1234", | ||
Resource: "/api/2.0/global-init-scripts/1234?", | ||
ReuseRequest: true, | ||
Response: GlobalInitScriptInfo{ | ||
ScriptID: "1234", | ||
ContentBase64: "ZWNobyBoZWxsbw==", | ||
Position: 0, | ||
Name: "test", | ||
Response: compute.GlobalInitScriptDetailsWithContent{ | ||
ScriptId: "1234", | ||
Script: "ZWNobyBoZWxsbw==", | ||
Name: "test", | ||
}, | ||
}, | ||
}, | ||
|
@@ -156,24 +156,24 @@ func TestResourceGlobalInitScriptUpdate(t *testing.T) { | |
{ | ||
Method: "PATCH", | ||
Resource: "/api/2.0/global-init-scripts/1234", | ||
ExpectedRequest: GlobalInitScriptPayload{ | ||
Name: "test", | ||
Position: 0, | ||
ContentBase64: "ZWNobyBoZWxsbw==", | ||
ExpectedRequest: compute.GlobalInitScriptUpdateRequest{ | ||
Name: "test", | ||
Position: 0, | ||
Script: "ZWNobyBoZWxsbw==", | ||
}, | ||
Response: globalInitScriptCreateResponse{ | ||
ScriptID: "1234", | ||
Response: compute.CreateResponse{ | ||
ScriptId: "1234", | ||
}, | ||
}, | ||
{ | ||
Method: "GET", | ||
Resource: "/api/2.0/global-init-scripts/1234", | ||
Resource: "/api/2.0/global-init-scripts/1234?", | ||
ReuseRequest: true, | ||
Response: GlobalInitScriptInfo{ | ||
ScriptID: "1234", | ||
ContentBase64: "ZWNobyBoZWxsbw==", | ||
Position: 0, | ||
Name: "test", | ||
Response: compute.GlobalInitScriptDetailsWithContent{ | ||
ScriptId: "1234", | ||
Script: "ZWNobyBoZWxsbw==", | ||
Position: 0, | ||
Name: "test", | ||
}, | ||
}, | ||
}, | ||
|