Skip to content

Commit 643739d

Browse files
committed
Add unit test
1 parent 20589ac commit 643739d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

internal/store/job_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,28 @@ func TestJobStore(t *testing.T) {
208208
kube_job_status_failed{job_name="FailedJob1",namespace="ns1",reason="Evicted"} 0
209209
kube_job_status_start_time{job_name="FailedJob1",namespace="ns1"} 1.495807207e+09
210210
kube_job_status_succeeded{job_name="FailedJob1",namespace="ns1"} 0
211+
`,
212+
},
213+
{
214+
Obj: &v1batch.Job{
215+
ObjectMeta: metav1.ObjectMeta{
216+
Name: "FailedJobWithNoConditions",
217+
Namespace: "ns1",
218+
},
219+
Status: v1batch.JobStatus{
220+
Failed: 1,
221+
},
222+
Spec: v1batch.JobSpec{
223+
ActiveDeadlineSeconds: &ActiveDeadlineSeconds900,
224+
},
225+
},
226+
Want: metadata + `
227+
kube_job_owner{job_name="FailedJobWithNoConditions",namespace="ns1",owner_is_controller="",owner_kind="",owner_name=""} 1
228+
kube_job_info{job_name="FailedJobWithNoConditions",namespace="ns1"} 1
229+
kube_job_spec_active_deadline_seconds{job_name="FailedJobWithNoConditions",namespace="ns1"} 900
230+
kube_job_status_active{job_name="FailedJobWithNoConditions",namespace="ns1"} 0
231+
kube_job_status_failed{job_name="FailedJobWithNoConditions",namespace="ns1",reason=""} 1
232+
kube_job_status_succeeded{job_name="FailedJobWithNoConditions",namespace="ns1"} 0
211233
`,
212234
},
213235
{

0 commit comments

Comments
 (0)