(t *testing.T)
| 3603 | } |
| 3604 | |
| 3605 | func TestIncreasingRecentSequences(t *testing.T) { |
| 3606 | var db *Database |
| 3607 | var enableCallback bool |
| 3608 | var body Body |
| 3609 | var revid string |
| 3610 | var ctx context.Context |
| 3611 | |
| 3612 | writeUpdateCallback := func(key string) { |
| 3613 | if enableCallback { |
| 3614 | enableCallback = false |
| 3615 | // Write a doc |
| 3616 | collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, t, db) |
| 3617 | _, _, err := collection.PutExistingRevWithBody(ctx, "doc1", body, []string{"2-abc", revid}, true, ExistingVersionWithUpdateToHLV) |
| 3618 | assert.NoError(t, err) |
| 3619 | } |
| 3620 | } |
| 3621 | |
| 3622 | db, ctx = setupTestLeakyDBWithCacheOptions(t, DefaultCacheOptions(), base.LeakyBucketConfig{UpdateCallback: writeUpdateCallback}) |
| 3623 | defer db.Close(ctx) |
| 3624 | collection, ctx := GetSingleDatabaseCollectionWithUser(ctx, t, db) |
| 3625 | |
| 3626 | err := json.Unmarshal([]byte(`{"prop": "value"}`), &body) |
| 3627 | assert.NoError(t, err) |
| 3628 | |
| 3629 | // Create a doc |
| 3630 | revid, _, err = collection.Put(ctx, "doc1", body) |
| 3631 | assert.NoError(t, err) |
| 3632 | |
| 3633 | enableCallback = true |
| 3634 | doc, _, err := collection.PutExistingRevWithBody(ctx, "doc1", body, []string{"3-abc", "2-abc", revid}, true, ExistingVersionWithUpdateToHLV) |
| 3635 | assert.NoError(t, err) |
| 3636 | |
| 3637 | assert.True(t, sort.IsSorted(base.SortedUint64Slice(doc.SyncData.RecentSequences))) |
| 3638 | } |
| 3639 | |
| 3640 | func TestRepairUnorderedRecentSequences(t *testing.T) { |
| 3641 | if base.TestUseXattrs() { |
nothing calls this directly
no test coverage detected