Skip to content

Commit

Permalink
Improved AlertsClient tests structure by splitting a huge alerts_clie…
Browse files Browse the repository at this point in the history
…nt.tests.ts file into a specific files defined by its responsibility. (#80088) (#80348)

fairly large refactor, but no functional changes

Co-authored-by: Yuliia Naumenko <[email protected]>
  • Loading branch information
pmuellr and YulNaumenko authored Oct 13, 2020
1 parent ae740fa commit bc710a7
Show file tree
Hide file tree
Showing 19 changed files with 5,275 additions and 4,585 deletions.
4,567 changes: 0 additions & 4,567 deletions x-pack/plugins/alerts/server/alerts_client.test.ts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
SavedObject,
PluginInitializerContext,
} from 'src/core/server';
import { esKuery } from '../../../../src/plugins/data/server';
import { ActionsClient, ActionsAuthorization } from '../../actions/server';
import { esKuery } from '../../../../../src/plugins/data/server';
import { ActionsClient, ActionsAuthorization } from '../../../actions/server';
import {
Alert,
PartialAlert,
Expand All @@ -27,26 +27,26 @@ import {
SanitizedAlert,
AlertTaskState,
AlertInstanceSummary,
} from './types';
import { validateAlertTypeParams, alertExecutionStatusFromRaw } from './lib';
} from '../types';
import { validateAlertTypeParams, alertExecutionStatusFromRaw } from '../lib';
import {
InvalidateAPIKeyParams,
GrantAPIKeyResult as SecurityPluginGrantAPIKeyResult,
InvalidateAPIKeyResult as SecurityPluginInvalidateAPIKeyResult,
} from '../../security/server';
import { EncryptedSavedObjectsClient } from '../../encrypted_saved_objects/server';
import { TaskManagerStartContract } from '../../task_manager/server';
import { taskInstanceToAlertTaskInstance } from './task_runner/alert_task_instance';
import { deleteTaskIfItExists } from './lib/delete_task_if_it_exists';
import { RegistryAlertType } from './alert_type_registry';
import { AlertsAuthorization, WriteOperations, ReadOperations, and } from './authorization';
import { IEventLogClient } from '../../../plugins/event_log/server';
import { parseIsoOrRelativeDate } from './lib/iso_or_relative_date';
import { alertInstanceSummaryFromEventLog } from './lib/alert_instance_summary_from_event_log';
import { IEvent } from '../../event_log/server';
import { parseDuration } from '../common/parse_duration';
import { retryIfConflicts } from './lib/retry_if_conflicts';
import { partiallyUpdateAlert } from './saved_objects';
} from '../../../security/server';
import { EncryptedSavedObjectsClient } from '../../../encrypted_saved_objects/server';
import { TaskManagerStartContract } from '../../../task_manager/server';
import { taskInstanceToAlertTaskInstance } from '../task_runner/alert_task_instance';
import { deleteTaskIfItExists } from '../lib/delete_task_if_it_exists';
import { RegistryAlertType } from '../alert_type_registry';
import { AlertsAuthorization, WriteOperations, ReadOperations, and } from '../authorization';
import { IEventLogClient } from '../../../../plugins/event_log/server';
import { parseIsoOrRelativeDate } from '../lib/iso_or_relative_date';
import { alertInstanceSummaryFromEventLog } from '../lib/alert_instance_summary_from_event_log';
import { IEvent } from '../../../event_log/server';
import { parseDuration } from '../../common/parse_duration';
import { retryIfConflicts } from '../lib/retry_if_conflicts';
import { partiallyUpdateAlert } from '../saved_objects';

export interface RegistryAlertTypeWithAuth extends RegistryAlertType {
authorizedConsumers: string[];
Expand Down
6 changes: 6 additions & 0 deletions x-pack/plugins/alerts/server/alerts_client/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
export * from './alerts_client';
Loading

0 comments on commit bc710a7

Please sign in to comment.