-
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.
Put createAlertsIndex into a correct dir to make TS resolve a path to it
- Loading branch information
1 parent
5618841
commit a43f767
Showing
3 changed files
with
39 additions
and
1 deletion.
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
37 changes: 37 additions & 0 deletions
37
x-pack/test/detection_engine_api_integration/utils/create_alerts_index.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,37 @@ | ||
/* | ||
* 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 type SuperTest from 'supertest'; | ||
import { ToolingLog } from '@kbn/tooling-log'; | ||
|
||
import { DETECTION_ENGINE_INDEX_URL } from '@kbn/security-solution-plugin/common/constants'; | ||
import { countDownTest } from './count_down_test'; | ||
|
||
/** | ||
* Creates the alerts index for use inside of beforeEach blocks of tests | ||
* This will retry 50 times before giving up and hopefully still not interfere with other tests | ||
* @param supertest The supertest client library | ||
*/ | ||
export const createAlertsIndex = async ( | ||
supertest: SuperTest.SuperTest<SuperTest.Test>, | ||
log: ToolingLog | ||
): Promise<void> => { | ||
await countDownTest( | ||
async () => { | ||
await supertest | ||
.post(DETECTION_ENGINE_INDEX_URL) | ||
.set('kbn-xsrf', 'true') | ||
.set('elastic-api-version', '2023-10-31') | ||
.send(); | ||
return { | ||
passed: true, | ||
}; | ||
}, | ||
'createAlertsIndex', | ||
log | ||
); | ||
}; |
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