Skip to content

Commit

Permalink
get the functional tests passing
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuellr committed Jul 11, 2019
1 parent f50be60 commit 7260dd7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ export default function emailTest({ getService }: KibanaFunctionalTestDefaultPro
actionTypeConfig: {
from: 'bob@example.com',
service: '__json',
host: null,
port: null,
secure: null,
},
},
references: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export default function slackTest({ getService }: KibanaFunctionalTestDefaultPro
statusCode: 400,
error: 'Bad Request',
message:
'The following actionTypeConfig attributes are invalid: webhookUrl [any.required]',
'The actionTypeConfig is invalid: [webhookUrl]: expected value of type [string] but got [undefined]',
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/api_integration/apis/actions/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function createActionTests({ getService }: KibanaFunctionalTestDe
statusCode: 400,
error: 'Bad Request',
message:
'The following actionTypeConfig attributes are invalid: encrypted [any.required]',
'The actionTypeConfig is invalid: [encrypted]: expected value of type [string] but got [undefined]',
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion x-pack/test/api_integration/apis/actions/update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export default function updateActionTests({ getService }: KibanaFunctionalTestDe
statusCode: 400,
error: 'Bad Request',
message:
'The following actionTypeConfig attributes are invalid: encrypted [any.required]',
'The actionTypeConfig is invalid: [encrypted]: expected value of type [string] but got [undefined]',
});
});
});
Expand Down
42 changes: 17 additions & 25 deletions x-pack/test/api_integration/fixtures/plugins/alerts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import Joi from 'joi';
import { schema } from '@kbn/config-schema';
import { AlertExecutorOptions, AlertType } from '../../../../../legacy/plugins/alerting';
import { ActionTypeExecutorOptions, ActionType } from '../../../../../legacy/plugins/actions';

Expand All @@ -20,19 +20,15 @@ export default function(kibana: any) {
name: 'Test: Index Record',
unencryptedAttributes: ['unencrypted'],
validate: {
params: Joi.object()
.keys({
index: Joi.string().required(),
reference: Joi.string().required(),
message: Joi.string().required(),
})
.required(),
config: Joi.object()
.keys({
encrypted: Joi.string().required(),
unencrypted: Joi.string().required(),
})
.required(),
params: schema.object({
index: schema.string(),
reference: schema.string(),
message: schema.string(),
}),
config: schema.object({
encrypted: schema.string(),
unencrypted: schema.string(),
}),
},
async executor({ config, params, services }: ActionTypeExecutorOptions) {
return await services.callCluster('index', {
Expand All @@ -52,12 +48,10 @@ export default function(kibana: any) {
name: 'Test: Failing',
unencryptedAttributes: [],
validate: {
params: Joi.object()
.keys({
index: Joi.string().required(),
reference: Joi.string().required(),
})
.required(),
params: schema.object({
index: schema.string(),
reference: schema.string(),
}),
},
async executor({ config, params, services }: ActionTypeExecutorOptions) {
await services.callCluster('index', {
Expand Down Expand Up @@ -143,11 +137,9 @@ export default function(kibana: any) {
id: 'test.validation',
name: 'Test: Validation',
validate: {
params: Joi.object()
.keys({
param1: Joi.string().required(),
})
.required(),
params: schema.object({
param1: schema.string(),
}),
},
async executor({ services, params, state }: AlertExecutorOptions) {},
};
Expand Down

0 comments on commit 7260dd7

Please sign in to comment.