(t *testing.T)
| 387 | } |
| 388 | |
| 389 | func TestBytesReadGzipRequest(t *testing.T) { |
| 390 | // Need default collection as request below doesn't work with {{.keyspace}} |
| 391 | rt := NewRestTesterDefaultCollection(t, &RestTesterConfig{ |
| 392 | GuestEnabled: true, |
| 393 | }) |
| 394 | defer rt.Close() |
| 395 | |
| 396 | rt.CreateUser("alice", []string{"ABC"}) |
| 397 | input := `{"channel":["ABC"]}` |
| 398 | |
| 399 | var buf bytes.Buffer |
| 400 | gz := gzip.NewWriter(&buf) |
| 401 | _, err := gz.Write([]byte(input)) |
| 402 | require.NoError(t, err) |
| 403 | err = gz.Close() |
| 404 | require.NoError(t, err) |
| 405 | |
| 406 | inputBytes := []byte(input) |
| 407 | |
| 408 | // {{.keyspace}} isn't supported so use default collection |
| 409 | rq := Request("PUT", "/db/doc", buf.String()) |
| 410 | rq.Header.Set("Content-Encoding", "gzip") |
| 411 | resp := rt.Send(rq) |
| 412 | RequireStatus(t, resp, http.StatusCreated) |
| 413 | |
| 414 | base.RequireWaitForStat(t, func() int64 { |
| 415 | fmt.Println(rt.GetDatabase().DbStats.DatabaseStats.PublicRestBytesRead.Value()) |
| 416 | return rt.GetDatabase().DbStats.DatabaseStats.PublicRestBytesRead.Value() |
| 417 | }, int64(len(inputBytes))) |
| 418 | |
| 419 | } |
| 420 | |
| 421 | func TestPutDBBytesRead(t *testing.T) { |
| 422 | if base.UnitTestUrlIsWalrus() { |
nothing calls this directly
no test coverage detected