From 60e24017354851f5ebac453ab4ac2cfd933a117a Mon Sep 17 00:00:00 2001 From: Kevin Su Date: Thu, 29 Sep 2022 02:12:49 +0800 Subject: [PATCH] Update snowflake endpoints (#286) * Update snowflake endpoint Signed-off-by: Kevin Su * update endpoint Signed-off-by: Kevin Su * update endpoint Signed-off-by: Kevin Su * update endpoint Signed-off-by: Kevin Su * update endpoint Signed-off-by: Kevin Su * update endpoint Signed-off-by: Kevin Su * update tests Signed-off-by: Kevin Su * fix tests Signed-off-by: Kevin Su Signed-off-by: Kevin Su --- .../go/tasks/plugins/webapi/snowflake/integration_test.go | 6 +++--- flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go | 4 ++-- .../go/tasks/plugins/webapi/snowflake/plugin_test.go | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/flyteplugins/go/tasks/plugins/webapi/snowflake/integration_test.go b/flyteplugins/go/tasks/plugins/webapi/snowflake/integration_test.go index b003433fb..3ee4048c3 100644 --- a/flyteplugins/go/tasks/plugins/webapi/snowflake/integration_test.go +++ b/flyteplugins/go/tasks/plugins/webapi/snowflake/integration_test.go @@ -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", @@ -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", @@ -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 } diff --git a/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go b/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go index bdbf8b565..c216fc8bf 100644 --- a/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go +++ b/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin.go @@ -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 diff --git a/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin_test.go b/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin_test.go index 1c9e56d09..16a3ec4ae 100644 --- a/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin_test.go +++ b/flyteplugins/go/tasks/plugins/webapi/snowflake/plugin_test.go @@ -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,