Skip to content

Commit

Permalink
CT-1849 - bucket updated column update test
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtabiberle committed Nov 27, 2024
1 parent c702a8b commit 108b77c
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions tests/Backend/CommonPart1/BucketsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,8 @@ public function testBucketOwner(string $devBranchType, string $userRole): void
$this->assertSame("Owner of Bucket in.c-{$bucketName} not found", $e->getMessage());
}

$this->assertNull($bucket['updated']);

try {
$this->_testClient->updateBucketOwner($bucketId, new BucketOwnerUpdateOptions(id: 99999999));
$this->fail('Should fail.');
Expand Down Expand Up @@ -640,6 +642,51 @@ public function testBucketOwner(string $devBranchType, string $userRole): void
$bucket = $this->_testClient->getBucket($bucketId);
$this->assertEquals($ownerId, $bucket['owner']['id']);
$this->assertEquals($ownerName, $bucket['owner']['name']);
$this->assertNotNull($bucket['updated']);
}

/**
* @dataProvider provideComponentsClientTypeBasedOnSuite
*/
public function testBucketDescriptionMetadata(): void
{
$this->initEvents($this->_testClient);

$bucketName = 'bucketMetadataDescriptionTesting';
$metadataProvider = 'user';
$descriptionKey = 'KBC.description';

$this->dropBucketIfExists($this->_testClient, "in.c-{$bucketName}", true);
$bucketId = $this->_testClient->createBucket($bucketName, self::STAGE_IN);

$bucket = $this->_testClient->getBucket($bucketId);
$this->assertNull($bucket['updated']);

$metadataClient = new Metadata($this->_testClient);

$bucketMetadata = $metadataClient->listBucketMetadata($bucketId);
$this->assertEmpty($bucketMetadata);

$metadataClient->postBucketMetadata($bucketId, $metadataProvider, [[ 'key' => $descriptionKey, 'value' => 'Testing bucket description']]);

$eventAssertCallback = function ($events) use ($bucketId) {
$this->assertCount(1, $events);

$this->assertSame('bucket', $events[0]['objectType']);
$this->assertSame($bucketId, $events[0]['objectId']);
};

$query = new EventsQueryBuilder();
$query->setEvent('storage.bucketMetadataSet')
->setTokenId($this->tokenId)
->setObjectId($bucketId);
$this->assertEventWithRetries($this->_testClient, $eventAssertCallback, $query);

$bucketMetadata = $metadataClient->listBucketMetadata($bucketId);
$this->assertNotEmpty($bucketMetadata);

$bucket = $this->_testClient->getBucket($bucketId);
$this->assertNotNull($bucket['updated']);
}

public function provideComponentsClientTypeBasedOnSuite(): array
Expand Down

0 comments on commit 108b77c

Please sign in to comment.