Skip to content

Commit

Permalink
Add new unit test for autoscaling policy
Browse files Browse the repository at this point in the history
  • Loading branch information
deadlycoconuts committed Feb 19, 2025
1 parent fe8fe8d commit 5e1ed57
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion sdk/tests/router/config/autoscaling_policy_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,35 @@ def test_set_invalid_metric():
),
],
)
def test_set_route_with_invalid_endpoint(metric, expected):
def test_set_autoscaling_policy_metric(metric, expected):
policy = AutoscalingPolicy(metric=metric, target=DEFAULT_AUTOSCALING_POLICY.target)
assert policy.metric == expected


@pytest.mark.parametrize(
"target,expected,error",
[
pytest.param(
"100",
"100",
None,
),
pytest.param(
"0.5",
"0.5",
None,
),
pytest.param(
"0.5.5",
None,
AssertionError,
),
],
)
def test_set_autoscaling_policy_target(target, expected, error):
if error is not None:
with pytest.raises(error):
AutoscalingPolicy(metric=AutoscalingMetric.CONCURRENCY, target=target)
else:
policy = AutoscalingPolicy(metric=AutoscalingMetric.CONCURRENCY, target=target)
assert policy.target == expected

0 comments on commit 5e1ed57

Please sign in to comment.