@@ -78,6 +78,14 @@ const testChecks = [
7878 isError : true ,
7979 expectedError : 'InvalidLocationConstraint' ,
8080 } ,
81+ {
82+ data : 'multiple' ,
83+ locationSent : 'location-crr-v1' ,
84+ parsedHost : '127.3.2.1' ,
85+ locationReturn : 'location-crr-v1' ,
86+ isError : true ,
87+ expectedError : 'InvalidLocationConstraint' ,
88+ } ,
8189] ;
8290
8391describe ( 'checkLocationConstraint function' , ( ) => {
@@ -376,6 +384,27 @@ describe('bucketPut API', () => {
376384 } ) ;
377385 } ) ;
378386
387+ it ( 'should deny put bucket if locationConstraint is the crr location' , done => {
388+ const bucketName = 'bucket-name' ;
389+ const newRestEndpoint = 'location-crr-v1' ;
390+ const location = 'location-crr-v1' ;
391+
392+ const req = {
393+ ...testRequest ,
394+ parsedHost : newRestEndpoint ,
395+ bucketName,
396+ } ;
397+
398+ const newRestEndpoints = Object . assign ( { } , config . restEndpoints ) ;
399+ newRestEndpoints [ newRestEndpoint ] = location ;
400+ config . setRestEndpoints ( newRestEndpoints ) ;
401+
402+ bucketPut ( authInfo , req , log , err => {
403+ assert . strictEqual ( err . is . InvalidLocationConstraint , true ) ;
404+ done ( ) ;
405+ } ) ;
406+ } ) ;
407+
379408 describe ( 'Config::setLocationConstraints' , ( ) => {
380409 const bucketName = `test-bucket-${ Date . now ( ) } ` ;
381410 const newLC = { } ;
0 commit comments