Skip to content

Commit

Permalink
Merge pull request #96 from OpenMined/eelco/fix-sync
Browse files Browse the repository at this point in the history
run plugins manually in test
  • Loading branch information
eelcovdw authored Oct 11, 2024
2 parents 0b7c90d + 1fed339 commit d2a2aa4
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions tests/sync/sync_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

from syftbox.client.client import app as client_app
from syftbox.client.client import lifespan as client_lifespan
from syftbox.client.plugins.create_datasite import run as run_create_datasite_plugin
from syftbox.client.plugins.init import run as run_init_plugin
from syftbox.client.plugins.sync import do_sync
from syftbox.lib.lib import ClientConfig, perm_file_path
from syftbox.server.server import app as server_app
Expand All @@ -67,7 +69,7 @@ def datasite_1(
sync_folder=str(client_path / "sync"),
email=email,
server_url=str(server_client.base_url),
autorun_plugins=["init", "create_datasite"],
autorun_plugins=[],
)

client_config._server_client = server_client
Expand All @@ -78,6 +80,12 @@ def datasite_1(
yield client


def setup_datasite(datasite: TestClient):
run_init_plugin(datasite.app.shared_state)
run_create_datasite_plugin(datasite.app.shared_state)
wait_for_datasite_setup(datasite)


@pytest.fixture(scope="function")
def server_client(tmp_path: Path) -> Generator[TestClient, None, None]:
path = tmp_path / "server"
Expand All @@ -97,7 +105,7 @@ def http_server_client():
yield client


def wait_for_datasite_setup(datasite: TestClient, timeout=20):
def wait_for_datasite_setup(datasite: TestClient, timeout=5):
print("waiting for datasite setup...")

client_config: ClientConfig = datasite.app.shared_state.client_config
Expand Down Expand Up @@ -127,8 +135,7 @@ def test_sync_file_to_server_snapshot(
tmp_path: Path, server_client: TestClient, datasite_1: TestClient
):
print(datasite_1.app.shared_state.client_config)

wait_for_datasite_setup(datasite_1)
setup_datasite(datasite_1)

do_sync(datasite_1.app.shared_state)

Expand Down

0 comments on commit d2a2aa4

Please sign in to comment.