mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-01 03:18:29 +08:00
5f2f8bdc8b
* [skip ci](shards): export MAX_WORKERS as configurable parameter Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): skip mishards .env git info Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): support more robust static discovery host configuration Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): update static provider that terminate server if connection to downstream server error during startup Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add topology.py Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add connection pool Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add topology test Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory static discovery using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): refactory kubernetes discovery using topo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): add more test for connection pool Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): export 19541 and 19542 for all_in_one demo Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): check version on new connection Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): mock connections Signed-off-by: peng.xu <peng.xu@zilliz.com> * [skip ci](shards): update tests Signed-off-by: peng.xu <peng.xu@zilliz.com>
45 lines
902 B
Python
45 lines
902 B
Python
import os
|
|
import logging
|
|
import pytest
|
|
import grpc
|
|
import mock
|
|
import tempfile
|
|
import shutil
|
|
import time
|
|
from mishards import settings, db, create_app
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
tpath = tempfile.mkdtemp()
|
|
dirpath = '{}/db'.format(tpath)
|
|
filepath = '{}/meta.sqlite'.format(dirpath)
|
|
os.makedirs(dirpath, 0o777)
|
|
settings.TestingConfig.SQLALCHEMY_DATABASE_URI = 'sqlite:///{}?check_same_thread=False'.format(
|
|
filepath)
|
|
|
|
|
|
@pytest.fixture
|
|
def app(request):
|
|
from mishards.connections import ConnectionGroup
|
|
ConnectionGroup.on_pre_add = mock.MagicMock(return_value=(True,))
|
|
time.sleep(0.1)
|
|
app = create_app(settings.TestingConfig)
|
|
db.drop_all()
|
|
db.create_all()
|
|
|
|
yield app
|
|
|
|
db.drop_all()
|
|
app.stop()
|
|
# shutil.rmtree(tpath)
|
|
|
|
|
|
@pytest.fixture
|
|
def started_app(app):
|
|
app.on_pre_run()
|
|
app.start(settings.SERVER_TEST_PORT)
|
|
|
|
yield app
|
|
|
|
app.stop()
|