Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kevingrismore committed Apr 10, 2024
1 parent ae6522d commit 637399e
Showing 1 changed file with 48 additions and 39 deletions.
87 changes: 48 additions & 39 deletions tests/test_worker.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import base64
import json
import re
import uuid
from contextlib import contextmanager
Expand Down Expand Up @@ -1522,16 +1523,18 @@ async def test_create_job_failure(
mock_batch_client,
):
response = MagicMock()
response.data = {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
response.data = json.dumps(
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
)
response.status = 403
response.reason = "Forbidden"

Expand Down Expand Up @@ -1563,16 +1566,18 @@ async def test_create_job_retries(
):
MAX_ATTEMPTS = 3
response = MagicMock()
response.data = {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
response.data = json.dumps(
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
)
response.status = 403
response.reason = "Forbidden"

Expand Down Expand Up @@ -1605,16 +1610,18 @@ async def test_create_job_failure_no_reason(
mock_batch_client,
):
response = MagicMock()
response.data = {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
response.data = json.dumps(
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"message": 'jobs.batch is forbidden: User "system:serviceaccount:helm-test:prefect-worker-dev" cannot create resource "jobs" in API group "batch" in the namespace "prefect"',
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
)
response.status = 403
response.reason = None

Expand Down Expand Up @@ -1645,15 +1652,17 @@ async def test_create_job_failure_no_message(
mock_batch_client,
):
response = MagicMock()
response.data = {
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
response.data = json.dumps(
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {},
"status": "Failure",
"reason": "Forbidden",
"details": {"group": "batch", "kind": "jobs"},
"code": 403,
}
)
response.status = 403
response.reason = "Test"

Expand Down

0 comments on commit 637399e

Please sign in to comment.