Skip to content

Commit ad5a7ac

Browse files
author
Ryan R. Olds
committed
Added a test for kube_pod_status_container_ready_time
1 parent 59b1728 commit ad5a7ac

File tree

1 file changed

+28
-2
lines changed

1 file changed

+28
-2
lines changed

internal/store/pod_test.go

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,32 @@ func TestPodStore(t *testing.T) {
14341434
`,
14351435
MetricNames: []string{"kube_pod_status_reason"},
14361436
},
1437+
{
1438+
Obj: &v1.Pod{
1439+
ObjectMeta: metav1.ObjectMeta{
1440+
Name: "pod1",
1441+
Namespace: "ns1",
1442+
UID: "uid1",
1443+
},
1444+
Status: v1.PodStatus{
1445+
Conditions: []v1.PodCondition{
1446+
{
1447+
Type: v1.ContainersReady,
1448+
Status: v1.ConditionTrue,
1449+
LastTransitionTime: metav1.Time{
1450+
Time: time.Unix(1501666018, 0),
1451+
},
1452+
},
1453+
},
1454+
},
1455+
},
1456+
Want: `
1457+
# HELP kube_pod_status_container_ready_time Readiness achieved time in unix timestamp for a pod containers.
1458+
# TYPE kube_pod_status_container_ready_time gauge
1459+
kube_pod_status_container_ready_time{namespace="ns1",pod="pod1",uid="uid1"} 1.501666018e+09
1460+
`,
1461+
MetricNames: []string{"kube_pod_status_container_ready_time"},
1462+
},
14371463
{
14381464
Obj: &v1.Pod{
14391465
ObjectMeta: metav1.ObjectMeta{
@@ -1463,7 +1489,7 @@ func TestPodStore(t *testing.T) {
14631489
kube_pod_status_ready{condition="true",namespace="ns1",pod="pod1",uid="uid1"} 1
14641490
kube_pod_status_ready{condition="unknown",namespace="ns1",pod="pod1",uid="uid1"} 0
14651491
`,
1466-
MetricNames: []string{"kube_pod_status_ready"},
1492+
MetricNames: []string{"kube_pod_status_ready_time", "kube_pod_status_ready"},
14671493
},
14681494
{
14691495
Obj: &v1.Pod{
@@ -1494,7 +1520,7 @@ func TestPodStore(t *testing.T) {
14941520
kube_pod_status_ready{condition="true",namespace="ns2",pod="pod2",uid="uid2"} 0
14951521
kube_pod_status_ready{condition="unknown",namespace="ns2",pod="pod2",uid="uid2"} 0
14961522
`,
1497-
MetricNames: []string{"kube_pod_status_ready"},
1523+
MetricNames: []string{"kube_pod_status_ready_time", "kube_pod_status_ready"},
14981524
},
14991525
{
15001526
Obj: &v1.Pod{

0 commit comments

Comments
 (0)