Skip to content

Commit 03ba389

Browse files
fix format issues and add global variable
1 parent 0b25dad commit 03ba389

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

testsuite/tests/singlecluster/limitador/section/test_named_route_rule.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
pytestmark = [pytest.mark.limitador]
88

9+
LIMIT = Limit(2, "10s")
10+
911

1012
@pytest.fixture(scope="module")
1113
def route(route, backend):
@@ -20,15 +22,15 @@ def route(route, backend):
2022
def rate_limit(cluster, blame, module_label, route):
2123
"""Add a RateLimitPolicy targeting the get-rule HTTPRoute Rule."""
2224
rlp = RateLimitPolicy.create_instance(cluster, blame("limit"), route, "get-rule", labels={"testRun": module_label})
23-
rlp.add_limit("basic", [Limit(2, "10s")])
25+
rlp.add_limit("basic", [LIMIT])
2426
return rlp
2527

2628

2729
def test_limit_match_named_route_rule(client):
2830
"""Tests that RLP correctly applies to the specific named HTTPRoute Rule"""
29-
responses = client.get_many("/get", 2)
31+
responses = client.get_many("/get", LIMIT.limit)
3032
responses.assert_all(status_code=200)
3133
assert client.get("/get").status_code == 429
3234

3335
response = client.get("/anything")
34-
assert response.status_code == 200
36+
assert response.status_code == 200

0 commit comments

Comments
 (0)