-
Bug
-
Resolution: Unresolved
-
Minor
-
4.22.0
-
None
Description of problem:
=== RUN TestPrometheusMetrics/openshift-state-metrics
prometheus_test.go:47: context deadline exceeded: error validating response body "{\"status\":\"success\",\"data\":{\"resultType\":\"vector\",\"result\":[{\"metric\":{},\"value\":[1772782825.210,\"1\"]}],\"analysis\":{}}}" for query "count(last_over_time(up{service=\"openshift-state-metrics\",namespace=\"openshift-monitoring\"}[1m]) == 1)": expected 2 targets to be up but got 1.000000
--- FAIL: TestPrometheusMetrics (60.51s)
"count(last_over_time(up{service="%s",namespace="openshift-monitoring"}[1m]) == 1)" value is integer, not float64
$ oc -n openshift-monitoring exec -c prometheus prometheus-k8s-0 -- curl -k -H "Authorization: Bearer $token" 'https://thanos-querier.openshift-monitoring.svc:9091/api/v1/query?' --data-urlencode 'query=count(last_over_time(up{service="openshift-state-metrics",namespace="openshift-monitoring"}[1m]) == 1)' | jq { "status": "success", "data": { "resultType": "vector", "result": [ { "metric": {}, "value": [ 1773219769.297, "2" ] } ], "analysis": {} } }
func is TestPrometheusMetrics, code: https://github.com/openshift/cluster-monitoring-operator/blob/main/test/e2e/prometheus_test.go#L32
change
return fmt.Errorf("expected %d targets to be up but got %f", metric, v)
to
return fmt.Errorf("expected %d targets to be up but got %v", metric, v)
would be fine