mirror of
https://github.com/qdrant/qdrant.git
synced 2026-07-23 11:11:00 -05:00
* simple integration test for tenant promotion * add cleanup after promotion * When switching to ReadActive state, set it for the correct peer ID * fix test --------- Co-authored-by: timvisee <tim@visee.me>
60 lines
1.4 KiB
Python
60 lines
1.4 KiB
Python
from .utils import *
|
|
from .fixtures import *
|
|
|
|
DEFAULT_COLLECTION_NAME = "test_collection"
|
|
|
|
|
|
def create_collection_with_custom_sharding(
|
|
peer_url,
|
|
collection=DEFAULT_COLLECTION_NAME,
|
|
shard_number=1,
|
|
replication_factor=1,
|
|
write_consistency_factor=1,
|
|
timeout=10
|
|
):
|
|
create_collection(
|
|
peer_url,
|
|
collection=collection,
|
|
shard_number=shard_number,
|
|
replication_factor=replication_factor,
|
|
write_consistency_factor=write_consistency_factor,
|
|
timeout=timeout,
|
|
sharding_method="custom",
|
|
)
|
|
|
|
|
|
def create_shard(
|
|
peer_url,
|
|
collection,
|
|
shard_key,
|
|
shard_number=1,
|
|
replication_factor=1,
|
|
placement=None,
|
|
initial_state=None,
|
|
timeout=10
|
|
):
|
|
r_batch = requests.put(
|
|
f"{peer_url}/collections/{collection}/shards?timeout={timeout}", json={
|
|
"shard_key": shard_key,
|
|
"shards_number": shard_number,
|
|
"replication_factor": replication_factor,
|
|
"placement": placement,
|
|
"initial_state": initial_state,
|
|
})
|
|
assert_http_ok(r_batch)
|
|
|
|
|
|
def delete_shard(
|
|
peer_url,
|
|
collection,
|
|
shard_key,
|
|
timeout=10
|
|
):
|
|
r_batch = requests.post(
|
|
f"{peer_url}/collections/{collection}/shards/delete?timeout={timeout}",
|
|
json={
|
|
"shard_key": shard_key,
|
|
}
|
|
)
|
|
assert_http_ok(r_batch)
|