Add check to ensure data.results is not empty
What does this MR do and why?
While investigating #378174 (closed) I noted that we do not do any type of assertion on the data.results
array to
ensure there's actually data to validate against.
In some situations we may get an empty result array back - {"status":"success","data":{"resultType":"vector","result":[]}}
and in these cases this test should error out to indicate the environment isn't as expected.
- on a brand new instance where no requests have happened
- if the metric stops updating for some reason
- if we misconfigure prometheus
In the mentioned E2E failures - the issue is a misconfiguration - and the spec 'reads from each node'
should have also failed as a result.
However because it's an empty array - it manages to slip through and appears to be a passing test -- this is incorrect and this spec should have also failed in addition to the 'when a node is unhealthy'
spec.
How to set up and validate locally
- For a failing job see https://gitlab.com/gitlab-org/gitlab/-/jobs/3359580967 test failed as expected
- This fails with builds of gitlab-qa <8.13.1
- For a passing job, see https://gitlab.com/gitlab-org/gitlab/-/jobs/3372443890
- This passes with builds of gitlab-qa >=8.13.1 due to the fix Fix bug in config for prometheus_listen_addr (gitlab-qa!1087 - merged)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.