From 906f116ae60b4e8003afba32e42ca4985b801c89 Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Wed, 23 Oct 2024 01:37:32 +0300 Subject: [PATCH] add test --- projects/fal/tests/test_apps.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/projects/fal/tests/test_apps.py b/projects/fal/tests/test_apps.py index 0755f2cc..4547bff8 100644 --- a/projects/fal/tests/test_apps.py +++ b/projects/fal/tests/test_apps.py @@ -516,6 +516,38 @@ def test_404_response(test_app: str, request: pytest.FixtureRequest): apps.run(test_app, path="/other", arguments={"lhs": 1, "rhs": 2}) +def test_app_deploy_scale(aliased_app: tuple[str, str]): + app_revision, app_alias = aliased_app + + host: api.FalServerlessHost = addition_app.host # type: ignore + options = addition_app.options.copy() + options.host["max_multiplexing"] = 30 + kwargs = dict( + func=addition_app.func, + options=options, + application_name=app_alias, + application_auth_mode="private", + ) + + app_revision = addition_app.host.register(**kwargs, scale=False) + + with host._connection as client: + res = client.list_aliases() + found = next(filter(lambda alias: alias.alias == app_alias, res), None) + assert found, f"Could not find app {app_alias} in {res}" + assert found.revision == app_revision + assert found.max_multiplexing == 1 + + app_revision = addition_app.host.register(**kwargs, scale=True) + + with host._connection as client: + res = client.list_aliases() + found = next(filter(lambda alias: alias.alias == app_alias, res), None) + assert found, f"Could not find app {app_alias} in {res}" + assert found.revision == app_revision + assert found.max_multiplexing == 30 + + def test_app_update_app(aliased_app: tuple[str, str]): app_revision, app_alias = aliased_app