-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
/** | ||
* @since Jun 2024 | ||
* @author Haydar KULEKCI <[email protected]> | ||
*/ | ||
|
||
namespace Integration\Endpoints\Collections; | ||
|
||
use Qdrant\Endpoints\Collections; | ||
use Qdrant\Exception\InvalidArgumentException; | ||
use Qdrant\Models\Request\CollectionConfig\CreateShardKey; | ||
use Qdrant\Models\Request\CollectionConfig\DeleteShardKey; | ||
use Qdrant\Models\Request\CreateIndex; | ||
use Qdrant\Tests\Integration\AbstractIntegration; | ||
|
||
class ShardsTest extends AbstractIntegration | ||
{ | ||
/** | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function testCollectionCreateShards(): void | ||
{ | ||
//TODO: We need to find a way to enable distributed mode in tests? | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('Bad request: Distributed mode disabled'); | ||
|
||
$collection = new Collections($this->client); | ||
$this->createCollections('sample-collection'); | ||
$collection->setCollectionName('sample-collection'); | ||
|
||
$shards = $collection->shards(); | ||
$this->assertEquals('sample-collection', $shards->getCollectionName()); | ||
|
||
$shards->create(new CreateShardKey(1)); | ||
} | ||
|
||
/** | ||
* @throws InvalidArgumentException | ||
*/ | ||
public function testCollectionDeleteShards(): void | ||
{ | ||
//TODO: We need to find a way to enable distributed mode in tests? | ||
$this->expectException(InvalidArgumentException::class); | ||
$this->expectExceptionMessage('Bad request: Distributed mode disabled'); | ||
|
||
$collection = new Collections($this->client); | ||
$this->createCollections('sample-collection'); | ||
$collection->setCollectionName('sample-collection'); | ||
|
||
$shards = $collection->shards(); | ||
$this->assertEquals('sample-collection', $shards->getCollectionName()); | ||
|
||
$shards->delete(new DeleteShardKey(1)); | ||
} | ||
|
||
protected function tearDown(): void | ||
{ | ||
parent::tearDown(); | ||
|
||
$this->getCollections('sample-collection')->delete(); | ||
} | ||
} |