@@ -36,7 +36,7 @@ const http_connect_path = path.join(tmp_connect, http_connect_filename);
36
36
//content of connect file, will be written to a file in before()
37
37
const http_connect = {
38
38
agent_request_object : { "host" : "localhost" , "port" : 9998 , "timeout" : 1500 } ,
39
- request_options_object : { "auth" : "amit:passw" , "timeout" : 1500 } ,
39
+ request_options_object : { "auth" : "amit:passw" , "timeout" : 1500 , "path" : "/default" } ,
40
40
notification_protocol : 'http' ,
41
41
name : 'http_notif'
42
42
} ;
@@ -54,6 +54,7 @@ let expected_bucket;
54
54
let expected_event_name ;
55
55
let expected_key ;
56
56
let expected_eTag ;
57
+ let expected_url ;
57
58
58
59
// eslint-disable-next-line max-lines-per-function
59
60
mocha . describe ( 'notifications' , function ( ) {
@@ -91,6 +92,7 @@ mocha.describe('notifications', function() {
91
92
const notif = JSON . parse ( input . toString ( ) ) ;
92
93
93
94
if ( notif !== "test notification" ) {
95
+ assert . strictEqual ( req . url , expected_url ) ;
94
96
assert . strictEqual ( notif . Records [ 0 ] . s3 . bucket . name , expected_bucket , 'wrong bucket name in notification' ) ;
95
97
assert . strictEqual ( notif . Records [ 0 ] . eventName , expected_event_name , 'wrong event name in notification' ) ;
96
98
assert . strictEqual ( notif . Records [ 0 ] . s3 . object . key , expected_key , 'wrong key in notification' ) ;
@@ -224,18 +226,47 @@ mocha.describe('notifications', function() {
224
226
} ) ;
225
227
} ) ;
226
228
229
+ mocha . it ( 'override connection' , async ( ) => {
230
+ await s3 . putBucketNotificationConfiguration ( {
231
+ Bucket : bucket ,
232
+ NotificationConfiguration : {
233
+ TopicConfigurations : [ {
234
+ "Id" : "system_test_http_no_event_override" ,
235
+ "TopicArn" : http_connect_filename + "?" + JSON . stringify ( {
236
+ request_options_object : { path : "/override" }
237
+ } ) ,
238
+ } ] ,
239
+ } ,
240
+ } ) ;
241
+
242
+ const res = await s3 . putObject ( {
243
+ Bucket : bucket ,
244
+ Key : 'f1' ,
245
+ Body : 'this is the body' ,
246
+ } ) ;
247
+
248
+ await notify_await_result ( {
249
+ bucket_name : bucket ,
250
+ event_name : 'ObjectCreated:Put' ,
251
+ key : "f1" ,
252
+ etag : res . ETag ,
253
+ path : "/override"
254
+ } ) ;
255
+ } ) ;
256
+
227
257
} ) ;
228
258
229
259
} ) ;
230
260
231
261
const step_wait = 100 ;
232
- async function notify_await_result ( { bucket_name, event_name, etag, key, timeout = undefined } ) {
262
+ async function notify_await_result ( { bucket_name, event_name, etag, key, url = "/default" , timeout = undefined } ) {
233
263
234
264
//remember expected result here so server could compare it to actual result later
235
265
expected_bucket = bucket_name ;
236
266
expected_event_name = event_name ;
237
267
expected_eTag = etag ;
238
268
expected_key = key ;
269
+ expected_url = url ;
239
270
server_done = false ;
240
271
241
272
//busy-sync wait for server
0 commit comments