@@ -74,32 +74,24 @@ func TestImportFeed(t *testing.T) {
74
74
}
75
75
76
76
func TestImportFeedWithRecursiveSyncFunction (t * testing.T ) {
77
-
78
77
base .SkipImportTestsIfNotEnabled (t )
79
78
80
- rtConfig := rest.RestTesterConfig {
79
+ base .SetUpTestLogging (t , base .LevelDebug , base .KeyImport , base .KeyCRUD )
80
+
81
+ rt := rest .NewRestTester (t , & rest.RestTesterConfig {
81
82
SyncFn : `function access(doc) { access("foo", "bar"); }` ,
82
83
AutoImport : base .Ptr (true ),
83
- }
84
-
85
- rt := rest .NewRestTester (t , & rtConfig )
84
+ })
86
85
defer rt .Close ()
87
- dataStore := rt .GetSingleDataStore ()
88
-
89
- base .SetUpTestLogging (t , base .LevelDebug , base .KeyImport , base .KeyCRUD )
90
86
91
87
// Create doc via the SDK
92
88
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" )
89
+ mobileBody := map [string ]any { "channels" : "ABC" }
90
+ added , err := rt . GetSingleDataStore (). Add ( mobileKey , 0 , mobileBody )
91
+ require . NoError ( t , err , "Error writing SDK doc" )
92
+ require . True (t , added )
97
93
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 )
94
+ base .RequireWaitForStat (t , rt .GetDatabase ().DbStats .SharedBucketImportStats .ImportErrorCount .Value , 1 )
103
95
104
96
// Attempt to get the document via Sync Gateway.
105
97
response := rt .SendAdminRequest ("GET" , "/{{.keyspace}}/" + mobileKey , "" )
0 commit comments