(t *testing.T)
| 419 | } |
| 420 | |
| 421 | func TestPutDBBytesRead(t *testing.T) { |
| 422 | if base.UnitTestUrlIsWalrus() { |
| 423 | t.Skip("Test only works with CBS because of use fo RBAC roles") |
| 424 | } |
| 425 | ctx := base.TestCtx(t) |
| 426 | tb := base.GetTestBucket(t) |
| 427 | defer tb.Close(ctx) |
| 428 | |
| 429 | rt := NewRestTester(t, &RestTesterConfig{CustomTestBucket: tb.NoCloseClone(), AdminInterfaceAuthentication: true}) |
| 430 | defer rt.Close() |
| 431 | SGWorBFArole := MobileSyncGatewayRole.RoleName |
| 432 | |
| 433 | eps, httpClient, err := rt.ServerContext().ObtainManagementEndpointsAndHTTPClient() |
| 434 | require.NoError(t, err) |
| 435 | |
| 436 | MakeUser(t, httpClient, eps[0], "MobileSyncGatewayUser", "password", []string{fmt.Sprintf("%s[%s]", SGWorBFArole, rt.Bucket().GetName())}) |
| 437 | defer DeleteUser(t, httpClient, eps[0], "MobileSyncGatewayUser") |
| 438 | |
| 439 | input := fmt.Sprintf( |
| 440 | `{"bucket": "%s", "num_index_replicas": 0, "enable_shared_bucket_access": %t, "use_views": %t,"username": "%s", "password":"%s"}`, |
| 441 | tb.GetName(), base.TestUseXattrs(), base.TestsDisableGSI(), base.TestClusterUsername(), base.TestClusterPassword(), |
| 442 | ) |
| 443 | |
| 444 | db := rt.GetDatabase() // get database before we add a new one |
| 445 | |
| 446 | resp := rt.SendAdminRequestWithAuth(http.MethodPut, "/db1/", input, "MobileSyncGatewayUser", "password") |
| 447 | RequireStatus(t, resp, http.StatusCreated) |
| 448 | |
| 449 | // assert the stat hasn't increased (admin request doesn't effect count) |
| 450 | base.RequireWaitForStat(t, func() int64 { |
| 451 | return db.DbStats.DatabaseStats.PublicRestBytesRead.Value() |
| 452 | }, 0) |
| 453 | |
| 454 | } |
| 455 | |
| 456 | func TestOfflineDBBytesRead(t *testing.T) { |
| 457 | rt := NewRestTester(t, nil) |
nothing calls this directly
no test coverage detected