Skip to content

Commit dadd918

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

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-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

+6-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,9 @@ 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(
187+
kind="Job", conditions=[make_condition(COMPLETE_CONDITION_KEY, True)]
188+
)
186189

187190

188191
def test_verify_job_failed():
@@ -216,7 +219,7 @@ def test_verify_job_separate_namespace():
216219
"""Make sure a completed job from a different namespace verifies cleanly"""
217220
assert run_test_verify(
218221
kind="Job",
219-
conditions=[make_condition("Completed", True)],
222+
conditions=[make_condition(COMPLETE_CONDITION_KEY, True)],
220223
obj_namespace="adifferent",
221224
search_namespace="adifferent",
222225
)
@@ -226,7 +229,7 @@ def test_verify_job_null_namespace():
226229
"""Make sure a completed job in the same namespace verifies cleanly"""
227230
assert run_test_verify(
228231
kind="Job",
229-
conditions=[make_condition("Completed", True)],
232+
conditions=[make_condition(COMPLETE_CONDITION_KEY, True)],
230233
obj_namespace=TEST_NAMESPACE,
231234
search_namespace=_SESSION_NAMESPACE,
232235
)

0 commit comments

Comments
 (0)