Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
richabanker committed Aug 28, 2024
1 parent 20589ac commit 643739d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions internal/store/job_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,28 @@ func TestJobStore(t *testing.T) {
kube_job_status_failed{job_name="FailedJob1",namespace="ns1",reason="Evicted"} 0
kube_job_status_start_time{job_name="FailedJob1",namespace="ns1"} 1.495807207e+09
kube_job_status_succeeded{job_name="FailedJob1",namespace="ns1"} 0
`,
},
{
Obj: &v1batch.Job{
ObjectMeta: metav1.ObjectMeta{
Name: "FailedJobWithNoConditions",
Namespace: "ns1",
},
Status: v1batch.JobStatus{
Failed: 1,
},
Spec: v1batch.JobSpec{
ActiveDeadlineSeconds: &ActiveDeadlineSeconds900,
},
},
Want: metadata + `
kube_job_owner{job_name="FailedJobWithNoConditions",namespace="ns1",owner_is_controller="",owner_kind="",owner_name=""} 1
kube_job_info{job_name="FailedJobWithNoConditions",namespace="ns1"} 1
kube_job_spec_active_deadline_seconds{job_name="FailedJobWithNoConditions",namespace="ns1"} 900
kube_job_status_active{job_name="FailedJobWithNoConditions",namespace="ns1"} 0
kube_job_status_failed{job_name="FailedJobWithNoConditions",namespace="ns1",reason=""} 1
kube_job_status_succeeded{job_name="FailedJobWithNoConditions",namespace="ns1"} 0
`,
},
{
Expand Down

0 comments on commit 643739d

Please sign in to comment.