public void CreateBucketWithDuplicatedNameDifferentLocationTest()
{
//get a random bucketName
var bucketName = OssTestUtils.GetBucketName(_className);
var settings = AccountSettings.Load();
//point to location (Beijing) other than Hangzhou
settings.OssEndpoint = Config.SecondEndpoint;
var ossSecondClient = OssClientFactory.CreateOssClient(settings);
//create the bucket
_ossClient.CreateBucket(bucketName);
try
{
//TODO: due to 5596363, user can see buckets in all regions, though only specify one region
//assert bucket does not exist
//Assert.IsFalse(OssTestUtils.BucketExists(ossSecondClient, bucketName));
Assert.IsTrue(OssTestUtils.BucketExists(ossSecondClient, bucketName));
//try to create bucket with same name on different location
ossSecondClient.CreateBucket(bucketName);
Assert.Fail("Bucket creation should be failed with dup name and different location");
}
catch (OssException e)
{
Assert.AreEqual(OssErrorCode.BucketAlreadyExists, e.ErrorCode);
}
finally
{
_ossClient.DeleteBucket(bucketName);
}
}