Skip to content
This repository has been archived by the owner on Oct 9, 2023. It is now read-only.

Commit

Permalink
Update snowflake endpoints (#286)
Browse files Browse the repository at this point in the history
* Update snowflake endpoint

Signed-off-by: Kevin Su <[email protected]>

* update endpoint

Signed-off-by: Kevin Su <[email protected]>

* update endpoint

Signed-off-by: Kevin Su <[email protected]>

* update endpoint

Signed-off-by: Kevin Su <[email protected]>

* update endpoint

Signed-off-by: Kevin Su <[email protected]>

* update endpoint

Signed-off-by: Kevin Su <[email protected]>

* update tests

Signed-off-by: Kevin Su <[email protected]>

* fix tests

Signed-off-by: Kevin Su <[email protected]>

Signed-off-by: Kevin Su <[email protected]>
  • Loading branch information
pingsutw authored Sep 28, 2022
1 parent 1637021 commit eed7326
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions go/tasks/plugins/webapi/snowflake/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func TestEndToEnd(t *testing.T) {
func newFakeSnowflakeServer() *httptest.Server {
statementHandle := "019e7546-0000-278c-0000-40f10001a082"
return httptest.NewServer(http.HandlerFunc(func(writer http.ResponseWriter, request *http.Request) {
if request.URL.Path == "/api/statements" && request.Method == "POST" {
if request.URL.Path == "/api/v2/statements" && request.Method == "POST" {
writer.WriteHeader(202)
bytes := []byte(fmt.Sprintf(`{
"statementHandle": "%v",
Expand All @@ -75,7 +75,7 @@ func newFakeSnowflakeServer() *httptest.Server {
return
}

if request.URL.Path == "/api/statements/"+statementHandle && request.Method == "GET" {
if request.URL.Path == "/api/v2/statements/"+statementHandle && request.Method == "GET" {
writer.WriteHeader(200)
bytes := []byte(fmt.Sprintf(`{
"statementHandle": "%v",
Expand All @@ -85,7 +85,7 @@ func newFakeSnowflakeServer() *httptest.Server {
return
}

if request.URL.Path == "/api/statements/"+statementHandle+"/cancel" && request.Method == "POST" {
if request.URL.Path == "/api/v2/statements/"+statementHandle+"/cancel" && request.Method == "POST" {
writer.WriteHeader(200)
return
}
Expand Down
4 changes: 2 additions & 2 deletions go/tasks/plugins/webapi/snowflake/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ func buildRequest(method string, queryInfo QueryInfo, snowflakeEndpoint string,
var snowflakeURL string
// for mocking/testing purposes
if snowflakeEndpoint == "" {
snowflakeURL = "https://" + account + ".snowflakecomputing.com/api/statements"
snowflakeURL = "https://" + account + ".snowflakecomputing.com/api/v2/statements"
} else {
snowflakeURL = snowflakeEndpoint + "/api/statements"
snowflakeURL = snowflakeEndpoint + "/api/v2/statements"
}

var data []byte
Expand Down
2 changes: 1 addition & 1 deletion go/tasks/plugins/webapi/snowflake/plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestBuildRequest(t *testing.T) {
token := "test-token"
queryID := "019e70eb-0000-278b-0000-40f100012b1a"
snowflakeEndpoint := ""
snowflakeURL := "https://" + account + ".snowflakecomputing.com/api/statements"
snowflakeURL := "https://" + account + ".snowflakecomputing.com/api/v2/statements"
t.Run("build http request for submitting a snowflake query", func(t *testing.T) {
queryInfo := QueryInfo{
Account: account,
Expand Down

0 comments on commit eed7326

Please sign in to comment.