-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
21 changed files
with
121 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
...gins/actions/server/builtin_action_types/alert_history_es_index/alert_history_es_index.ts
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
x-pack/plugins/actions/server/builtin_action_types/alert_history_es_index/types.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
x-pack/plugins/alerting/server/alert_history/create_alert_history_index_template.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { contextMock } from './context.mock'; | ||
import { initializeEs } from './init'; | ||
|
||
describe('initializeEs', () => { | ||
let esContext = contextMock.create(); | ||
|
||
beforeEach(() => { | ||
esContext = contextMock.create(); | ||
}); | ||
|
||
test(`should create ILM policy if it doesn't exist`, async () => { | ||
esContext.esAdapter.doesIlmPolicyExist.mockResolvedValue(false); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesIlmPolicyExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIlmPolicy).toHaveBeenCalled(); | ||
}); | ||
|
||
test(`shouldn't create ILM policy if it exists`, async () => { | ||
esContext.esAdapter.doesIlmPolicyExist.mockResolvedValue(true); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesIlmPolicyExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIlmPolicy).not.toHaveBeenCalled(); | ||
}); | ||
|
||
test(`should create index template if it doesn't exist`, async () => { | ||
esContext.esAdapter.doesIndexTemplateExist.mockResolvedValue(false); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesIndexTemplateExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIndexTemplate).toHaveBeenCalled(); | ||
}); | ||
|
||
test(`shouldn't create index template if it already exists`, async () => { | ||
esContext.esAdapter.doesIndexTemplateExist.mockResolvedValue(true); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesIndexTemplateExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIndexTemplate).not.toHaveBeenCalled(); | ||
}); | ||
|
||
test(`should create initial index if it doesn't exist`, async () => { | ||
esContext.esAdapter.doesAliasExist.mockResolvedValue(false); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesAliasExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIndex).toHaveBeenCalled(); | ||
}); | ||
|
||
test(`shouldn't create initial index if it already exists`, async () => { | ||
esContext.esAdapter.doesAliasExist.mockResolvedValue(true); | ||
|
||
await initializeEs(esContext); | ||
expect(esContext.esAdapter.doesAliasExist).toHaveBeenCalled(); | ||
expect(esContext.esAdapter.createIndex).not.toHaveBeenCalled(); | ||
}); | ||
}); |
Oops, something went wrong.