(t *testing.T)
| 424 | } |
| 425 | |
| 426 | func TestCVPopulationOnDocIDChanges(t *testing.T) { |
| 427 | rtConfig := RestTesterConfig{ |
| 428 | SyncFn: `function(doc) {channel(doc.channels)}`, |
| 429 | } |
| 430 | rt := NewRestTester(t, &rtConfig) |
| 431 | defer rt.Close() |
| 432 | collection, ctx := rt.GetSingleTestDatabaseCollection() |
| 433 | bucketUUID := rt.GetDatabase().EncodedSourceID |
| 434 | const DocID = "doc1" |
| 435 | |
| 436 | // activate channel cache |
| 437 | _ = rt.WaitForChanges(0, "/{{.keyspace}}/_changes", "", true) |
| 438 | |
| 439 | resp := rt.SendAdminRequest(http.MethodPut, "/{{.keyspace}}/"+DocID, `{"channels": ["ABC"]}`) |
| 440 | RequireStatus(t, resp, http.StatusCreated) |
| 441 | |
| 442 | require.NoError(t, collection.WaitForPendingChanges(base.TestCtx(t))) |
| 443 | |
| 444 | changes := rt.WaitForChanges(1, fmt.Sprintf(`/{{.keyspace}}/_changes?version_type=cv&filter=_doc_ids&doc_ids=%s`, DocID), "", true) |
| 445 | |
| 446 | fetchedDoc, _, err := collection.GetDocWithXattrs(ctx, DocID, db.DocUnmarshalCAS) |
| 447 | require.NoError(t, err) |
| 448 | |
| 449 | entryCV := db.GetChangeEntryCV(t, &changes.Results[0]) |
| 450 | assert.Equal(t, "doc1", changes.Results[0].ID) |
| 451 | assert.Equal(t, bucketUUID, entryCV.SourceID) |
| 452 | assert.Equal(t, fetchedDoc.Cas, entryCV.Value) |
| 453 | } |
| 454 | |
| 455 | // TestChangesVersionType tests the /_changes REST endpoint with different version_type parameters for each possible underlying feed type and HTTP method. |
| 456 | func TestChangesVersionType(t *testing.T) { |
nothing calls this directly
no test coverage detected