(t *testing.T)
| 647 | } |
| 648 | |
| 649 | func TestAttachmentProcessError(t *testing.T) { |
| 650 | if base.UnitTestUrlIsWalrus() { |
| 651 | t.Skip("This test only works against Couchbase Server") |
| 652 | } |
| 653 | |
| 654 | b := base.GetTestBucket(t).LeakyBucketClone(base.LeakyBucketConfig{ |
| 655 | SetXattrCallback: func(key string) error { |
| 656 | return fmt.Errorf("some error") |
| 657 | }, |
| 658 | }) |
| 659 | defer b.Close(base.TestCtx(t)) |
| 660 | |
| 661 | testDB1, ctx1 := setupTestDBForBucketDefaultCollection(t, b) |
| 662 | defer testDB1.Close(ctx1) |
| 663 | |
| 664 | collection, ctx1 := GetSingleDatabaseCollectionWithUser(ctx1, t, testDB1) |
| 665 | CreateLegacyAttachmentDoc(t, ctx1, collection, "docID", []byte("{}"), "attKey", []byte("{}")) |
| 666 | |
| 667 | err := testDB1.AttachmentCompactionManager.Start(ctx1, map[string]interface{}{"database": testDB1}) |
| 668 | assert.NoError(t, err) |
| 669 | |
| 670 | var status AttachmentManagerResponse |
| 671 | err = WaitForConditionWithOptions(t, func() bool { |
| 672 | rawStatus, err := testDB1.AttachmentCompactionManager.GetStatus(ctx1) |
| 673 | assert.NoError(t, err) |
| 674 | err = base.JSONUnmarshal(rawStatus, &status) |
| 675 | assert.NoError(t, err) |
| 676 | |
| 677 | if status.State == BackgroundProcessStateError { |
| 678 | return true |
| 679 | } |
| 680 | |
| 681 | return false |
| 682 | }, 200, 1000) |
| 683 | require.NoError(t, err) |
| 684 | |
| 685 | assert.Equal(t, status.State, BackgroundProcessStateError) |
| 686 | } |
| 687 | |
| 688 | func TestAttachmentDifferentVBUUIDsBetweenPhases(t *testing.T) { |
| 689 | if base.UnitTestUrlIsWalrus() { |
nothing calls this directly
no test coverage detected