mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
* Await this promise * Add one additional log message and a test around that
This commit is contained in:
parent
8ba8772f92
commit
67dc8c080c
2 changed files with 8 additions and 3 deletions
|
@ -39,7 +39,9 @@ describe('BulkUploader', () => {
|
|||
getCluster: () => ({
|
||||
createClient: () => ({
|
||||
monitoring: {
|
||||
bulk: sinon.spy(),
|
||||
bulk: function () {
|
||||
return new Promise(resolve => setTimeout(resolve, CHECK_DELAY + 1));
|
||||
}
|
||||
},
|
||||
}),
|
||||
callWithInternalUser: sinon.spy(), // this tests internal collection and bulk upload, not HTTP API
|
||||
|
@ -106,7 +108,9 @@ describe('BulkUploader', () => {
|
|||
uploader.stop();
|
||||
|
||||
const loggingCalls = server.log.getCalls();
|
||||
expect(loggingCalls.length).to.be.greaterThan(2); // should be 3-5: start, fetch, upload, fetch, upload
|
||||
// If we are properly awaiting the bulk upload call, we shouldn't see
|
||||
// the last 2 logs as the call takes longer than this timeout (see the above mock)
|
||||
expect(loggingCalls.length).to.be(4);
|
||||
expect(loggingCalls[0].args).to.eql([
|
||||
['info', 'monitoring-ui', 'kibana-monitoring'],
|
||||
'Starting monitoring stats collection',
|
||||
|
|
|
@ -103,7 +103,8 @@ export class BulkUploader {
|
|||
if (payload) {
|
||||
try {
|
||||
this._log.debug(`Uploading bulk stats payload to the local cluster`);
|
||||
this._onPayload(payload);
|
||||
await this._onPayload(payload);
|
||||
this._log.debug(`Uploaded bulk stats payload to the local cluster`);
|
||||
} catch (err) {
|
||||
this._log.warn(err.stack);
|
||||
this._log.warn(`Unable to bulk upload the stats payload to the local cluster`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue