@@ -56,79 +56,75 @@ describe
5656 }
5757 ) ;
5858
59- test (
60- 'should upsert a function successfully' ,
61- async function ( {
62- serverTestContext,
63- metadataBucket,
64- metadataCollection,
65- testFnName,
66- } ) {
67- const bucketBindings = [
68- new EventingFunctionBucketBinding ( {
69- name : new EventingFunctionKeyspace ( {
70- bucket : serverTestContext . bucket . name ,
71- scope : serverTestContext . scope . name ,
72- collection : serverTestContext . collection . name ,
73- } ) ,
74- alias : 'bucketbinding1' ,
75- access : EventingFunctionBucketAccess . ReadWrite ,
59+ test ( 'should upsert a function successfully' , async function ( {
60+ serverTestContext,
61+ metadataBucket,
62+ metadataCollection,
63+ testFnName,
64+ } ) {
65+ const bucketBindings = [
66+ new EventingFunctionBucketBinding ( {
67+ name : new EventingFunctionKeyspace ( {
68+ bucket : serverTestContext . bucket . name ,
69+ scope : serverTestContext . scope . name ,
70+ collection : serverTestContext . collection . name ,
7671 } ) ,
77- ] ;
78-
79- const urlBindings = [
80- new EventingFunctionUrlBinding ( {
81- hostname : 'http://127.0.0.1' ,
82- alias : 'urlbinding1' ,
83- auth : new EventingFunctionUrlAuthBasic ( {
84- username : 'username ' ,
85- password : 'password ' ,
86- } ) ,
87- allowCookies : false ,
88- validateSslCertificate : false ,
72+ alias : 'bucketbinding1' ,
73+ access : EventingFunctionBucketAccess . ReadWrite ,
74+ } ) ,
75+ ] ;
76+
77+ const urlBindings = [
78+ new EventingFunctionUrlBinding ( {
79+ hostname : 'http://127.0.0.1 ' ,
80+ alias : 'urlbinding1 ' ,
81+ auth : new EventingFunctionUrlAuthBasic ( {
82+ username : 'username' ,
83+ password : 'password' ,
8984 } ) ,
90- ] ;
91-
92- const constantBindings = [
93- {
94- alias : 'someconstant' ,
95- literal : 'someliteral' ,
96- } ,
97- ] ;
98-
99- // Give time to the eventing service to acknowledge the new buckets
100- await sleep ( 2000 ) ;
101-
102- const metadataKeyspace = new EventingFunctionKeyspace ( {
103- bucket : metadataBucket ,
104- scope : Scope . DEFAULT_NAME ,
105- collection : metadataCollection ,
106- } ) ;
107-
108- const sourceKeyspace = new EventingFunctionKeyspace ( {
109- bucket : serverTestContext . bucket . name ,
110- scope : serverTestContext . scope . name ,
111- collection : serverTestContext . collection . name ,
112- } ) ;
113-
114- const code = `
85+ allowCookies : false ,
86+ validateSslCertificate : false ,
87+ } ) ,
88+ ] ;
89+
90+ const constantBindings = [
91+ {
92+ alias : 'someconstant' ,
93+ literal : 'someliteral' ,
94+ } ,
95+ ] ;
96+
97+ // Give time to the eventing service to acknowledge the new buckets
98+ await sleep ( 2000 ) ;
99+
100+ const metadataKeyspace = new EventingFunctionKeyspace ( {
101+ bucket : metadataBucket ,
102+ scope : Scope . DEFAULT_NAME ,
103+ collection : metadataCollection ,
104+ } ) ;
105+
106+ const sourceKeyspace = new EventingFunctionKeyspace ( {
107+ bucket : serverTestContext . bucket . name ,
108+ scope : serverTestContext . scope . name ,
109+ collection : serverTestContext . collection . name ,
110+ } ) ;
111+
112+ const code = `
115113 function OnUpdate(doc, meta) {
116114 log('data:', doc, meta)
117115 }
118116 ` ;
119117
120- await serverTestContext . scope . eventingFunctions ( ) . upsertFunction ( {
121- name : testFnName ,
122- code,
123- bucketBindings,
124- urlBindings,
125- constantBindings,
126- metadataKeyspace,
127- sourceKeyspace,
128- } ) ;
129- } ,
130- { timeout : 15_000 }
131- ) ;
118+ await serverTestContext . scope . eventingFunctions ( ) . upsertFunction ( {
119+ name : testFnName ,
120+ code,
121+ bucketBindings,
122+ urlBindings,
123+ constantBindings,
124+ metadataKeyspace,
125+ sourceKeyspace,
126+ } ) ;
127+ } ) ;
132128
133129 test ( 'should get all event functions' , async function ( {
134130 expect,
0 commit comments