Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Monitoring] Await promise properly #29001

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export class BulkUploader {
if (payload) {
try {
this._log.debug(`Uploading bulk stats payload to the local cluster`);
this._onPayload(payload);
await this._onPayload(payload);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to await this on the tests that mock Elasticsearch, then assert that it sent the payload (or failed) with itself returning until it did that while also avoiding an exception being thrown from this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will work: be5c697

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pinging my favorite Chris @pickypg!

} catch (err) {
this._log.warn(err.stack);
this._log.warn(`Unable to bulk upload the stats payload to the local cluster`);
Expand Down