Fix img link (#6744)

* [skip ci] fix img link

Signed-off-by: LocoRichard <lichen.wang@zilliz.com>

* [skip ci] update readme CN

Signed-off-by: LocoRichard <lichen.wang@zilliz.com>

* [skip ci] fix readme cn

Signed-off-by: LocoRichard <lichen.wang@zilliz.com>
pull/6750/head
LocoRichard 2021-07-22 18:00:13 +08:00 committed by GitHub
parent fad9043e82
commit b8e2b3666c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 104 additions and 114 deletions

View File

@ -21,53 +21,53 @@ To accommodate the variety of requirements, Milvus offers as much as four deploy
- [standalone](https://milvus.io/docs/install_standalone-helm.md)
- [cluster](https://milvus.io/docs/v2.0.0/install_cluster-helm.md)
1. Install with KinD
4. Install with KinD
For test purpose, we recommend installing Milvus with KinD. KinD supports ClickOnce deployment of Milvus and its test client. KinD deployment is tailored for scenarios with small data scale, such as development/debugging test cases and functional verification.
> For test purpose, we recommend installing Milvus with KinD. KinD supports ClickOnce deployment of Milvus and its test client. KinD deployment is tailored for scenarios with small data scale, such as development/debugging test cases and functional verification.
### Prerequisites
- **Prerequisites**
- [Docker](https://docs.docker.com/get-docker/) (19.05 or higher)
- [Docker Compose](https://docs.docker.com/compose/install/) (1.25.5 or higher)
- [jq](https://stedolan.github.io/jq/download/) (1.3 or higher)
- [kubectl](https://kubernetes.io/docs/tasks/tools/) (1.14 or higher)
- [Helm](https://helm.sh/docs/intro/install/) (3.0 or higher)
- [KinD](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) (0.10.0 or higher)
- [Docker](https://docs.docker.com/get-docker/) (19.05 or higher)
- [Docker Compose](https://docs.docker.com/compose/install/) (1.25.5 or higher)
- [jq](https://stedolan.github.io/jq/download/) (1.3 or higher)
- [kubectl](https://kubernetes.io/docs/tasks/tools/) (1.14 or higher)
- [Helm](https://helm.sh/docs/intro/install/) (3.0 or higher)
- [KinD](https://kind.sigs.k8s.io/docs/user/quick-start/#installation) (0.10.0 or higher)
### Install KinD with script
- **Install KinD with script**
1. Enter the local directory of the code ***/milvus/tests/scripts/**
2. Build the KinD environment, and execute CI Regression test cases automatically:
1. Enter the local directory of the code ***/milvus/tests/scripts/**
2. Build the KinD environment, and execute CI Regression test cases automatically:
```shell
./e2e-k8s.sh
```
```shell
./e2e-k8s.sh
```
- By default, KinD environment will be automatically cleaned up after the execution of the test case. If you need to keep the KinD environment:
- By default, KinD environment will be automatically cleaned up after the execution of the test case. If you need to keep the KinD environment:
```shell
./e2e-k8s.sh --skip-cleanup
```
```shell
./e2e-k8s.sh --skip-cleanup
```
- Skip the automatic test case execution and keep the KinD environment:
- Skip the automatic test case execution and keep the KinD environment:
```shell
./e2e-k8s.sh --skip-cleanup --skip-test --manual
```
```shell
./e2e-k8s.sh --skip-cleanup --skip-test --manual
```
> Note: You need to log in to the containers of the test client to proceed manual execution and debugging of the test case.
- See more script parameters:
- See more script parameters:
```shell
./e2e-k8s.sh --help
```
```shell
./e2e-k8s.sh --help
```
3. Export cluster logs:
- Export cluster logs:
```shell
kind export logs .
```
```shell
kind export logs .
```
@ -79,15 +79,15 @@ We recommend using Python 3 (3.6 or higher), consistent with the version support
1. Install the Python package prerequisite for the test, enter ***/milvus/tests20/python_client/**, and execute:
```python
pip install -r requirements.txt
```
```python
pip install -r requirements.txt
```
1. The default test log path is **/tmp/ci_logs/** under the **config** directory. You can add environment variables to change the path before booting up test cases:
2. The default test log path is **/tmp/ci_logs/** under the **config** directory. You can add environment variables to change the path before booting up test cases:
```python
export CI_LOG_PATH=/tmp/ci_logs/test/
```
```python
export CI_LOG_PATH=/tmp/ci_logs/test/
```
| **Log Level** | **Log File** |
| ------------- | ----------------- |
@ -97,23 +97,23 @@ export CI_LOG_PATH=/tmp/ci_logs/test/
1. You can configure default parameters in **pytest.ini** under the root path. For instance:
```python
addopts = --host *.*.*.* --html=/tmp/ci_logs/report.html
```
```python
addopts = --host *.*.*.* --html=/tmp/ci_logs/report.html
```
where `host` should be set as the IP address of the Milvus service, and `*.html` is the report generated for the test.
1. Enter **testcases** directory, run following command, which is consistent with the command under the pytest framework, to execute the test case:
2. Enter **testcases** directory, run following command, which is consistent with the command under the pytest framework, to execute the test case:
```python
python3 -W ignore -m pytest <test_file_name>
```
```python
python3 -W ignore -m pytest <test_file_name>
```
## An Introduction to Test Modules
Module Overview
### Module Overview
![img](https://zilliverse.feishu.cn/space/api/box/stream/download/asynccode/?code=ZTA5MWRkZGQ3YWY1ZmNjNDZkMWQ4MDZjNDJlYWJmN2ZfWHNrVVJTeU5MSzFvZzZSbnJKQlpxZUdwaEs3MGdjYkFfVG9rZW46Ym94Y25xazV4Vk1RMTdSd2ZLaEoyYWw5ZUhjXzE2MjY5MzUxNTc6MTYyNjkzODc1N19WNA)
![Module Overview](https://github.com/milvus-io/milvus/blob/master/tests20/python_client/graphs/module_call_diagram.jpg)
### Working directories and files
@ -157,9 +157,7 @@ This section specifies references while adding new test cases or framework tools
- Testcase naming
- `TestObjectParams`
:
- `TestObjectParams`:
- Name after the parameter input of the test case. For instance, `test_partition_empty_name()` represents test on performance with the empty string as the `name` parameter input.
@ -176,79 +174,79 @@ This section specifies references while adding new test cases or framework tools
> To create multiple partitions objects, call `self.init_partition_wrap()`, which returns the newly created partition objects. Call `self.partition_wrap` instead when you do not need multiple objects.
```python
# create partition -Call the default initialization method
partition_w = self.init_partition_wrap()
assert partition_w.is_empty
```
```python
# create partition -Call the default initialization method
partition_w = self.init_partition_wrap()
assert partition_w.is_empty
```
```python
# create partition -Directly call the encapsulated object
self.partition_wrap.init_partition(collection=collection_name, name=partition_name)
assert self.partition_wrap.is_empty
```
```python
# create partition -Directly call the encapsulated object
self.partition_wrap.init_partition(collection=collection_name, name=partition_name)
assert self.partition_wrap.is_empty
```
- To test on the error or exception returned from interfaces:
- Call `check_task=CheckTasks.err_res`.
- Input the expected error ID and message.
```python
# create partition with collection is None
self.partition_wrap.init_partition(collection=None, name=partition_name, check_task=CheckTasks.err_res, check_items={ct.err_code: 1, ct.err_msg: "'NoneType' object has no attribute"})
```
```python
# create partition with collection is None
self.partition_wrap.init_partition(collection=None, name=partition_name, check_task=CheckTasks.err_res, check_items={ct.err_code: 1, ct.err_msg: "'NoneType' object has no attribute"})
```
- To test on the normal value returned from interfaces:
- Call `check_task=CheckTasks.check_partition_property`. You can build new test methods in `CheckTasks` for invocation in test cases.
- Input the expected result for test methods.
```python
# create partition
partition_w = self.init_partition_wrap(collection_w, partition_name, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, "is_empty": True, "num_entities": 0})
```
```python
# create partition
partition_w = self.init_partition_wrap(collection_w, partition_name, check_task=CheckTasks.check_partition_property, check_items={"name": partition_name, "description": description, "is_empty": True, "num_entities": 0})
```
3. Adding test cases
- Find the encapsulated tested interface with the same name in the ***_wrapper.py** files under **base** directory. Each interface returns a list with two values, among which one is interface returned results of PyMilvus ORM, and the other is the assertion of normal/abnormal results, i.e. `True`/`False`. The returned judgment can be used in the extra result checking of test cases.
- Add the test cases in the corresponding test file of the tested interface in **testcases** folder. You can refer to all test files under this directory to create your own test cases as shown below:
```python
@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
def test_partition_dropped_collection(self, partition_name):
"""
target: verify create partition against a dropped collection
method: 1. create collection1
2. drop collection1
3. create partition in collection1
expected: 1. raise exception
"""
# create collection
collection_w = self.init_collection_wrap()
# drop collection
collection_w.drop()
# create partition failed
self.partition_wrap.init_partition(collection_w.collection, partition_name, check_task=CheckTasks.err_res, check_items={ct.err_code: 1, ct.err_msg: "can't find collection"})
```
```python
@pytest.mark.tags(CaseLabel.L1)
@pytest.mark.parametrize("partition_name", [cf.gen_unique_str(prefix)])
def test_partition_dropped_collection(self, partition_name):
"""
target: verify create partition against a dropped collection
method: 1. create collection1
2. drop collection1
3. create partition in collection1
expected: 1. raise exception
"""
# create collection
collection_w = self.init_collection_wrap()
# drop collection
collection_w.drop()
# create partition failed
self.partition_wrap.init_partition(collection_w.collection, partition_name, check_task=CheckTasks.err_res, check_items={ct.err_code: 1, ct.err_msg: "can't find collection"})
```
**Tips**
- Case comments encompass three parts: object, test method, and expected result. You should specify each part.
- Initialize the tested category in the setup method of the Base category in the **base/client_base.py** file, as shown below:
```
self.connection_wrap = ApiConnectionsWrapper()
self.utility_wrap = ApiUtilityWrapper()
self.collection_wrap = ApiCollectionWrapper()
self.partition_wrap = ApiPartitionWrapper()
self.index_wrap = ApiIndexWrapper()
self.collection_schema_wrap = ApiCollectionSchemaWrapper()
self.field_schema_wrap = ApiFieldSchemaWrapper()
```
- Pass the parameters with corresponding encapsulated methods when calling the interface you need to test on. As shown below, align all parameters with those in PyMilvus ORM interfaces except for `check_task` and `check_items`.
```
def init_partition(self, collection, name, description="", check_task=None, check_items=None, **kwargs)
```
- `check_task` is used to select the corresponding interface test method in the ResponseChecker check category in the **check/func_check.py** file. You can choose methods under the `CheckTasks` category in the **common/common_type.py** file.
- The specific content of `check_items` passed to the test method is determined by the implemented test method `check_task`.
- The tested interface can return normal results when `CheckTasks` and `check_items` are not passed.
- Tips
- Case comments encompass three parts: object, test method, and expected result. You should specify each part.
- Initialize the tested category in the setup method of the Base category in the **base/client_base.py** file, as shown below:
```
self.connection_wrap = ApiConnectionsWrapper()
self.utility_wrap = ApiUtilityWrapper()
self.collection_wrap = ApiCollectionWrapper()
self.partition_wrap = ApiPartitionWrapper()
self.index_wrap = ApiIndexWrapper()
self.collection_schema_wrap = ApiCollectionSchemaWrapper()
self.field_schema_wrap = ApiFieldSchemaWrapper()
```
- Pass the parameters with corresponding encapsulated methods when calling the interface you need to test on. As shown below, align all parameters with those in PyMilvus ORM interfaces except for `check_task` and `check_items`.
```
def init_partition(self, collection, name, description="", check_task=None, check_items=None, **kwargs)
```
- `check_task` is used to select the corresponding interface test method in the ResponseChecker check category in the **check/func_check.py** file. You can choose methods under the `CheckTasks` category in the **common/common_type.py** file.
- The specific content of `check_items` passed to the test method is determined by the implemented test method `check_task`.
- The tested interface can return normal results when `CheckTasks` and `check_items` are not passed.
4. Adding framework functions

View File

@ -17,12 +17,10 @@
<ol>
<li>准备环境</li>
</ol>
<ul>
<li><a href='https://github.com/milvus-io/milvus/blob/master/tests/README.md'>安装 Docker 、Docker Compose、jq、kubectl、helm、kind</a></li>
</ul>
<ol>
<li>脚本安装</li>
</ol>
@ -69,27 +67,21 @@
<ol>
<li>安装测试所需的 python 包,进入代码 <strong>*/milvus/tests20/python_client/</strong> 目录,执行命令:</li>
</ol>
<pre><code>pip install -r requirements.txt
</code></pre>
<ol>
<li><strong>config</strong>目录下,测试的日志目录默认为:<strong>/tmp/ci_logs/</strong>可在启动测试用例之前添加环境变量来修改log的存放路径</li>
</ol>
<pre><code>export CI_LOG_PATH=/tmp/ci_logs/test/
</code></pre>
<figure><table>
<thead>
<tr><th><strong>Log Level</strong> </th><th><strong>Log File</strong> </th></tr></thead>
<tbody><tr><td>Debug </td><td>ci_test_log.debug </td></tr><tr><td>Info </td><td>ci_test_log .log </td></tr><tr><td>Error </td><td>ci_test_log.err </td></tr></tbody>
<tbody><tr><td>Debug </td><td>ci_test_log.debug </td></tr><tr><td>Info </td><td>ci_test_log.log </td></tr><tr><td>Error </td><td>ci_test_log.err </td></tr></tbody>
</table></figure>
<ol>
<li>在主目录 <strong>pytest.ini</strong> 文件内可设置默认传递的参数,如下例中 ip 为所需要设置的 milvus 服务的ip地址<strong>*.html</strong> 为测试生成的 <strong>report</strong></li>
</ol>
<pre><code>addopts = --host *.*.*.* --html=/tmp/ci_logs/report.html
</code></pre>
<ol>
<li>进入 <strong>testcases</strong> 目录,命令与 <a href='https://docs.pytest.org/en/6.2.x/'>pytest</a> 框架的执行命令一致,运行如下命令执行测试用例:</li>
</ol>