Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
efiop committed Oct 22, 2024
1 parent 870eda0 commit 906f116
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions projects/fal/tests/test_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 906f116

Please sign in to comment.