@@ -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
} ;
@@ -55,6 +55,7 @@ let expected_event_name;
55
55
let expected_key ;
56
56
let expected_eTag ;
57
57
let expect_test ;
58
+ let expected_url ;
58
59
59
60
// eslint-disable-next-line max-lines-per-function
60
61
mocha . describe ( 'notifications' , function ( ) {
@@ -95,6 +96,7 @@ mocha.describe('notifications', function() {
95
96
assert . strictEqual ( notif . Records [ 0 ] . Event , "s3:TestEvent" , 'wrong event name in notification' ) ;
96
97
expect_test = false ;
97
98
} else {
99
+ assert . strictEqual ( req . url , expected_url ) ;
98
100
assert . strictEqual ( notif . Records [ 0 ] . s3 . bucket . name , expected_bucket , 'wrong bucket name in notification' ) ;
99
101
assert . strictEqual ( notif . Records [ 0 ] . eventName , expected_event_name , 'wrong event name in notification' ) ;
100
102
assert . strictEqual ( notif . Records [ 0 ] . s3 . object . key , expected_key , 'wrong key in notification' ) ;
@@ -235,18 +237,47 @@ mocha.describe('notifications', function() {
235
237
} ) ;
236
238
} ) ;
237
239
240
+ mocha . it ( 'override connection' , async ( ) => {
241
+ await s3 . putBucketNotificationConfiguration ( {
242
+ Bucket : bucket ,
243
+ NotificationConfiguration : {
244
+ TopicConfigurations : [ {
245
+ "Id" : "system_test_http_no_event_override" ,
246
+ "TopicArn" : http_connect_filename + "?" + JSON . stringify ( {
247
+ request_options_object : { path : "/override" }
248
+ } ) ,
249
+ } ] ,
250
+ } ,
251
+ } ) ;
252
+
253
+ const res = await s3 . putObject ( {
254
+ Bucket : bucket ,
255
+ Key : 'f1' ,
256
+ Body : 'this is the body' ,
257
+ } ) ;
258
+
259
+ await notify_await_result ( {
260
+ bucket_name : bucket ,
261
+ event_name : 'ObjectCreated:Put' ,
262
+ key : "f1" ,
263
+ etag : res . ETag ,
264
+ url : "/override"
265
+ } ) ;
266
+ } ) ;
267
+
238
268
} ) ;
239
269
240
270
} ) ;
241
271
242
272
const step_wait = 100 ;
243
- async function notify_await_result ( { bucket_name, event_name, etag, key, timeout = undefined } ) {
273
+ async function notify_await_result ( { bucket_name, event_name, etag, key, url = "/default" , timeout = undefined } ) {
244
274
245
275
//remember expected result here so server could compare it to actual result later
246
276
expected_bucket = bucket_name ;
247
277
expected_event_name = event_name ;
248
278
expected_eTag = etag ;
249
279
expected_key = key ;
280
+ expected_url = url ;
250
281
server_done = false ;
251
282
252
283
//busy-sync wait for server
0 commit comments