Skip to content

Commit

Permalink
add api integration test
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <[email protected]>
  • Loading branch information
SimFG committed Nov 28, 2024
1 parent 7a3ca02 commit a6521c4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ jobs:
run: |
pip install -r requirements.txt --trusted-host https://test.pypi.org
pytest testcases/test_cdc_database.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
pytest testcases/test_cdc_get.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
pytest testcases/test_cdc_list.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
pytest testcases/test_cdc_delete.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
pytest testcases/test_cdc_pause.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
pytest testcases/test_cdc_resume.py --upstream_host 127.0.0.1 --upstream_port 19530 --downstream_host 127.0.0.1 --downstream_port 19500
- name: List CDC task
if: ${{ always() }}
Expand Down
21 changes: 16 additions & 5 deletions tests/testcases/test_cdc_resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,14 @@ class TestCdcResume(TestBase):
""" Test Milvus CDC delete """

def test_cdc_resume_task(self, upstream_host, upstream_port, downstream_host, downstream_port):
"""
target: test cdc delete task
method: create task, delete task
expected: create successfully, delete successfully
"""
collection_name1 = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S_%f')
collection_name2 = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S_%f')
task_id1 = self.test_create_cdc_task(upstream_host, upstream_port, downstream_host, downstream_port, collection_name1)
task_id2 = self.test_create_cdc_task(upstream_host, upstream_port, downstream_host, downstream_port, collection_name2)
self.test_cdc_resume_task_with_collection_name(upstream_host, upstream_port, downstream_host, downstream_port, collection_name1, task_id1)
self.test_cdc_resume_task_with_collection_name(upstream_host, upstream_port, downstream_host, downstream_port, collection_name2, task_id2)

def test_create_cdc_task(self, upstream_host, upstream_port, downstream_host, downstream_port, collection_name):
collection_name = prefix + datetime.now().strftime('%Y_%m_%d_%H_%M_%S_%f')
# create cdc task
request_data = {
Expand All @@ -47,6 +50,14 @@ def test_cdc_resume_task(self, upstream_host, upstream_port, downstream_host, do
assert result
log.info(f"create task response: {rsp}")
task_id = rsp['task_id']
return task_id

def test_cdc_resume_task_with_collection_name(self, upstream_host, upstream_port, downstream_host, downstream_port, collection_name, task_id):
"""
target: test cdc delete task
method: create task, delete task
expected: create successfully, delete successfully
"""
# create collection and insert entities into it in upstream
connections.connect(host=upstream_host, port=upstream_port)
checker = InsertEntitiesCollectionChecker(host=upstream_host, port=upstream_port, c_name=collection_name)
Expand Down

0 comments on commit a6521c4

Please sign in to comment.