@@ -73,6 +73,42 @@ func TestImportFeed(t *testing.T) {
73
73
assert .Equal (t , int64 (1 ), rt .GetDatabase ().DbStats .SharedBucketImportStats .ImportCount .Value ())
74
74
}
75
75
76
+ func TestImportFeedWithRecursiveSyncFunction (t * testing.T ) {
77
+
78
+ base .SkipImportTestsIfNotEnabled (t )
79
+
80
+ rtConfig := rest.RestTesterConfig {
81
+ SyncFn : `function access(doc) { access("foo", "bar"); }` ,
82
+ AutoImport : base .Ptr (true ),
83
+ }
84
+
85
+ rt := rest .NewRestTester (t , & rtConfig )
86
+ defer rt .Close ()
87
+ dataStore := rt .GetSingleDataStore ()
88
+
89
+ base .SetUpTestLogging (t , base .LevelDebug , base .KeyImport , base .KeyCRUD )
90
+
91
+ // Create doc via the SDK
92
+ mobileKey := t .Name ()
93
+ mobileBody := make (map [string ]interface {})
94
+ mobileBody ["channels" ] = "ABC"
95
+ _ , err := dataStore .Add (mobileKey , 0 , mobileBody )
96
+ assert .NoError (t , err , "Error writing SDK doc" )
97
+
98
+ // Wait for import
99
+ err = rt .WaitForCondition (func () bool {
100
+ return rt .GetDatabase ().DbStats .SharedBucketImportStats .ImportErrorCount .Value () == 1
101
+ })
102
+ require .NoError (t , err )
103
+
104
+ // Attempt to get the document via Sync Gateway.
105
+ response := rt .SendAdminRequest ("GET" , "/{{.keyspace}}/" + mobileKey , "" )
106
+ assert .Equal (t , 404 , response .Code )
107
+
108
+ // Verify this didn't trigger an on-demand import
109
+ assert .Equal (t , int64 (0 ), rt .GetDatabase ().DbStats .SharedBucketImportStats .ImportCount .Value ())
110
+ }
111
+
76
112
// Test import of an SDK delete.
77
113
func TestXattrImportOldDoc (t * testing.T ) {
78
114
rtConfig := rest.RestTesterConfig {
0 commit comments