()
| 120 | } |
| 121 | |
| 122 | func testingMaxComputeConfig() *gomaxcompute.Config { |
| 123 | endpoint := test.GetEnv("SQLFLOW_TEST_DB_MAXCOMPUTE_ENDPOINT", "http://service-maxcompute.com/api") |
| 124 | urlAndArgs := strings.Split(endpoint, "?") |
| 125 | // accept format like http://service-maxcompute.com/api |
| 126 | // if got service-maxcompute.com/api?curr_project=xxxx&scheme=http, reformat to http://service-maxcompute.com/api |
| 127 | if len(urlAndArgs) == 2 { |
| 128 | if !(strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://")) { |
| 129 | argList := strings.Split(urlAndArgs[1], "&") |
| 130 | for _, kv := range argList { |
| 131 | kvList := strings.Split(kv, "=") |
| 132 | if len(kvList) == 2 && kvList[0] == "scheme" { |
| 133 | endpoint = fmt.Sprintf("%s://%s", kvList[1], urlAndArgs[0]) |
| 134 | break |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | } else { |
| 139 | if !(strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://")) { |
| 140 | log.Fatal("SQLFLOW_TEST_DB_MAXCOMPUTE_ENDPOINT must be the form of http://service-maxcompute.com/api or service-maxcompute.com/api?scheme=http") |
| 141 | } |
| 142 | } |
| 143 | return &gomaxcompute.Config{ |
| 144 | AccessID: test.GetEnv("SQLFLOW_TEST_DB_MAXCOMPUTE_AK", "test"), |
| 145 | AccessKey: test.GetEnv("SQLFLOW_TEST_DB_MAXCOMPUTE_SK", "test"), |
| 146 | Project: test.GetEnv("SQLFLOW_TEST_DB_MAXCOMPUTE_PROJECT", "test"), |
| 147 | Endpoint: endpoint, |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | func testingMaxComputeURL() string { |
| 152 | return fmt.Sprintf("maxcompute://%s", testingMaxComputeConfig().FormatDSN()) |
no test coverage detected