fix benchmark test; add missing kube_pod_container_status_last_terminated_timestamp in pod tests
Signed-off-by: Tetiana Kravchenko <tetiana.kravchenko@elastic.co>
This commit is contained in:
parent
8876d40ecd
commit
dbdb77c920
|
|
@ -690,7 +690,6 @@ func TestPodStore(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
|
||||
Obj: &v1.Pod{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "pod6",
|
||||
|
|
@ -797,6 +796,9 @@ func TestPodStore(t *testing.T) {
|
|||
Terminated: &v1.ContainerStateTerminated{
|
||||
Reason: "DeadlineExceeded",
|
||||
ExitCode: 143,
|
||||
FinishedAt: metav1.Time{
|
||||
Time: time.Unix(1501779547, 0),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -806,6 +808,7 @@ func TestPodStore(t *testing.T) {
|
|||
Want: `
|
||||
# HELP kube_pod_container_status_last_terminated_exitcode Describes the exit code for the last container in terminated state.
|
||||
# HELP kube_pod_container_status_last_terminated_reason Describes the last reason the container was in terminated state.
|
||||
# HELP kube_pod_container_status_last_terminated_timestamp Last terminated time for a pod container, when container was terminated with kube_pod_container_status_last_terminated_reason, in unix timestamp.
|
||||
# HELP kube_pod_container_status_running [STABLE] Describes whether the container is currently in running state.
|
||||
# HELP kube_pod_container_state_started [STABLE] Start time in unix timestamp for a pod container.
|
||||
# HELP kube_pod_container_status_terminated [STABLE] Describes whether the container is currently in terminated state.
|
||||
|
|
@ -814,6 +817,7 @@ func TestPodStore(t *testing.T) {
|
|||
# HELP kube_pod_container_status_waiting_reason [STABLE] Describes the reason the container is currently in waiting state.
|
||||
# TYPE kube_pod_container_status_last_terminated_exitcode gauge
|
||||
# TYPE kube_pod_container_status_last_terminated_reason gauge
|
||||
# TYPE kube_pod_container_status_last_terminated_timestamp gauge
|
||||
# TYPE kube_pod_container_status_running gauge
|
||||
# TYPE kube_pod_container_state_started gauge
|
||||
# TYPE kube_pod_container_status_terminated gauge
|
||||
|
|
@ -823,6 +827,7 @@ func TestPodStore(t *testing.T) {
|
|||
kube_pod_container_state_started{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1.501777018e+09
|
||||
kube_pod_container_status_last_terminated_exitcode{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 143
|
||||
kube_pod_container_status_last_terminated_reason{container="container7",namespace="ns7",pod="pod7",reason="DeadlineExceeded",uid="uid7"} 1
|
||||
kube_pod_container_status_last_terminated_timestamp{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1.501779547e+09
|
||||
kube_pod_container_status_running{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 1
|
||||
kube_pod_container_status_terminated{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 0
|
||||
kube_pod_container_status_waiting{container="container7",namespace="ns7",pod="pod7",uid="uid7"} 0
|
||||
|
|
@ -832,6 +837,7 @@ func TestPodStore(t *testing.T) {
|
|||
"kube_pod_container_state_started",
|
||||
"kube_pod_container_status_terminated",
|
||||
"kube_pod_container_status_terminated_reason",
|
||||
"kube_pod_container_status_last_terminated_timestamp",
|
||||
"kube_pod_container_status_waiting",
|
||||
"kube_pod_container_status_last_terminated_reason",
|
||||
"kube_pod_container_status_last_terminated_exitcode",
|
||||
|
|
@ -2217,6 +2223,9 @@ func BenchmarkPodStore(b *testing.B) {
|
|||
},
|
||||
LastTerminationState: v1.ContainerState{
|
||||
Terminated: &v1.ContainerStateTerminated{
|
||||
FinishedAt: metav1.Time{
|
||||
Time: time.Unix(1501779547, 0),
|
||||
},
|
||||
Reason: "OOMKilled",
|
||||
ExitCode: 137,
|
||||
},
|
||||
|
|
@ -2234,6 +2243,9 @@ func BenchmarkPodStore(b *testing.B) {
|
|||
},
|
||||
LastTerminationState: v1.ContainerState{
|
||||
Terminated: &v1.ContainerStateTerminated{
|
||||
FinishedAt: metav1.Time{
|
||||
Time: time.Unix(1501779547, 0),
|
||||
},
|
||||
Reason: "OOMKilled",
|
||||
ExitCode: 137,
|
||||
},
|
||||
|
|
@ -2251,6 +2263,9 @@ func BenchmarkPodStore(b *testing.B) {
|
|||
},
|
||||
LastTerminationState: v1.ContainerState{
|
||||
Terminated: &v1.ContainerStateTerminated{
|
||||
FinishedAt: metav1.Time{
|
||||
Time: time.Unix(1501779547, 0),
|
||||
},
|
||||
Reason: "OOMKilled",
|
||||
ExitCode: 137,
|
||||
},
|
||||
|
|
@ -2260,7 +2275,7 @@ func BenchmarkPodStore(b *testing.B) {
|
|||
},
|
||||
}
|
||||
|
||||
expectedFamilies := 53
|
||||
expectedFamilies := 54
|
||||
for n := 0; n < b.N; n++ {
|
||||
families := f(pod)
|
||||
if len(families) != expectedFamilies {
|
||||
|
|
|
|||
Loading…
Reference in New Issue