smoketest: fix healthcheck to wait for the resource to be ready #13359
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation/summary
Healthcheck for smoke test parses API responses body to confirm that the APM Server is up and running before sending events. Currently, the condition is always true even when the
.publish_ready
isn't set to true, which makes the health check to be successful even the resource is not ready.example of the case:
The response didn't contain
.publish_ready
but the healthcheck passed.This PR fixes the check to wait for the readiness correctly.
Checklist
For functional changes, consider:
How to test these changes
The successful response look like this:
run this snippet script(copied from the lib.sh) locally with different RES:
It should print followings
❯ RES="{ }" ./test-healthcheck.sh
-> APM Server isn't ready to receive events, maximum retries exceeded
❯ RES="{"publish_ready": true }" ./test-healthcheck.sh
-> APM Server ready!
❯ RES="{"publish_ready": false }" ./test-healthcheck.sh
-> APM Server isn't ready to receive events, maximum retries exceeded
Related issues