Skip to content

Commit

Permalink
Put createAlertsIndex into a correct dir to make TS resolve a path to it
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitaindik committed Jan 27, 2024
1 parent 5618841 commit a43f767
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { WebhookAuthType } from '@kbn/stack-connectors-plugin/common/webhook/con
import {
binaryToString,
checkInvestigationFieldSoValue,
createAlertsIndex,
createLegacyRuleAction,
createRule,
createSignalsIndex,
Expand All @@ -46,7 +47,6 @@ import {
getRuleSavedObjectWithLegacyInvestigationFieldsEmptyArray,
deleteAllExceptions,
} from '../../utils';
import { createAlertsIndex } from '../../../security_solution_api_integration/test_suites/detections_response/utils/alerts/create_alerts_index';
import { FtrProviderContext } from '../../common/ftr_provider_context';

// eslint-disable-next-line import/no-default-export
Expand Down
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
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from './binary_to_string';
export * from './check_investigation_field_in_so';
export * from './count_down_es';
export * from './count_down_test';
export * from './create_alerts_index';
export * from './create_container_with_endpoint_entries';
export * from './create_container_with_entries';
export * from './create_exception_list';
Expand Down

0 comments on commit a43f767

Please sign in to comment.