mirror of
https://github.com/prometheus-operator/prometheus-operator.git
synced 2025-04-20 19:29:10 +00:00
Fix TestListenLocal with new liveness and readiness probes
This commit is contained in:
parent
5eb9cb53db
commit
8011f6364c
1 changed files with 34 additions and 4 deletions
|
@ -382,12 +382,42 @@ func TestListenLocal(t *testing.T) {
|
|||
t.Fatal("Prometheus not listening on loopback when it should.")
|
||||
}
|
||||
|
||||
if sset.Spec.Template.Spec.Containers[0].ReadinessProbe != nil {
|
||||
t.Fatal("Prometheus readiness probe expected to be empty")
|
||||
actualReadinessProbe := sset.Spec.Template.Spec.Containers[0].ReadinessProbe
|
||||
expectedReadinessProbe := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{
|
||||
`sh`,
|
||||
`-c`,
|
||||
`if [ -x "$(command -v curl)" ]; then curl http://localhost:9090/-/ready; elif [ -x "$(command -v wget)" ]; then wget -q http://localhost:9090/-/ready; else exit 1; fi`,
|
||||
},
|
||||
},
|
||||
},
|
||||
TimeoutSeconds: 3,
|
||||
PeriodSeconds: 5,
|
||||
FailureThreshold: 120,
|
||||
}
|
||||
if !reflect.DeepEqual(actualReadinessProbe, expectedReadinessProbe) {
|
||||
t.Fatalf("Readiness probe doesn't match expected. \n\nExpected: %+v\n\nGot: %+v", expectedReadinessProbe, actualReadinessProbe)
|
||||
}
|
||||
|
||||
if sset.Spec.Template.Spec.Containers[0].LivenessProbe != nil {
|
||||
t.Fatal("Prometheus readiness probe expected to be empty")
|
||||
actualLivenessProbe := sset.Spec.Template.Spec.Containers[0].LivenessProbe
|
||||
expectedLivenessProbe := &v1.Probe{
|
||||
Handler: v1.Handler{
|
||||
Exec: &v1.ExecAction{
|
||||
Command: []string{
|
||||
`sh`,
|
||||
`-c`,
|
||||
`if [ -x "$(command -v curl)" ]; then curl http://localhost:9090/-/healthy; elif [ -x "$(command -v wget)" ]; then wget -q http://localhost:9090/-/healthy; else exit 1; fi`,
|
||||
},
|
||||
},
|
||||
},
|
||||
TimeoutSeconds: 3,
|
||||
PeriodSeconds: 5,
|
||||
FailureThreshold: 6,
|
||||
}
|
||||
if !reflect.DeepEqual(actualLivenessProbe, expectedLivenessProbe) {
|
||||
t.Fatalf("Liveness probe doesn't match expected. \n\nExpected: %v\n\nGot: %v", expectedLivenessProbe, actualLivenessProbe)
|
||||
}
|
||||
|
||||
if len(sset.Spec.Template.Spec.Containers[0].Ports) != 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue