From 25a93f0c3ceb5eb5eb96d2d97af2dbb7b50b2352 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Sat, 22 Jul 2023 15:42:15 +0300 Subject: [PATCH] Fixes --- x-pack/plugins/actions/server/plugin.test.ts | 8 ++++---- x-pack/plugins/actions/server/plugin.ts | 4 ++-- .../actions/server/usage/actions_telemetry.test.ts | 1 + .../server/application/rule/create/create_rule.test.ts | 7 +++++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/actions/server/plugin.test.ts b/x-pack/plugins/actions/server/plugin.test.ts index bcdfe098bb493..6752f85e9a464 100644 --- a/x-pack/plugins/actions/server/plugin.test.ts +++ b/x-pack/plugins/actions/server/plugin.test.ts @@ -579,7 +579,7 @@ describe('Actions Plugin', () => { getConfig({ preconfigured: { preconfiguredServerLog: { - actionTypeId: '.cases', + actionTypeId: 'test.system-action', name: 'preconfigured-system-action', config: {}, secrets: {}, @@ -593,8 +593,8 @@ describe('Actions Plugin', () => { const pluginSetup = await plugin.setup(coreSetup as any, pluginsSetup); pluginSetup.registerType({ - id: '.cases', - name: 'Cases', + id: 'test.system-action', + name: 'Test', minimumLicenseRequired: 'platinum', supportedFeatureIds: ['alerting'], validate: { @@ -609,7 +609,7 @@ describe('Actions Plugin', () => { await expect(async () => plugin.start(coreStart, pluginsStart) ).rejects.toThrowErrorMatchingInlineSnapshot( - `"Setting system action types in preconfigured connectors is not allowed"` + `"Setting system action types in preconfigured connectors are not allowed"` ); }); }); diff --git a/x-pack/plugins/actions/server/plugin.ts b/x-pack/plugins/actions/server/plugin.ts index ad5fe3ccb1a34..663222058b39f 100644 --- a/x-pack/plugins/actions/server/plugin.ts +++ b/x-pack/plugins/actions/server/plugin.ts @@ -624,11 +624,11 @@ export class ActionsPlugin implements Plugin connector.isPreconfigured ); - const systemActionAsPreconfiguredInConfig = preConfiguredConnectors.some((connector) => + const isSystemActionAsPreconfiguredInConfig = preConfiguredConnectors.some((connector) => this.actionTypeRegistry!.isSystemActionType(connector.actionTypeId) ); - if (systemActionAsPreconfiguredInConfig) { + if (isSystemActionAsPreconfiguredInConfig) { throw new Error('Setting system action types in preconfigured connectors are not allowed'); } }; diff --git a/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts b/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts index 8842461bee1a3..72f487871c24f 100644 --- a/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts +++ b/x-pack/plugins/actions/server/usage/actions_telemetry.test.ts @@ -483,6 +483,7 @@ describe('actions telemetry', () => { isDeprecated: false, isSystemAction: true, secrets: {}, + config: {}, }, ]); diff --git a/x-pack/plugins/alerting/server/application/rule/create/create_rule.test.ts b/x-pack/plugins/alerting/server/application/rule/create/create_rule.test.ts index fbceacbd5e3b7..7af8c356e5e7b 100644 --- a/x-pack/plugins/alerting/server/application/rule/create/create_rule.test.ts +++ b/x-pack/plugins/alerting/server/application/rule/create/create_rule.test.ts @@ -1250,6 +1250,7 @@ describe('create()', () => { id: '1', type: 'alert', attributes: { + executionStatus: getRuleExecutionStatusPending('2019-02-12T21:01:22.479Z'), alertTypeId: '123', schedule: { interval: '1m' }, params: { @@ -1338,6 +1339,10 @@ describe('create()', () => { ], "alertTypeId": "123", "createdAt": 2019-02-12T21:01:22.479Z, + "executionStatus": Object { + "lastExecutionDate": 2019-02-12T21:01:22.000Z, + "status": "pending", + }, "id": "1", "notifyWhen": null, "params": Object { @@ -1392,10 +1397,8 @@ describe('create()', () => { enabled: true, legacyId: null, executionStatus: { - error: null, lastExecutionDate: '2019-02-12T21:01:22.479Z', status: 'pending', - warning: null, }, monitoring: getDefaultMonitoring('2019-02-12T21:01:22.479Z'), meta: { versionApiKeyLastmodified: kibanaVersion },