Skip to content

Commit

Permalink
fix tests and enable in CI (#75313)
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic authored Aug 19, 2020
1 parent eb3cb82 commit 9111d50
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 4 deletions.
1 change: 1 addition & 0 deletions x-pack/scripts/functional_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const onlyNotInCoverageTests = [
require.resolve('../test/alerting_api_integration/basic/config.ts'),
require.resolve('../test/alerting_api_integration/spaces_only/config.ts'),
require.resolve('../test/alerting_api_integration/security_and_spaces/config.ts'),
require.resolve('../test/case_api_integration/basic/config.ts'),
require.resolve('../test/apm_api_integration/basic/config.ts'),
require.resolve('../test/apm_api_integration/trial/config.ts'),
require.resolve('../test/detection_engine_api_integration/security_and_spaces/config.ts'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ import { FtrProviderContext } from '../../../common/ftr_provider_context';

import { CASE_CONFIGURE_CONNECTORS_URL } from '../../../../../plugins/case/common/constants';
import { ObjectRemover as ActionsRemover } from '../../../../alerting_api_integration/common/lib';
import { getServiceNowConnector, getJiraConnector } from '../../../common/lib/utils';
import {
getServiceNowConnector,
getJiraConnector,
getResilientConnector,
} from '../../../common/lib/utils';

// eslint-disable-next-line import/no-default-export
export default ({ getService }: FtrProviderContext): void => {
Expand Down Expand Up @@ -61,23 +65,33 @@ export default ({ getService }: FtrProviderContext): void => {
.send(getJiraConnector())
.expect(200);

const { body: connectorFour } = await supertest
.post('/api/actions/action')
.set('kbn-xsrf', 'true')
.send(getResilientConnector())
.expect(200);

actionsRemover.add('default', connectorOne.id, 'action', 'actions');
actionsRemover.add('default', connectorTwo.id, 'action', 'actions');
actionsRemover.add('default', connectorThree.id, 'action', 'actions');
actionsRemover.add('default', connectorFour.id, 'action', 'actions');

const { body: connectors } = await supertest
.get(`${CASE_CONFIGURE_CONNECTORS_URL}/_find`)
.set('kbn-xsrf', 'true')
.send()
.expect(200);

expect(connectors.length).to.equal(2);
expect(connectors.length).to.equal(3);
expect(
connectors.some((c: { actionTypeId: string }) => c.actionTypeId === '.servicenow')
).to.equal(true);
expect(connectors.some((c: { actionTypeId: string }) => c.actionTypeId === '.jira')).to.equal(
true
);
expect(
connectors.some((c: { actionTypeId: string }) => c.actionTypeId === '.resilient')
).to.equal(true);
});
});
};
3 changes: 2 additions & 1 deletion x-pack/test/case_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ interface CreateTestConfigOptions {
const enabledActionTypes = [
'.email',
'.index',
'.jira',
'.pagerduty',
'.resilient',
'.server-log',
'.servicenow',
'.jira',
'.slack',
'.webhook',
'test.authorization',
Expand Down
35 changes: 34 additions & 1 deletion x-pack/test/case_api_integration/common/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const getServiceNowConnector = () => ({
},
config: {
apiUrl: 'http://some.non.existent.com',
casesConfiguration: {
incidentConfiguration: {
mapping: [
{
source: 'title',
Expand All @@ -52,6 +52,7 @@ export const getServiceNowConnector = () => ({
},
],
},
isCaseOwned: true,
},
});

Expand Down Expand Up @@ -87,6 +88,38 @@ export const getJiraConnector = () => ({
},
});

export const getResilientConnector = () => ({
name: 'Resilient Connector',
actionTypeId: '.resilient',
secrets: {
apiKeyId: 'id',
apiKeySecret: 'secret',
},
config: {
apiUrl: 'http://some.non.existent.com',
orgId: 'pkey',
casesConfiguration: {
mapping: [
{
source: 'title',
target: 'summary',
actionType: 'overwrite',
},
{
source: 'description',
target: 'description',
actionType: 'overwrite',
},
{
source: 'comments',
target: 'comments',
actionType: 'append',
},
],
},
},
});

export const removeServerGeneratedPropertiesFromConfigure = (
config: Partial<CasesConfigureResponse>
): Partial<CasesConfigureResponse> => {
Expand Down

0 comments on commit 9111d50

Please sign in to comment.