@@ -647,8 +647,8 @@ func TestStoreAttachments(t *testing.T) {
647
647
assert .NoError (t , err , "Couldn't update document" )
648
648
assert .NotEmpty (t , revId , "Document revision id should be generated" )
649
649
require .NotNil (t , doc )
650
- assert .NotEmpty (t , doc .Attachments , "Attachment metadata should be populated" )
651
- attachment := doc .Attachments ["att1.txt" ].(map [string ]interface {})
650
+ assert .NotEmpty (t , doc .Attachments () , "Attachment metadata should be populated" )
651
+ attachment := doc .Attachments () ["att1.txt" ].(map [string ]interface {})
652
652
assert .Equal (t , "text/plain" , attachment ["content_type" ])
653
653
assert .Equal (t , "sha1-crv3IVNxp3JXbP6bizTHt3GB3O0=" , attachment ["digest" ])
654
654
assert .Equal (t , 8 , attachment ["encoded_length" ])
@@ -665,8 +665,8 @@ func TestStoreAttachments(t *testing.T) {
665
665
assert .NoError (t , err , "Couldn't update document" )
666
666
assert .NotEmpty (t , revId , "Document revision id should be generated" )
667
667
require .NotNil (t , doc )
668
- assert .NotEmpty (t , doc .Attachments , "Attachment metadata should be populated" )
669
- attachment = doc .Attachments ["att1.txt" ].(map [string ]interface {})
668
+ assert .NotEmpty (t , doc .Attachments () , "Attachment metadata should be populated" )
669
+ attachment = doc .Attachments () ["att1.txt" ].(map [string ]interface {})
670
670
assert .Equal (t , "text/plain" , attachment ["content_type" ])
671
671
assert .Equal (t , "sha1-crv3IVNxp3JXbP6bizTHt3GB3O0=" , attachment ["digest" ])
672
672
assert .Equal (t , 8 , attachment ["encoded_length" ])
@@ -693,7 +693,7 @@ func TestStoreAttachments(t *testing.T) {
693
693
"stub" : true ,
694
694
"ver" : 2 ,
695
695
},
696
- }, doc .Attachments )
696
+ }, doc .Attachments () )
697
697
698
698
// Simulate error scenario for attachment without data; stub is not provided; If the data is
699
699
// empty in attachment, the attachment must be a stub that repeats a parent attachment.
@@ -778,7 +778,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
778
778
require .NoError (t , err )
779
779
780
780
// Fetch the raw doc sync data from the bucket to make sure we didn't store pre-2.5 attachments in syncData.
781
- assert .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).Attachments )
781
+ assert .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).AttachmentsPre4dot0 )
782
782
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
783
783
return db , ctx
784
784
}
@@ -809,7 +809,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
809
809
810
810
// Fetch the raw doc sync data from the bucket to see if this read-only op unintentionally persisted the migrated meta.
811
811
syncData := GetRawSyncXattr (t , collection .dataStore , docKey )
812
- assert .Empty (t , syncData .Attachments )
812
+ assert .Empty (t , syncData .AttachmentsPre4dot0 )
813
813
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
814
814
})
815
815
@@ -839,7 +839,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
839
839
840
840
// Fetch the raw doc sync data from the bucket to see if this read-only op unintentionally persisted the migrated meta.
841
841
syncData := GetRawSyncXattr (t , collection .dataStore , docKey )
842
- assert .Empty (t , syncData .Attachments )
842
+ assert .Empty (t , syncData .AttachmentsPre4dot0 )
843
843
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
844
844
})
845
845
@@ -881,7 +881,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
881
881
require .NotContains (t , body1 , BodyAttachments )
882
882
883
883
// Fetch the raw doc sync data from the bucket to make sure we actually moved attachments on write.
884
- require .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).Attachments )
884
+ require .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).AttachmentsPre4dot0 )
885
885
require .Equal (t , AttachmentMap {
886
886
"hello.txt" : {
887
887
Digest : "sha1-Kq5sNclPz7QV2+lfQIuc6R7oRu0=" ,
@@ -906,7 +906,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
906
906
907
907
// Fetch the raw doc sync data from the bucket to see if this read-only op unintentionally persisted the migrated meta.
908
908
syncData := GetRawSyncXattr (t , collection .dataStore , docKey )
909
- require .Empty (t , syncData .Attachments )
909
+ require .Empty (t , syncData .AttachmentsPre4dot0 )
910
910
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
911
911
912
912
byeTxtData , err := base64 .StdEncoding .DecodeString ("Z29vZGJ5ZSBjcnVlbCB3b3JsZA==" )
@@ -946,7 +946,7 @@ func TestMigrateBodyAttachments(t *testing.T) {
946
946
require .NotContains (t , body1 , BodyAttachments )
947
947
948
948
// Fetch the raw doc sync data from the bucket to make sure we actually moved attachments on write.
949
- require .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).Attachments )
949
+ require .Empty (t , GetRawSyncXattr (t , collection .dataStore , docKey ).AttachmentsPre4dot0 )
950
950
require .Equal (t , AttachmentMap {
951
951
"hello.txt" : {
952
952
Digest : "sha1-Kq5sNclPz7QV2+lfQIuc6R7oRu0=" ,
@@ -1066,7 +1066,7 @@ func TestMigrateBodyAttachmentsMerge(t *testing.T) {
1066
1066
"revpos" : float64 (1 ),
1067
1067
"stub" : true ,
1068
1068
},
1069
- }, GetRawSyncXattr (t , collection .dataStore , docKey ).Attachments )
1069
+ }, GetRawSyncXattr (t , collection .dataStore , docKey ).AttachmentsPre4dot0 )
1070
1070
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
1071
1071
1072
1072
rev , err := collection .GetRev (ctx , docKey , "3-a" , true , nil )
@@ -1102,7 +1102,7 @@ func TestMigrateBodyAttachmentsMerge(t *testing.T) {
1102
1102
"revpos" : float64 (1 ),
1103
1103
"stub" : true ,
1104
1104
},
1105
- }, GetRawSyncXattr (t , collection .dataStore , docKey ).Attachments )
1105
+ }, GetRawSyncXattr (t , collection .dataStore , docKey ).AttachmentsPre4dot0 )
1106
1106
base .RequireXattrNotFound (t , collection .dataStore , docKey , base .GlobalXattrName )
1107
1107
}
1108
1108
0 commit comments