Skip to content

Commit 9fa5509

Browse files
committed
move "add quota" test to end so it doesn't impact available execution
time when running other tests
1 parent 80e6f3d commit 9fa5509

File tree

1 file changed

+33
-42
lines changed

1 file changed

+33
-42
lines changed

backend/test_nightly/test_execution_minutes_quota.py

Lines changed: 33 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -108,48 +108,6 @@ def test_set_execution_mins_extra_quotas(org_with_quotas, admin_auth_headers):
108108
assert update["update"]
109109

110110

111-
def test_add_execution_mins_extra_quotas(
112-
org_with_quotas, admin_auth_headers, preshared_secret_auth_headers
113-
):
114-
r = requests.post(
115-
f"{API_PREFIX}/orgs/{org_with_quotas}/quotas/add",
116-
headers=preshared_secret_auth_headers,
117-
json={
118-
"extraExecMinutes": EXTRA_MINS_ADDED_QUOTA,
119-
"context": "test context 123",
120-
},
121-
)
122-
data = r.json()
123-
assert data.get("updated") == True
124-
125-
# Ensure org data looks as we expect
126-
r = requests.get(
127-
f"{API_PREFIX}/orgs/{org_with_quotas}",
128-
headers=admin_auth_headers,
129-
)
130-
data = r.json()
131-
assert (
132-
data["extraExecSecondsAvailable"] == EXTRA_SECS_QUOTA + EXTRA_SECS_ADDED_QUOTA
133-
)
134-
assert data["giftedExecSecondsAvailable"] == GIFTED_SECS_QUOTA
135-
assert data["extraExecSeconds"] == {}
136-
assert data["giftedExecSeconds"] == {}
137-
assert len(data["quotaUpdates"])
138-
for update in data["quotaUpdates"]:
139-
assert update["modified"]
140-
assert update["update"]
141-
assert data["quotaUpdates"][-1]["context"] == "test context 123"
142-
143-
# Reset back to previous value
144-
r = requests.post(
145-
f"{API_PREFIX}/orgs/{org_with_quotas}/quotas",
146-
headers=admin_auth_headers,
147-
json={
148-
"extraExecMinutes": EXTRA_MINS_QUOTA,
149-
},
150-
)
151-
152-
153111
@pytest.mark.timeout(1200)
154112
def test_crawl_stopped_when_quota_reached_with_extra(
155113
org_with_quotas, admin_auth_headers
@@ -238,3 +196,36 @@ def test_unset_execution_mins_quota(org_with_quotas, admin_auth_headers):
238196
)
239197
data = r.json()
240198
assert data.get("updated") == True
199+
200+
201+
def test_add_execution_mins_extra_quotas(
202+
org_with_quotas, admin_auth_headers, preshared_secret_auth_headers
203+
):
204+
r = requests.post(
205+
f"{API_PREFIX}/orgs/{org_with_quotas}/quotas/add",
206+
headers=preshared_secret_auth_headers,
207+
json={
208+
"extraExecMinutes": EXTRA_MINS_ADDED_QUOTA,
209+
"context": "test context 123",
210+
},
211+
)
212+
data = r.json()
213+
assert data.get("updated") == True
214+
215+
# Ensure org data looks as we expect
216+
r = requests.get(
217+
f"{API_PREFIX}/orgs/{org_with_quotas}",
218+
headers=admin_auth_headers,
219+
)
220+
data = r.json()
221+
assert (
222+
data["extraExecSecondsAvailable"] == EXTRA_SECS_QUOTA + EXTRA_SECS_ADDED_QUOTA
223+
)
224+
assert data["giftedExecSecondsAvailable"] == GIFTED_SECS_QUOTA
225+
assert data["extraExecSeconds"] == {}
226+
assert data["giftedExecSeconds"] == {}
227+
assert len(data["quotaUpdates"])
228+
for update in data["quotaUpdates"]:
229+
assert update["modified"]
230+
assert update["update"]
231+
assert data["quotaUpdates"][-1]["context"] == "test context 123"

0 commit comments

Comments
 (0)