Skip to content

Commit e23c42c

Browse files
authored
chore: Support non-HNS buckets in moveObjectAtomic (GoogleCloudPlatform#2163)
1 parent 5be36a7 commit e23c42c

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

storage/composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"require": {
3-
"google/cloud-storage": "^1.48.3",
3+
"google/cloud-storage": "^1.48.7",
44
"paragonie/random_compat": "^9.0.0"
55
},
66
"require-dev": {

storage/src/move_object_atomic.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
use Google\Cloud\Storage\StorageClient;
2828

2929
/**
30-
* Move an object to a new name within HNS-enabled bucket.
30+
* Move an object to a new name within bucket.
3131
*
3232
* @param string $bucketName The name of your Cloud Storage bucket.
3333
* (e.g. 'my-bucket')

storage/test/ObjectsTest.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,16 @@ public function testManageObject()
151151
$this->assertEquals($output, $outputString);
152152
}
153153

154-
public function testMoveObjectAtomic()
154+
/**
155+
* @dataProvider provideMoveObject
156+
*/
157+
public function testMoveObjectAtomic(bool $hnEnabled)
155158
{
156-
$bucketName = self::$bucketName . '-hns';
159+
$bucketName = 'move-object-bucket-' . uniqid();
157160
$objectName = 'test-object-' . time();
158161
$newObjectName = $objectName . '-moved';
159162
$bucket = self::$storage->createBucket($bucketName, [
160-
'hierarchicalNamespace' => ['enabled' => true],
163+
'hierarchicalNamespace' => ['enabled' => $hnEnabled],
161164
'iamConfiguration' => ['uniformBucketLevelAccess' => ['enabled' => true]]
162165
]);
163166

@@ -189,6 +192,11 @@ public function testMoveObjectAtomic()
189192
$bucket->delete();
190193
}
191194

195+
public function provideMoveObject()
196+
{
197+
return [[true], [false]];
198+
}
199+
192200
public function testCompose()
193201
{
194202
$bucket = self::$storage->bucket(self::$bucketName);

0 commit comments

Comments
 (0)