Skip to content

Commit 4995433

Browse files
committed
fix typo in Job condition check
Signed-off-by: Zac Pitones <[email protected]>
1 parent d651383 commit 4995433

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

oper8/verify_resources.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
DEFAULT_TIMESTAMP_KEY = "lastTransitionTime"
2626
AVAILABLE_CONDITION_KEY = "Available"
27+
COMPLETE_CONDITION_KEY = "Complete"
2728
PROGRESSING_CONDITION_KEY = "Progressing"
2829
NEW_RS_AVAILABLE_REASON = "NewReplicaSetAvailable"
2930

@@ -144,7 +145,7 @@ def verify_pod(object_state: dict) -> bool:
144145
def verify_job(object_state: dict) -> bool:
145146
"""Verify that a job has completed successfully"""
146147
# https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/job-v1/#JobStatus
147-
return _verify_condition(object_state, "Completed", True)
148+
return _verify_condition(object_state, COMPLETE_CONDITION_KEY, True)
148149

149150

150151
def verify_deployment(object_state: dict) -> bool:

tests/test_verify_resources.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
from oper8.utils import nested_set
2121
from oper8.verify_resources import (
2222
AVAILABLE_CONDITION_KEY,
23+
COMPLETE_CONDITION_KEY,
2324
DEFAULT_TIMESTAMP_KEY,
2425
NEW_RS_AVAILABLE_REASON,
2526
PROGRESSING_CONDITION_KEY,
@@ -182,7 +183,7 @@ def test_verify_pod_custom_verification():
182183

183184
def test_verify_job_completed():
184185
"""Make sure a completed job verifies cleanly"""
185-
assert run_test_verify(kind="Job", conditions=[make_condition("Completed", True)])
186+
assert run_test_verify(kind="Job", conditions=[make_condition(COMPLETE_CONDITION_KEY, True)])
186187

187188

188189
def test_verify_job_failed():
@@ -216,7 +217,7 @@ def test_verify_job_separate_namespace():
216217
"""Make sure a completed job from a different namespace verifies cleanly"""
217218
assert run_test_verify(
218219
kind="Job",
219-
conditions=[make_condition("Completed", True)],
220+
conditions=[make_condition(COMPLETE_CONDITION_KEY, True)],
220221
obj_namespace="adifferent",
221222
search_namespace="adifferent",
222223
)
@@ -226,7 +227,7 @@ def test_verify_job_null_namespace():
226227
"""Make sure a completed job in the same namespace verifies cleanly"""
227228
assert run_test_verify(
228229
kind="Job",
229-
conditions=[make_condition("Completed", True)],
230+
conditions=[make_condition(COMPLETE_CONDITION_KEY, True)],
230231
obj_namespace=TEST_NAMESPACE,
231232
search_namespace=_SESSION_NAMESPACE,
232233
)

0 commit comments

Comments
 (0)