Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable job tests in integration tests #8818

Merged
merged 5 commits into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion tests/integration/local/job_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

# stdlib
from secrets import token_hex
import time

# third party
import pytest
Expand All @@ -24,6 +23,7 @@ def test_job_restart(job) -> None:
assert wait_until(
lambda: job.fetched_status == JobStatus.PROCESSING
), "Job not started"
assert wait_until(lambda: len(job.subjobs) == 2), "Subjobs not started"
assert wait_until(
lambda: all(
subjob.fetched_status == JobStatus.PROCESSING for subjob in job.subjobs
Expand Down Expand Up @@ -59,6 +59,10 @@ def test_job_restart(job) -> None:
== 2
), "Subjobs not restarted"

result = job.kill()
assert isinstance(result, SyftSuccess), "Should kill job"
assert job.fetched_status == JobStatus.INTERRUPTED


@pytest.fixture
def node():
Expand Down Expand Up @@ -87,6 +91,7 @@ def job(node):
@syft_function()
def process_batch():
# stdlib
import time # noqa: F811

while time.sleep(1) is None:
...
Expand All @@ -96,6 +101,7 @@ def process_batch():
@syft_function_single_use()
def process_all(domain):
# stdlib
import time # noqa: F811

_ = domain.launch_job(process_batch)
_ = domain.launch_job(process_batch)
Expand Down
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ allowlist_externals =
setenv =
PYTEST_MODULES = {env:PYTEST_MODULES:local_node}
ASSOCIATION_REQUEST_AUTO_APPROVAL = {env:ASSOCIATION_REQUEST_AUTO_APPROVAL:true}
PYTEST_FLAGS = {env:PYTEST_FLAGS:--ignore=tests/integration/local/gateway_local_test.py --ignore=tests/integration/local/job_test.py}
PYTEST_FLAGS = {env:PYTEST_FLAGS:--ignore=tests/integration/local/gateway_local_test.py}
commands =
python -c 'import syft as sy; sy.stage_protocol_changes()'

Expand All @@ -658,7 +658,7 @@ commands =
PYTEST_MODULES=($PYTEST_MODULES); \
for i in "${PYTEST_MODULES[@]}"; do \
echo "Starting test for $i"; date; \
pytest tests/integration -m $i -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no $PYTEST_FLAGS; \
pytest tests/integration -n auto -m $i -vvvv -p no:randomly -p no:benchmark -o log_cli=True --capture=no $PYTEST_FLAGS; \
return=$?; \
echo "Finished $i"; \
date; \
Expand Down Expand Up @@ -689,7 +689,7 @@ allowlist_externals =
setenv =
NODE_PORT = {env:NODE_PORT:9082}
GITHUB_CI = {env:GITHUB_CI:false}
PYTEST_MODULES = {env:PYTEST_MODULES:frontend network container_workload}
PYTEST_MODULES = {env:PYTEST_MODULES:frontend network container_workload local_node}
Copy link
Collaborator

@rasswanth-s rasswanth-s May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small note, Local Node should be not part of k8s
it is already part of
syft.test.integration workflow

DOMAIN_CLUSTER_NAME = {env:DOMAIN_CLUSTER_NAME:test-domain-1}
GATEWAY_CLUSTER_NAME = {env:GATEWAY_CLUSTER_NAME:test-gateway-1}
ASSOCIATION_REQUEST_AUTO_APPROVAL = {env:ASSOCIATION_REQUEST_AUTO_APPROVAL:true}
Expand Down
Loading