Skip to content

Commit

Permalink
Scenario to test timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
mikecote committed Nov 16, 2020
1 parent dac35cf commit 43683af
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/alerts/server/alert_type_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export class AlertTypeRegistry {
this.taskManager.registerTaskDefinitions({
[`alerting:${alertType.id}`]: {
title: alertType.name,
timeout: '10s',
createTaskRunner: (context: RunContext) =>
this.taskRunnerFactory.create({ ...alertType } as AlertType, context),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,10 @@ export function defineAlertTypes(
actionGroups: [{ id: 'default', name: 'Default' }],
producer: 'alertsFixture',
defaultActionGroupId: 'default',
async executor() {},
async executor() {
console.log('Running', new Date().toISOString());
await new Promise(resolve => setTimeout(resolve, 30000));
},
};
const onlyContextVariablesAlertType: AlertType = {
id: 'test.onlyContextVariables',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,19 +245,19 @@ const Space1AllAtSpace2: Space1AllAtSpace2 = {
};

export const UserAtSpaceScenarios: [
NoKibanaPrivilegesAtSpace1,
// NoKibanaPrivilegesAtSpace1,
SuperuserAtSpace1,
GlobalReadAtSpace1,
Space1AllAtSpace1,
Space1AllAtSpace2,
Space1AllWithRestrictedFixtureAtSpace1,
Space1AllAlertingNoneActionsAtSpace1
// GlobalReadAtSpace1,
// Space1AllAtSpace1,
// Space1AllAtSpace2,
// Space1AllWithRestrictedFixtureAtSpace1,
// Space1AllAlertingNoneActionsAtSpace1
] = [
NoKibanaPrivilegesAtSpace1,
// NoKibanaPrivilegesAtSpace1,
SuperuserAtSpace1,
GlobalReadAtSpace1,
Space1AllAtSpace1,
Space1AllAtSpace2,
Space1AllWithRestrictedFixtureAtSpace1,
Space1AllAlertingNoneActionsAtSpace1,
// GlobalReadAtSpace1,
// Space1AllAtSpace1,
// Space1AllAtSpace2,
// Space1AllWithRestrictedFixtureAtSpace1,
// Space1AllAlertingNoneActionsAtSpace1,
];
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
describe('create', () => {
const objectRemover = new ObjectRemover(supertest);

after(() => objectRemover.removeAll());
// after(() => objectRemover.removeAll());

async function getScheduledTask(id: string) {
return await es.get({
Expand All @@ -37,7 +37,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
describe(scenario.id, () => {
it('should handle create alert request appropriately', async () => {
it.only('should handle create alert request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
Expand All @@ -55,6 +55,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
.auth(user.username, user.password)
.send(
getTestAlertData({
schedule: { interval: '10s' },
actions: [
{
id: createdAction.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ export default function alertingApiIntegrationTests({
await setupSpacesAndUsers(spacesService, securityService);
});

after(async () => {
await tearDownUsers(securityService);
// after(async () => {
// await tearDownUsers(securityService);

await esArchiver.unload('empty_kibana');
});
// await esArchiver.unload('empty_kibana');
// });

loadTestFile(require.resolve('./actions'));
loadTestFile(require.resolve('./alerting'));
Expand Down

0 comments on commit 43683af

Please sign in to comment.