2022-07-11 17:08:25 +08:00
|
|
|
import json
|
|
|
|
import pytest
|
|
|
|
|
|
|
|
from base.client_base import TestcaseBase
|
2023-03-29 15:22:01 +08:00
|
|
|
from deploy.common import get_deploy_test_collections
|
2022-07-11 17:08:25 +08:00
|
|
|
from common.common_type import CaseLabel
|
|
|
|
from utils.util_log import test_log as log
|
|
|
|
|
|
|
|
|
|
|
|
class TestGetCollections(TestcaseBase):
|
2022-08-15 17:36:48 +08:00
|
|
|
""" Test case of getting all collections """
|
2022-07-11 17:08:25 +08:00
|
|
|
|
2022-08-19 12:56:51 +08:00
|
|
|
@pytest.mark.tags(CaseLabel.L3)
|
2022-07-11 17:08:25 +08:00
|
|
|
def test_get_collections_by_prefix(self,):
|
|
|
|
self._connect()
|
|
|
|
all_collections = self.utility_wrap.list_collections()[0]
|
2022-08-15 17:36:48 +08:00
|
|
|
all_collections = [c_name for c_name in all_collections if "deploy_test" in c_name]
|
2022-07-11 17:08:25 +08:00
|
|
|
log.info(f"find {len(all_collections)} collections:")
|
|
|
|
log.info(all_collections)
|
|
|
|
data = {
|
2022-08-15 17:36:48 +08:00
|
|
|
"all": all_collections,
|
2022-07-11 17:08:25 +08:00
|
|
|
}
|
2023-03-29 15:22:01 +08:00
|
|
|
with open("/tmp/ci_logs/deploy_test_all_collections.json", "w") as f:
|
2022-07-11 17:08:25 +08:00
|
|
|
f.write(json.dumps(data))
|
2023-03-29 10:54:01 +08:00
|
|
|
log.info(f"write {len(all_collections)} collections to /tmp/ci_logs/deploy_test_all_collections.json")
|
2023-03-29 15:22:01 +08:00
|
|
|
collections_in_json = get_deploy_test_collections()
|
2022-07-11 17:08:25 +08:00
|
|
|
assert len(all_collections) == len(collections_in_json)
|