Skip to content

Commit

Permalink
refine testing
Browse files Browse the repository at this point in the history
Signed-off-by: Austin Liu <[email protected]>

refine testing

Signed-off-by: Austin Liu <[email protected]>
  • Loading branch information
austin362667 committed Apr 19, 2024
1 parent e4f9a3f commit 9f20d3f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion flyrs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
### How to test Rust FlyteRemote Client?
1. `pyflyte register ./t.py` to get flyte entity `version` id
2. Set previous fetched `version` id in `./test_flyte_remote.py`'s `VERSION_ID`
2. `python ./test_flyte_remote.py` in `flyrs/`
2. `pytest ./test_flyte_remote.py` inside `flyrs/`
70 changes: 39 additions & 31 deletions flyrs/test_flyte_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,43 @@
remote_py = FlyteRemote(Config.auto(), default_project=PROJECT, default_domain=DOMAIN)
remote_rs = RustFlyteRemote(Config.auto(), default_project=PROJECT, default_domain=DOMAIN)

task_py = remote_py.fetch_task(
project=PROJECT, domain=DOMAIN, name=TASK_NAME, version=VERSION_ID
)
task_rs = remote_rs.fetch_task(
project=PROJECT, domain=DOMAIN, name=TASK_NAME, version=VERSION_ID
)
assert task_py == task_rs

tasks_py = remote_py.list_tasks_by_version(
project=PROJECT, domain=DOMAIN, version=VERSION_ID
)
tasks_rs = remote_rs.list_tasks_by_version(
project=PROJECT, domain=DOMAIN, version=VERSION_ID
)
assert tasks_py == tasks_rs

workflow_py = remote_py.fetch_workflow(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
workflow_rs = remote_rs.fetch_workflow(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
assert workflow_py == workflow_rs

launchplan_py = remote_py.fetch_launch_plan(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
launchplan_rs = remote_rs.fetch_launch_plan(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
assert workflow_py == workflow_rs
## test remote endpoints

def test_fetch_task():
task_py = remote_py.fetch_task(
project=PROJECT, domain=DOMAIN, name=TASK_NAME, version=VERSION_ID
)
task_rs = remote_rs.fetch_task(
project=PROJECT, domain=DOMAIN, name=TASK_NAME, version=VERSION_ID
)
assert task_py == task_rs

def test_list_tasks_by_version():
tasks_py = remote_py.list_tasks_by_version(
project=PROJECT, domain=DOMAIN, version=VERSION_ID
)
tasks_rs = remote_rs.list_tasks_by_version(
project=PROJECT, domain=DOMAIN, version=VERSION_ID
)
assert len(tasks_py)==1
assert len(tasks_rs)==1
assert tasks_py == tasks_rs

def test_fetch_workflow():
workflow_py = remote_py.fetch_workflow(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
workflow_rs = remote_rs.fetch_workflow(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
assert workflow_py == workflow_rs

def test_fetch_launch_plan():
launchplan_py = remote_py.fetch_launch_plan(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
launchplan_rs = remote_rs.fetch_launch_plan(
project=PROJECT, domain=DOMAIN, name=WF_NAME, version=VERSION_ID
)
assert launchplan_py == launchplan_rs

0 comments on commit 9f20d3f

Please sign in to comment.