From f932590e5ef6ebda4e07cf23ae8d8ba589d6ddb0 Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Wed, 15 May 2024 10:50:15 +0200 Subject: [PATCH 1/4] enable parallel runs in integration tests --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 375ea2a39b8..a47a6241d33 100644 --- a/tox.ini +++ b/tox.ini @@ -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()' @@ -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; \ From a187f07d0157415c5bbc19e00de10e625c438df4 Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Wed, 15 May 2024 10:52:12 +0200 Subject: [PATCH 2/4] fix job tests --- tests/integration/local/job_test.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/tests/integration/local/job_test.py b/tests/integration/local/job_test.py index e713da731df..bf63f45b85f 100644 --- a/tests/integration/local/job_test.py +++ b/tests/integration/local/job_test.py @@ -2,7 +2,6 @@ # stdlib from secrets import token_hex -import time # third party import pytest @@ -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 @@ -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(): @@ -87,6 +91,7 @@ def job(node): @syft_function() def process_batch(): # stdlib + import time # noqa: F811 while time.sleep(1) is None: ... @@ -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) From b857a453408a0dcb69d7ef6fcc8f788e6b18d707 Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Wed, 15 May 2024 11:21:11 +0200 Subject: [PATCH 3/4] enable local_node in k8s tests --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index a47a6241d33..6dd595d4e16 100644 --- a/tox.ini +++ b/tox.ini @@ -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} 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} From 5b77044d8e5e40de5348ffeefc7d9f2b23900909 Mon Sep 17 00:00:00 2001 From: Aziz Berkay Yesilyurt Date: Wed, 15 May 2024 11:33:15 +0200 Subject: [PATCH 4/4] Revert "enable local_node in k8s tests" This reverts commit b857a453408a0dcb69d7ef6fcc8f788e6b18d707. --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index 6dd595d4e16..a47a6241d33 100644 --- a/tox.ini +++ b/tox.ini @@ -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 local_node} + PYTEST_MODULES = {env:PYTEST_MODULES:frontend network container_workload} 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}