Skip to content

Commit

Permalink
Fixed due to comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YulNaumenko committed Apr 16, 2020
1 parent 41e96fb commit 65b3744
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
12 changes: 7 additions & 5 deletions x-pack/plugins/event_log/server/es/context.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
import { createEsContext } from './context';
import { ClusterClient, Logger } from '../../../../../src/core/server';
import { elasticsearchServiceMock, loggingServiceMock } from '../../../../../src/core/server/mocks';

jest.mock('../lib/../../../../package.json', () => ({
version: '1.2.3',
}));
type EsClusterClient = Pick<jest.Mocked<ClusterClient>, 'callAsInternalUser' | 'asScoped'>;

let logger: Logger;
Expand Down Expand Up @@ -42,12 +44,12 @@ describe('createEsContext', () => {
const esNames = context.esNames;
expect(esNames).toStrictEqual({
base: 'test-index',
alias: 'test-index-event-log-8.0.0',
alias: 'test-index-event-log-1.2.3',
ilmPolicy: 'test-index-event-log-policy',
indexPattern: 'test-index-event-log-*',
indexPatternWithVersion: 'test-index-event-log-8.0.0-*',
indexTemplate: 'test-index-event-log-8.0.0-template',
initialIndex: 'test-index-event-log-8.0.0-000001',
indexPatternWithVersion: 'test-index-event-log-1.2.3-*',
indexTemplate: 'test-index-event-log-1.2.3-template',
initialIndex: 'test-index-event-log-1.2.3-000001',
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default function({ getService }: FtrProviderContext) {
.get('kbnTestServer.serverArgs')
.find((val: string) => val === '--xpack.eventLog.indexEntries=true');
const result = await isIndexingEntries();
const exists = await es.indices.exists({ index: '.kibana-event-log-8.0.0-000001' });
const exists = await es.indices.exists({ index: '.kibana-event-log-*' });
expect(exists).to.be.eql(true);
expect(configValue).to.be.eql(
`--xpack.eventLog.indexEntries=${result.body.isIndexingEntries}`
Expand Down Expand Up @@ -105,7 +105,9 @@ export default function({ getService }: FtrProviderContext) {
kibana: { saved_objects: [{ type: 'event_log_test', id: eventId }] },
};
await startTimingEventLogger(event);
setTimeout(() => log.debug('doing some action'), 500);
retry.try(async () => {
Promise.resolve(log.debug('doing some action'));
});
await stopTimingEventLogger(event);
await logTestEvent(eventId, event);

Expand Down Expand Up @@ -133,7 +135,9 @@ export default function({ getService }: FtrProviderContext) {
kibana: { saved_objects: [{ type: 'action', id: eventId }] },
};
await startTimingEventLogger(event);
setTimeout(() => log.debug('doing some action'), 500);
retry.try(async () => {
Promise.resolve(log.debug('doing some action'));
});
await stopTimingEventLogger(event);
await logTestEvent(eventId, event);

Expand Down

0 comments on commit 65b3744

Please sign in to comment.