(t *testing.T)
| 175 | } |
| 176 | |
| 177 | func TestServerlessGoCBConnectionString(t *testing.T) { |
| 178 | if base.UnitTestUrlIsWalrus() { |
| 179 | t.Skip("This test only works against Couchbase Server due to testing gocb connection strings") |
| 180 | } |
| 181 | tests := []struct { |
| 182 | name string |
| 183 | expectedConnstrQuery string |
| 184 | specKvConn string |
| 185 | kvConnCount int |
| 186 | }{ |
| 187 | { |
| 188 | name: "serverless connection", |
| 189 | expectedConnstrQuery: "?dcp_buffer_size=1048576&idle_http_connection_timeout=90000&kv_buffer_size=1048576&kv_pool_size=1&max_idle_http_connections=64000&max_perhost_idle_http_connections=256", |
| 190 | kvConnCount: 1, |
| 191 | }, |
| 192 | { |
| 193 | name: "serverless connection with kv pool specified", |
| 194 | specKvConn: "?idle_http_connection_timeout=90000&kv_pool_size=3&max_idle_http_connections=64000&max_perhost_idle_http_connections=256", |
| 195 | expectedConnstrQuery: "?dcp_buffer_size=1048576&idle_http_connection_timeout=90000&kv_buffer_size=1048576&kv_pool_size=3&max_idle_http_connections=64000&max_perhost_idle_http_connections=256", |
| 196 | kvConnCount: 3, |
| 197 | }, |
| 198 | } |
| 199 | for _, test := range tests { |
| 200 | t.Run(test.name, func(t *testing.T) { |
| 201 | t.Skip("here") |
| 202 | ctx := base.TestCtx(t) |
| 203 | tb := base.GetTestBucket(t) |
| 204 | defer tb.Close(ctx) |
| 205 | bucketServer := tb.BucketSpec.Server |
| 206 | expectedServer := bucketServer + test.expectedConnstrQuery |
| 207 | |
| 208 | if test.specKvConn != "" { |
| 209 | tb.BucketSpec.Server = bucketServer + "?kv_pool_size=3" |
| 210 | } |
| 211 | |
| 212 | rt := NewRestTester(t, &RestTesterConfig{CustomTestBucket: tb.NoCloseClone(), PersistentConfig: true, serverless: true}) |
| 213 | defer rt.Close() |
| 214 | sc := rt.ServerContext() |
| 215 | require.True(t, sc.Config.IsServerless()) |
| 216 | |
| 217 | resp := rt.SendAdminRequest(http.MethodPut, "/db/", fmt.Sprintf(`{"bucket": "%s", "use_views": %t, "num_index_replicas": 0}`, |
| 218 | tb.GetName(), base.TestsDisableGSI())) |
| 219 | RequireStatus(t, resp, http.StatusCreated) |
| 220 | |
| 221 | assert.Equal(t, expectedServer, sc.getBucketSpec("db").Server) |
| 222 | }) |
| 223 | } |
| 224 | |
| 225 | } |
| 226 | |
| 227 | func TestServerlessUnsupportedOptions(t *testing.T) { |
| 228 | RequireBucketSpecificCredentials(t) |
nothing calls this directly
no test coverage detected