Skip to content

Commit cdd1e32

Browse files
authored
Merge pull request #202 from pehala/rate_limit_2
Remove unnecessary fields for RateLimitPolicy
2 parents 9abf00b + 91a4869 commit cdd1e32

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

testsuite/openshift/objects/rate_limit.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,7 @@ def create_instance(cls, openshift: OpenShiftClient, name, route: Referencable,
1919
"metadata": {"name": name, "namespace": openshift.project, "labels": labels},
2020
"spec": {
2121
"targetRef": route.reference,
22-
"rateLimits": [
23-
{
24-
"configurations": [
25-
{"actions": [{"generic_key": {"descriptor_key": "limited", "descriptor_value": "1"}}]}
26-
]
27-
}
28-
],
22+
"rateLimits": [{"limits": []}],
2923
},
3024
}
3125

@@ -34,9 +28,10 @@ def create_instance(cls, openshift: OpenShiftClient, name, route: Referencable,
3428
@modify
3529
def add_limit(self, max_value, seconds, conditions: list[str] = None):
3630
"""Add another limit"""
37-
conditions = conditions or []
3831
limits = self.model.spec.rateLimits[0].setdefault("limits", [])
39-
limit = {"maxValue": max_value, "seconds": seconds, "conditions": conditions, "variables": []}
32+
limit = {"maxValue": max_value, "seconds": seconds}
33+
if conditions:
34+
limit["conditions"] = conditions
4035
limits.append(limit)
4136

4237
def commit(self):

0 commit comments

Comments
 (0)