Basic _changes test with since value
(t *testing.T, rt *rest.RestTester)
| 334 | |
| 335 | // Basic _changes test with since value |
| 336 | func postChangesSince(t *testing.T, rt *rest.RestTester) { |
| 337 | rt.CreateUser("bernard", []string{"PBS"}) |
| 338 | |
| 339 | cacheWaiter := rt.GetDatabase().NewDCPCachingCountWaiter(t) |
| 340 | |
| 341 | // Put several documents |
| 342 | response := rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs1-0000609", `{"channel":["PBS"]}`) |
| 343 | rest.RequireStatus(t, response, 201) |
| 344 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/samevbdiffchannel-0000609", `{"channel":["ABC"]}`) |
| 345 | rest.RequireStatus(t, response, 201) |
| 346 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/samevbdiffchannel-0000799", `{"channel":["PBS"]}`) |
| 347 | rest.RequireStatus(t, response, 201) |
| 348 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs2-0000609", `{"channel":["PBS"]}`) |
| 349 | rest.RequireStatus(t, response, 201) |
| 350 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs3-0000609", `{"channel":["PBS"]}`) |
| 351 | rest.RequireStatus(t, response, 201) |
| 352 | cacheWaiter.AddAndWait(5) |
| 353 | |
| 354 | changesJSON := `{"style":"all_docs", "heartbeat":300000, "feed":"longpoll", "limit":50, "since":"0"}` |
| 355 | changes := rt.PostChanges("/{{.keyspace}}/_changes", changesJSON, "bernard") |
| 356 | require.Len(t, changes.Results, 5) |
| 357 | |
| 358 | // Put several more documents, some to the same vbuckets |
| 359 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs1-0000799", `{"value":1, "channel":["PBS"]}`) |
| 360 | rest.RequireStatus(t, response, 201) |
| 361 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/abc1-0000609", `{"value":1, "channel":["ABC"]}`) |
| 362 | rest.RequireStatus(t, response, 201) |
| 363 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs2-0000799", `{"value":2, "channel":["PBS"]}`) |
| 364 | rest.RequireStatus(t, response, 201) |
| 365 | response = rt.SendAdminRequest("PUT", "/{{.keyspace}}/pbs4", `{"value":4, "channel":["PBS"]}`) |
| 366 | rest.RequireStatus(t, response, 201) |
| 367 | cacheWaiter.AddAndWait(4) |
| 368 | |
| 369 | changesJSON = fmt.Sprintf(`{"style":"all_docs", "heartbeat":300000, "feed":"longpoll", "limit":50, "since":"%s"}`, changes.Last_Seq) |
| 370 | changes = rt.PostChanges("/{{.keyspace}}/_changes", changesJSON, "bernard") |
| 371 | require.Len(t, changes.Results, 3) |
| 372 | } |
| 373 | |
| 374 | func TestPostChangesChannelFilterInteger(t *testing.T) { |
| 375 |
no test coverage detected