(t *testing.T)
| 2227 | } |
| 2228 | |
| 2229 | func TestRevCacheOnDemandImportNoCache(t *testing.T) { |
| 2230 | base.SkipImportTestsIfNotEnabled(t) |
| 2231 | |
| 2232 | db, ctx := setupTestDB(t) |
| 2233 | defer db.Close(ctx) |
| 2234 | collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, t, db) |
| 2235 | |
| 2236 | docID := "doc1" |
| 2237 | revID1, _, err := collection.Put(ctx, docID, Body{"foo": "bar"}) |
| 2238 | require.NoError(t, err) |
| 2239 | |
| 2240 | _, exists := collection.revisionCache.Peek(ctx, docID, revID1) |
| 2241 | require.True(t, exists) |
| 2242 | |
| 2243 | require.NoError(t, collection.dataStore.Set(docID, 0, nil, []byte(`{"foo": "baz"}`))) |
| 2244 | |
| 2245 | doc, err := collection.GetDocument(ctx, docID, DocUnmarshalSync) |
| 2246 | require.NoError(t, err) |
| 2247 | require.Equal(t, Body{"foo": "baz"}, doc.Body(ctx)) |
| 2248 | |
| 2249 | // rev1 still exists in cache but not on server |
| 2250 | _, exists = collection.revisionCache.Peek(ctx, docID, revID1) |
| 2251 | require.True(t, exists) |
| 2252 | |
| 2253 | // rev2 is not in cache but is on server |
| 2254 | _, exists = collection.revisionCache.Peek(ctx, docID, doc.GetRevTreeID()) |
| 2255 | require.False(t, exists) |
| 2256 | } |
| 2257 | |
| 2258 | func TestFetchBackupWithDeletedFlag(t *testing.T) { |
| 2259 | db, ctx := SetupTestDBWithOptions(t, DatabaseContextOptions{ |
nothing calls this directly
no test coverage detected